Fixed some of the simpler font sensitivity problems. Looks much better on the real thing now.
Also no longer states that Haiku components would be part of "the BeOS" :-) Cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13143 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||||
//
|
//
|
||||||
// Copyright (c) 2004, Haiku
|
// Copyright (c) 2004-2005, Haiku
|
||||||
//
|
//
|
||||||
// This software is part of the Haiku distribution and is covered
|
// This software is part of the Haiku distribution and is covered
|
||||||
// by the Haiku license.
|
// by the MIT license.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// File: TMWindow.cpp
|
// File: TMWindow.cpp
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
//
|
//
|
||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||||
|
|
||||||
|
|
||||||
#include "TMWindow.h"
|
#include "TMWindow.h"
|
||||||
#include "TMListItem.h"
|
#include "TMListItem.h"
|
||||||
#include "KeyboardInputDevice.h"
|
#include "KeyboardInputDevice.h"
|
||||||
@@ -20,6 +21,7 @@
|
|||||||
#include <ScrollView.h>
|
#include <ScrollView.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
|
|
||||||
|
|
||||||
const uint32 TM_CANCEL = 'TMca';
|
const uint32 TM_CANCEL = 'TMca';
|
||||||
const uint32 TM_FORCE_REBOOT = 'TMfr';
|
const uint32 TM_FORCE_REBOOT = 'TMfr';
|
||||||
const uint32 TM_KILL_APPLICATION = 'TMka';
|
const uint32 TM_KILL_APPLICATION = 'TMka';
|
||||||
@@ -32,6 +34,7 @@ extern "C" void _kshutdown_(bool reboot);
|
|||||||
# define _kshutdown_(x) _kern_shutdown(x)
|
# define _kshutdown_(x) _kern_shutdown(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
TMWindow::TMWindow()
|
TMWindow::TMWindow()
|
||||||
: BWindow(BRect(0,0,350,300), "Team Monitor",
|
: BWindow(BRect(0,0,350,300), "Team Monitor",
|
||||||
B_TITLED_WINDOW_LOOK, B_MODAL_ALL_WINDOW_FEEL,
|
B_TITLED_WINDOW_LOOK, B_MODAL_ALL_WINDOW_FEEL,
|
||||||
@@ -41,7 +44,10 @@ TMWindow::TMWindow()
|
|||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
|
|
||||||
|
// ToDo: make this font sensitive
|
||||||
|
|
||||||
BRect rect = Bounds();
|
BRect rect = Bounds();
|
||||||
|
BFont font = be_plain_font;
|
||||||
|
|
||||||
fBackground = new TMBox(rect, "background", B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
fBackground = new TMBox(rect, "background", B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||||
B_WILL_DRAW, B_NO_BORDER);
|
B_WILL_DRAW, B_NO_BORDER);
|
||||||
@@ -49,7 +55,7 @@ TMWindow::TMWindow()
|
|||||||
|
|
||||||
rect = Bounds();
|
rect = Bounds();
|
||||||
rect.right -= 10;
|
rect.right -= 10;
|
||||||
rect.left = rect.right - 75;
|
rect.left = rect.right - font.StringWidth("Cancel") - 20;
|
||||||
rect.bottom -= 14;
|
rect.bottom -= 14;
|
||||||
rect.top = rect.bottom - 20;
|
rect.top = rect.bottom - 20;
|
||||||
|
|
||||||
@@ -59,7 +65,7 @@ TMWindow::TMWindow()
|
|||||||
SetDefaultButton(cancel);
|
SetDefaultButton(cancel);
|
||||||
|
|
||||||
rect.left = 10;
|
rect.left = 10;
|
||||||
rect.right = rect.left + 83;
|
rect.right = rect.left + font.StringWidth("Force Reboot") + 20;
|
||||||
|
|
||||||
BButton *forceReboot = new BButton(rect, "force", "Force Reboot",
|
BButton *forceReboot = new BButton(rect, "force", "Force Reboot",
|
||||||
new BMessage(TM_FORCE_REBOOT), B_FOLLOW_LEFT|B_FOLLOW_BOTTOM);
|
new BMessage(TM_FORCE_REBOOT), B_FOLLOW_LEFT|B_FOLLOW_BOTTOM);
|
||||||
@@ -67,7 +73,7 @@ TMWindow::TMWindow()
|
|||||||
|
|
||||||
rect.top -= 97;
|
rect.top -= 97;
|
||||||
rect.bottom = rect.top + 20;
|
rect.bottom = rect.top + 20;
|
||||||
rect.right += 1;
|
rect.right = rect.left + font.StringWidth("Kill Application") + 20;
|
||||||
|
|
||||||
fKillApp = new BButton(rect, "kill", "Kill Application",
|
fKillApp = new BButton(rect, "kill", "Kill Application",
|
||||||
new BMessage(TM_KILL_APPLICATION), B_FOLLOW_LEFT|B_FOLLOW_BOTTOM);
|
new BMessage(TM_KILL_APPLICATION), B_FOLLOW_LEFT|B_FOLLOW_BOTTOM);
|
||||||
@@ -81,12 +87,12 @@ TMWindow::TMWindow()
|
|||||||
fBackground->AddChild(fDescView);
|
fBackground->AddChild(fDescView);
|
||||||
|
|
||||||
BRect screenFrame = (BScreen(B_MAIN_SCREEN_ID).Frame());
|
BRect screenFrame = (BScreen(B_MAIN_SCREEN_ID).Frame());
|
||||||
BPoint pt;
|
BPoint point;
|
||||||
pt.x = screenFrame.Width()/2 - Bounds().Width()/2;
|
point.x = (screenFrame.Width() - Bounds().Width()) / 2;
|
||||||
pt.y = screenFrame.Height()/2 - Bounds().Height()/2;
|
point.y = (screenFrame.Height() - Bounds().Height()) / 2;
|
||||||
|
|
||||||
if (screenFrame.Contains(pt))
|
if (screenFrame.Contains(point))
|
||||||
MoveTo(pt);
|
MoveTo(point);
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
@@ -94,16 +100,13 @@ TMWindow::TMWindow()
|
|||||||
|
|
||||||
TMWindow::~TMWindow()
|
TMWindow::~TMWindow()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TMWindow::MessageReceived(BMessage *msg)
|
TMWindow::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
switch(msg->what)
|
switch (msg->what) {
|
||||||
{
|
|
||||||
case TM_FORCE_REBOOT:
|
case TM_FORCE_REBOOT:
|
||||||
_kshutdown_(true);
|
_kshutdown_(true);
|
||||||
break;
|
break;
|
||||||
@@ -163,11 +166,13 @@ TMWindow::Disable()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
TMBox::TMBox(BRect bounds, const char* name, uint32 resizeFlags,
|
TMBox::TMBox(BRect bounds, const char* name, uint32 resizeFlags,
|
||||||
uint32 flags, border_style border)
|
uint32 flags, border_style border)
|
||||||
: BBox(bounds, name, resizeFlags, flags | B_PULSE_NEEDED, border)
|
: BBox(bounds, name, resizeFlags, flags | B_PULSE_NEEDED, border)
|
||||||
{
|
{
|
||||||
|
|
||||||
BRect rect = Bounds();
|
BRect rect = Bounds();
|
||||||
rect.InsetBy(12, 11);
|
rect.InsetBy(12, 11);
|
||||||
rect.right -= B_V_SCROLL_BAR_WIDTH;
|
rect.right -= B_V_SCROLL_BAR_WIDTH;
|
||||||
@@ -181,7 +186,6 @@ TMBox::TMBox(BRect bounds, const char* name, uint32 resizeFlags,
|
|||||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP_BOTTOM, 0, false, true, B_FANCY_BORDER);
|
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP_BOTTOM, 0, false, true, B_FANCY_BORDER);
|
||||||
|
|
||||||
AddChild(sv);
|
AddChild(sv);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -227,12 +231,13 @@ TMBox::Pulse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
TMDescView::TMDescView(BRect rect)
|
TMDescView::TMDescView(BRect rect)
|
||||||
: BBox(rect, "descview", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW, B_NO_BORDER),
|
: BBox(rect, "descview", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW, B_NO_BORDER),
|
||||||
fItem(NULL)
|
fItem(NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -258,7 +263,7 @@ TMDescView::Draw(BRect rect)
|
|||||||
if (fItem->IsSystemServer()) {
|
if (fItem->IsSystemServer()) {
|
||||||
MovePenTo(frame.right+9, frame.top + 1 + ((frame.Height() - (finfo.ascent + finfo.descent + finfo.leading)) *3 / 4) +
|
MovePenTo(frame.right+9, frame.top + 1 + ((frame.Height() - (finfo.ascent + finfo.descent + finfo.leading)) *3 / 4) +
|
||||||
(finfo.ascent + finfo.descent) - 1);
|
(finfo.ascent + finfo.descent) - 1);
|
||||||
DrawString("(This team is a component of the BeOS");
|
DrawString("(This team is a system component");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BFont font = be_plain_font;
|
BFont font = be_plain_font;
|
||||||
@@ -268,16 +273,15 @@ TMDescView::Draw(BRect rect)
|
|||||||
BPoint point(rect.left+4, rect.top - 9 + ((rect.Height() - (finfo.ascent + finfo.descent + finfo.leading)) / 4) +
|
BPoint point(rect.left+4, rect.top - 9 + ((rect.Height() - (finfo.ascent + finfo.descent + finfo.leading)) / 4) +
|
||||||
(finfo.ascent + finfo.descent) - 1);
|
(finfo.ascent + finfo.descent) - 1);
|
||||||
MovePenTo(point);
|
MovePenTo(point);
|
||||||
DrawString("Select an application from the list above and click the \"Kill\" button in");
|
DrawString("Select an application from the list above and click the");
|
||||||
|
|
||||||
point.y += 13;
|
point.y += 13;
|
||||||
MovePenTo(point);
|
MovePenTo(point);
|
||||||
DrawString("order to close it.");
|
DrawString("\"Kill Application\" button in order to close it.");
|
||||||
|
|
||||||
point.y += 26;
|
point.y += 26;
|
||||||
MovePenTo(point);
|
MovePenTo(point);
|
||||||
DrawString("Hold CONTROL+ALT+DELETE for 4 seconds to reboot.");
|
DrawString("Hold CONTROL+ALT+DELETE for 4 seconds to reboot.");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user