fixed bug #637:
"Shutdown window didn't draw fancy gray box where closing app's icons are shown as in BeOS." git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20395 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -244,18 +244,12 @@ public:
|
|||||||
// create the views
|
// create the views
|
||||||
|
|
||||||
// root view
|
// root view
|
||||||
BView *rootView = new(nothrow) BView(BRect(0, 0, 100, 15), "app icons",
|
fRootView = new(nothrow) TAlertView(BRect(0, 0, 100, 15), "app icons",
|
||||||
B_FOLLOW_NONE, 0);
|
B_FOLLOW_NONE, 0);
|
||||||
if (!rootView)
|
if (!fRootView)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
fRootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
AddChild(rootView);
|
AddChild(fRootView);
|
||||||
|
|
||||||
// current app icon view
|
|
||||||
fCurrentAppIconView = new(nothrow) CurrentAppIconView;
|
|
||||||
if (!fCurrentAppIconView)
|
|
||||||
return B_NO_MEMORY;
|
|
||||||
rootView->AddChild(fCurrentAppIconView);
|
|
||||||
|
|
||||||
// text view
|
// text view
|
||||||
fTextView = new(nothrow) BTextView(BRect(0, 0, 10, 10), "text",
|
fTextView = new(nothrow) BTextView(BRect(0, 0, 10, 10), "text",
|
||||||
@@ -266,14 +260,14 @@ public:
|
|||||||
fTextView->MakeEditable(false);
|
fTextView->MakeEditable(false);
|
||||||
fTextView->MakeSelectable(false);
|
fTextView->MakeSelectable(false);
|
||||||
fTextView->SetWordWrap(true);
|
fTextView->SetWordWrap(true);
|
||||||
rootView->AddChild(fTextView);
|
fRootView->AddChild(fTextView);
|
||||||
|
|
||||||
// kill app button
|
// kill app button
|
||||||
fKillAppButton = new(nothrow) BButton(BRect(0, 0, 10, 10), "kill app",
|
fKillAppButton = new(nothrow) BButton(BRect(0, 0, 10, 10), "kill app",
|
||||||
"Kill Application", NULL, B_FOLLOW_NONE);
|
"Kill Application", NULL, B_FOLLOW_NONE);
|
||||||
if (!fKillAppButton)
|
if (!fKillAppButton)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
rootView->AddChild(fKillAppButton);
|
fRootView->AddChild(fKillAppButton);
|
||||||
|
|
||||||
BMessage *message = new BMessage(MSG_KILL_APPLICATION);
|
BMessage *message = new BMessage(MSG_KILL_APPLICATION);
|
||||||
if (!message)
|
if (!message)
|
||||||
@@ -288,7 +282,7 @@ public:
|
|||||||
"cancel shutdown", "Cancel Shutdown", NULL, B_FOLLOW_NONE);
|
"cancel shutdown", "Cancel Shutdown", NULL, B_FOLLOW_NONE);
|
||||||
if (!fCancelShutdownButton)
|
if (!fCancelShutdownButton)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
rootView->AddChild(fCancelShutdownButton);
|
fRootView->AddChild(fCancelShutdownButton);
|
||||||
|
|
||||||
message = new BMessage(MSG_CANCEL_SHUTDOWN);
|
message = new BMessage(MSG_CANCEL_SHUTDOWN);
|
||||||
if (!message)
|
if (!message)
|
||||||
@@ -302,7 +296,7 @@ public:
|
|||||||
if (!fRebootSystemButton)
|
if (!fRebootSystemButton)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
fRebootSystemButton->Hide();
|
fRebootSystemButton->Hide();
|
||||||
rootView->AddChild(fRebootSystemButton);
|
fRootView->AddChild(fRebootSystemButton);
|
||||||
|
|
||||||
message = new BMessage(MSG_REBOOT_SYSTEM);
|
message = new BMessage(MSG_REBOOT_SYSTEM);
|
||||||
if (!message)
|
if (!message)
|
||||||
@@ -316,7 +310,7 @@ public:
|
|||||||
if (!fAbortedOKButton)
|
if (!fAbortedOKButton)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
fAbortedOKButton->Hide();
|
fAbortedOKButton->Hide();
|
||||||
rootView->AddChild(fAbortedOKButton);
|
fRootView->AddChild(fAbortedOKButton);
|
||||||
|
|
||||||
message = new BMessage(MSG_CANCEL_SHUTDOWN);
|
message = new BMessage(MSG_CANCEL_SHUTDOWN);
|
||||||
if (!message)
|
if (!message)
|
||||||
@@ -353,14 +347,8 @@ public:
|
|||||||
fTextView->SetText("two\nlines");
|
fTextView->SetText("two\nlines");
|
||||||
int textHeight = (int)fTextView->TextHeight(0, 1) + 1;
|
int textHeight = (int)fTextView->TextHeight(0, 1) + 1;
|
||||||
|
|
||||||
// current app icon view
|
int rightPartX = fRootView->Frame().IntegerWidth()
|
||||||
int currentAppIconWidth = fCurrentAppIconView->Frame().IntegerWidth()
|
|
||||||
+ 1;
|
+ 1;
|
||||||
int currentAppIconHeight = fCurrentAppIconView->Frame().IntegerHeight()
|
|
||||||
+ 1;
|
|
||||||
|
|
||||||
int currentAppIconX = kHSpacing;
|
|
||||||
int rightPartX = currentAppIconX + currentAppIconWidth;
|
|
||||||
int textX = rightPartX + kInnerHSpacing;
|
int textX = rightPartX + kInnerHSpacing;
|
||||||
int textY = kVSpacing;
|
int textY = kVSpacing;
|
||||||
int buttonsY = textY + textHeight + kInnerVSpacing;
|
int buttonsY = textY + textHeight + kInnerVSpacing;
|
||||||
@@ -372,10 +360,6 @@ public:
|
|||||||
|
|
||||||
// now layout the views
|
// now layout the views
|
||||||
|
|
||||||
// current app icon view
|
|
||||||
fCurrentAppIconView->MoveTo(currentAppIconX,
|
|
||||||
textY + (textHeight - currentAppIconHeight) / 2);
|
|
||||||
|
|
||||||
// text view
|
// text view
|
||||||
fTextView->MoveTo(textX, textY);
|
fTextView->MoveTo(textX, textY);
|
||||||
fTextView->ResizeTo(rightPartWidth + rightPartX - textX - 1,
|
fTextView->ResizeTo(rightPartWidth + rightPartX - textX - 1,
|
||||||
@@ -400,7 +384,7 @@ public:
|
|||||||
buttonsY);
|
buttonsY);
|
||||||
|
|
||||||
// set the root view and window size
|
// set the root view and window size
|
||||||
rootView->ResizeTo(width - 1, height - 1);
|
fRootView->ResizeTo(width - 1, height - 1);
|
||||||
ResizeTo(width - 1, height - 1);
|
ResizeTo(width - 1, height - 1);
|
||||||
|
|
||||||
// move the window to the same position as BAlerts
|
// move the window to the same position as BAlerts
|
||||||
@@ -452,7 +436,7 @@ public:
|
|||||||
AppInfo *info = (team >= 0 ? _AppInfoFor(team) : NULL);
|
AppInfo *info = (team >= 0 ? _AppInfoFor(team) : NULL);
|
||||||
|
|
||||||
fCurrentApp = team;
|
fCurrentApp = team;
|
||||||
fCurrentAppIconView->SetAppInfo(info);
|
fRootView->SetAppInfo(info);
|
||||||
|
|
||||||
fKillAppMessage->ReplaceInt32("team", team);
|
fKillAppMessage->ReplaceInt32("team", team);
|
||||||
}
|
}
|
||||||
@@ -481,7 +465,6 @@ public:
|
|||||||
|
|
||||||
void SetWaitForShutdown()
|
void SetWaitForShutdown()
|
||||||
{
|
{
|
||||||
fCurrentAppIconView->Hide();
|
|
||||||
fKillAppButton->Hide();
|
fKillAppButton->Hide();
|
||||||
fCancelShutdownButton->Hide();
|
fCancelShutdownButton->Hide();
|
||||||
fRebootSystemButton->MakeDefault(true);
|
fRebootSystemButton->MakeDefault(true);
|
||||||
@@ -493,7 +476,6 @@ public:
|
|||||||
|
|
||||||
void SetWaitForAbortedOK()
|
void SetWaitForAbortedOK()
|
||||||
{
|
{
|
||||||
fCurrentAppIconView->Hide();
|
|
||||||
fKillAppButton->Hide();
|
fKillAppButton->Hide();
|
||||||
fCancelShutdownButton->Hide();
|
fCancelShutdownButton->Hide();
|
||||||
fAbortedOKButton->MakeDefault(true);
|
fAbortedOKButton->MakeDefault(true);
|
||||||
@@ -536,22 +518,20 @@ private:
|
|||||||
return (index >= 0 ? (AppInfo*)fAppInfos.ItemAt(index) : NULL);
|
return (index >= 0 ? (AppInfo*)fAppInfos.ItemAt(index) : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
class CurrentAppIconView : public BView {
|
class TAlertView : public BView {
|
||||||
public:
|
public:
|
||||||
CurrentAppIconView()
|
TAlertView(BRect frame, const char *name, uint32 resizeMask, uint32 flags)
|
||||||
: BView(BRect(0, 0, 31, 31), "current app icon", B_FOLLOW_NONE,
|
: BView(frame, name, resizeMask, flags | B_WILL_DRAW),
|
||||||
B_WILL_DRAW),
|
|
||||||
fAppInfo(NULL)
|
fAppInfo(NULL)
|
||||||
{
|
{
|
||||||
SetViewColor(B_TRANSPARENT_32_BIT);
|
|
||||||
fBackground = ui_color(B_PANEL_BACKGROUND_COLOR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Draw(BRect updateRect)
|
virtual void Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
SetDrawingMode(B_OP_COPY);
|
BRect stripeRect = Bounds();
|
||||||
SetLowColor(fBackground);
|
stripeRect.right = 30;
|
||||||
FillRect(Bounds(), B_SOLID_LOW);
|
SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT));
|
||||||
|
FillRect(stripeRect);
|
||||||
|
|
||||||
if (fAppInfo && fAppInfo->largeIcon) {
|
if (fAppInfo && fAppInfo->largeIcon) {
|
||||||
if (fAppInfo->largeIcon->ColorSpace() == B_RGBA32) {
|
if (fAppInfo->largeIcon->ColorSpace() == B_RGBA32) {
|
||||||
@@ -560,7 +540,7 @@ private:
|
|||||||
} else
|
} else
|
||||||
SetDrawingMode(B_OP_OVER);
|
SetDrawingMode(B_OP_OVER);
|
||||||
|
|
||||||
DrawBitmap(fAppInfo->largeIcon, BPoint(0, 0));
|
DrawBitmapAsync(fAppInfo->largeIcon, BPoint(18, 6));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -572,12 +552,11 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const AppInfo *fAppInfo;
|
const AppInfo *fAppInfo;
|
||||||
rgb_color fBackground;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BList fAppInfos;
|
BList fAppInfos;
|
||||||
CurrentAppIconView *fCurrentAppIconView;
|
TAlertView *fRootView;
|
||||||
BTextView *fTextView;
|
BTextView *fTextView;
|
||||||
BButton *fKillAppButton;
|
BButton *fKillAppButton;
|
||||||
BButton *fCancelShutdownButton;
|
BButton *fCancelShutdownButton;
|
||||||
|
|||||||
Reference in New Issue
Block a user