* After stippi's request, I was urged to update the decorators as well.
* Applied a minor style update to them. There are many many more violations in there, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35274 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2006, Haiku.
|
||||
* Copyright 2001-2010, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -523,13 +523,13 @@ BeDecorator::Clicked(BPoint pt, int32 buttons, int32 modifiers)
|
||||
// the user might be clicking on and gradually work our way out into larger
|
||||
// rectangles.
|
||||
if (!(fFlags & B_NOT_CLOSABLE) && fCloseRect.Contains(pt))
|
||||
return DEC_CLOSE;
|
||||
return CLICK_CLOSE;
|
||||
|
||||
if (!(fFlags & B_NOT_ZOOMABLE) && fZoomRect.Contains(pt))
|
||||
return DEC_ZOOM;
|
||||
return CLICK_ZOOM;
|
||||
|
||||
if (fLook == B_DOCUMENT_WINDOW_LOOK && fResizeRect.Contains(pt))
|
||||
return DEC_RESIZE;
|
||||
return CLICK_RESIZE;
|
||||
|
||||
bool clicked = false;
|
||||
|
||||
@@ -538,7 +538,7 @@ BeDecorator::Clicked(BPoint pt, int32 buttons, int32 modifiers)
|
||||
// tab sliding in any case if either shift key is held down
|
||||
// except sliding up-down by moving mouse left-right would look strange
|
||||
if ((modifiers & B_SHIFT_KEY) && (fLook != kLeftTitledWindowLook))
|
||||
return DEC_SLIDETAB;
|
||||
return CLICK_SLIDE_TAB;
|
||||
|
||||
clicked = true;
|
||||
} else if (fLeftBorder.Contains(pt) || fRightBorder.Contains(pt)
|
||||
@@ -554,7 +554,7 @@ BeDecorator::Clicked(BPoint pt, int32 buttons, int32 modifiers)
|
||||
BRect temp(BPoint(fBottomBorder.right - 18, fBottomBorder.bottom - 18),
|
||||
fBottomBorder.RightBottom());
|
||||
if (temp.Contains(pt))
|
||||
return DEC_RESIZE;
|
||||
return CLICK_RESIZE;
|
||||
}
|
||||
|
||||
clicked = true;
|
||||
@@ -565,16 +565,16 @@ BeDecorator::Clicked(BPoint pt, int32 buttons, int32 modifiers)
|
||||
// resize area with the second mouse button. So we check this after
|
||||
// the check above
|
||||
if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0)
|
||||
return DEC_MOVETOBACK;
|
||||
return CLICK_MOVE_TO_BACK;
|
||||
|
||||
if (fWasDoubleClick && !(fFlags & B_NOT_MINIMIZABLE))
|
||||
return DEC_MINIMIZE;
|
||||
return CLICK_MINIMIZE;
|
||||
|
||||
return DEC_DRAG;
|
||||
return CLICK_DRAG;
|
||||
}
|
||||
|
||||
// Guess user didn't click anything
|
||||
return DEC_NONE;
|
||||
return CLICK_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
Copyright 2009, Haiku.
|
||||
Distributed under the terms of the MIT License.
|
||||
* Copyright 2009-2010, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
/*! Decorator looking like Mac OS 9 */
|
||||
|
||||
|
||||
@@ -29,7 +30,8 @@
|
||||
|
||||
MacDecorator::MacDecorator(DesktopSettings& settings, BRect rect,
|
||||
window_look look, uint32 flags)
|
||||
: Decorator(settings, rect, look, flags)
|
||||
:
|
||||
Decorator(settings, rect, look, flags)
|
||||
{
|
||||
frame_highcol = (rgb_color){ 255, 255, 255, 255 };
|
||||
frame_midcol = (rgb_color){ 216, 216, 216, 255 };
|
||||
@@ -184,9 +186,6 @@ MacDecorator::ResizeBy(BPoint offset, BRegion* dirty)
|
||||
_DoLayout();
|
||||
}
|
||||
|
||||
// settablocation
|
||||
// setsettings
|
||||
// getsettings
|
||||
|
||||
void
|
||||
MacDecorator::Draw(BRect update)
|
||||
@@ -211,8 +210,6 @@ MacDecorator::Draw()
|
||||
}
|
||||
|
||||
|
||||
// getsizelimits
|
||||
|
||||
void
|
||||
MacDecorator::GetFootprint(BRegion* region)
|
||||
{
|
||||
@@ -243,22 +240,22 @@ MacDecorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
|
||||
{
|
||||
if (!(fFlags & B_NOT_CLOSABLE) && fCloseRect.Contains(point)) {
|
||||
STRACE(("MacDecorator():Clicked() - Close\n"));
|
||||
return DEC_CLOSE;
|
||||
return CLICK_CLOSE;
|
||||
}
|
||||
|
||||
if (!(fFlags & B_NOT_ZOOMABLE) && fZoomRect.Contains(point)) {
|
||||
STRACE(("MacDecorator():Clicked() - Zoom\n"));
|
||||
return DEC_ZOOM;
|
||||
return CLICK_ZOOM;
|
||||
}
|
||||
|
||||
// Clicking in the tab?
|
||||
if (fTabRect.Contains(point)) {
|
||||
// Here's part of our window management stuff
|
||||
/* TODO This is missing DEC_MOVETOFRONT
|
||||
/* TODO This is missing CLICK_MOVETOFRONT
|
||||
if(buttons==B_PRIMARY_MOUSE_BUTTON && !IsFocus())
|
||||
return DEC_MOVETOFRONT;
|
||||
return CLICK_MOVETOFRONT;
|
||||
*/
|
||||
return DEC_DRAG;
|
||||
return CLICK_DRAG;
|
||||
}
|
||||
|
||||
// We got this far, so user is clicking on the border?
|
||||
@@ -268,12 +265,12 @@ MacDecorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
|
||||
|| fLook == B_MODAL_WINDOW_LOOK)
|
||||
&& fBorderRect.Contains(point) && !fFrame.Contains(point)) {
|
||||
STRACE(("MacDecorator():Clicked() - Resize\n"));
|
||||
return DEC_RESIZE;
|
||||
return CLICK_RESIZE;
|
||||
}
|
||||
|
||||
// Guess user didn't click anything
|
||||
STRACE(("MacDecorator():Clicked()\n"));
|
||||
return DEC_NONE;
|
||||
return CLICK_NONE;
|
||||
}
|
||||
|
||||
|
||||
@@ -526,9 +523,7 @@ MacDecorator::_DrawTab(BRect invalid)
|
||||
fDrawingEngine->SetHighColor(RGBColor(frame_midcol));
|
||||
fDrawingEngine->FillRect(rect,frame_midcol);
|
||||
|
||||
|
||||
if(IsFocus())
|
||||
{
|
||||
if (IsFocus()) {
|
||||
fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightTop(),frame_lowercol);
|
||||
fDrawingEngine->StrokeLine(rect.LeftTop(),rect.LeftBottom(),frame_lowercol);
|
||||
fDrawingEngine->StrokeLine(rect.RightBottom(),rect.RightTop(),frame_lowercol);
|
||||
@@ -541,15 +536,13 @@ MacDecorator::_DrawTab(BRect invalid)
|
||||
fDrawingEngine->StrokeLine(rect.RightBottom(),rect.RightTop(),frame_lowcol);
|
||||
|
||||
// Draw the neat little lines on either side of the title if there's room
|
||||
if((fTabRect.left+textoffset)>(fCloseRect.right+5))
|
||||
{
|
||||
if (fTabRect.left + textoffset > fCloseRect.right + 5) {
|
||||
// Left side
|
||||
|
||||
BPoint offset(fCloseRect.right+5,fCloseRect.top),
|
||||
pt2(fTabRect.left+textoffset-5,fCloseRect.top);
|
||||
fDrawState.SetHighColor(RGBColor(frame_highcol));
|
||||
for(int32 i=0;i<6;i++)
|
||||
{
|
||||
for (int32 i = 0; i < 6; i++) {
|
||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
||||
offset.y+=2;
|
||||
pt2.y+=2;
|
||||
@@ -558,8 +551,7 @@ MacDecorator::_DrawTab(BRect invalid)
|
||||
offset.Set(fCloseRect.right+6,fCloseRect.top+1),
|
||||
pt2.Set(fTabRect.left+textoffset-4,fCloseRect.top+1);
|
||||
fDrawState.SetHighColor(RGBColor(frame_lowcol));
|
||||
for(int32 i=0;i<6;i++)
|
||||
{
|
||||
for (int32 i = 0; i < 6; i++) {
|
||||
fDrawingEngine->StrokeLine(offset, pt2, fDrawState.HighColor());
|
||||
offset.y += 2;
|
||||
pt2.y += 2;
|
||||
@@ -567,30 +559,29 @@ MacDecorator::_DrawTab(BRect invalid)
|
||||
|
||||
// Right side
|
||||
|
||||
offset.Set(fTabRect.left+textoffset+titlepixelwidth+6,fZoomRect.top),
|
||||
pt2.Set(fZoomRect.left-6,fZoomRect.top);
|
||||
if(offset.x<pt2.x)
|
||||
{
|
||||
offset.Set(fTabRect.left + textoffset + titlepixelwidth + 6,
|
||||
fZoomRect.top), pt2.Set(fZoomRect.left - 6, fZoomRect.top);
|
||||
if (offset.x < pt2.x) {
|
||||
fDrawState.SetHighColor(RGBColor(frame_highcol));
|
||||
for(int32 i=0;i<6;i++)
|
||||
{
|
||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
||||
for (int32 i = 0; i < 6; i++) {
|
||||
fDrawingEngine->StrokeLine(offset, pt2,
|
||||
fDrawState.HighColor());
|
||||
offset.y += 2;
|
||||
pt2.y += 2;
|
||||
}
|
||||
offset.Set(fTabRect.left+textoffset+titlepixelwidth+7,fZoomRect.top+1),
|
||||
pt2.Set(fZoomRect.left-5,fZoomRect.top+1);
|
||||
offset.Set(fTabRect.left+textoffset + titlepixelwidth + 7,
|
||||
fZoomRect.top + 1), pt2.Set(fZoomRect.left - 5,
|
||||
fZoomRect.top + 1);
|
||||
fDrawState.SetHighColor(frame_lowcol);
|
||||
for(int32 i=0;i<6;i++)
|
||||
{
|
||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
||||
for(int32 i = 0; i < 6; i++) {
|
||||
fDrawingEngine->StrokeLine(offset, pt2,
|
||||
fDrawState.HighColor());
|
||||
offset.y += 2;
|
||||
pt2.y += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Draw the buttons if we're supposed to
|
||||
if (!(fFlags & B_NOT_CLOSABLE))
|
||||
_DrawClose(fCloseRect);
|
||||
@@ -671,7 +662,8 @@ MacDecorator::_DrawTitle(BRect rect)
|
||||
}
|
||||
|
||||
|
||||
void MacDecorator::_DrawZoom(BRect r)
|
||||
void
|
||||
MacDecorator::_DrawZoom(BRect r)
|
||||
{
|
||||
bool down = GetClose();
|
||||
|
||||
@@ -712,7 +704,8 @@ void MacDecorator::_DrawZoom(BRect r)
|
||||
rect.right++;
|
||||
|
||||
fDrawState.SetHighColor(RGBColor(0, 0, 0));
|
||||
fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightTop(),fDrawState.HighColor());
|
||||
fDrawingEngine->StrokeLine(rect.LeftTop(), rect.RightTop(),
|
||||
fDrawState.HighColor());
|
||||
}
|
||||
|
||||
|
||||
@@ -812,14 +805,19 @@ MacDecorator::_DrawBlendedRect(DrawingEngine* engine, BRect rect,
|
||||
}
|
||||
|
||||
|
||||
extern "C" float get_decorator_version(void)
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
extern "C" float
|
||||
get_decorator_version(void)
|
||||
{
|
||||
return 1.00;
|
||||
}
|
||||
|
||||
|
||||
extern "C" Decorator *(instantiate_decorator)(DesktopSettings &desktopSetting, BRect rec,
|
||||
window_look loo, uint32 flag)
|
||||
extern "C" Decorator*
|
||||
instantiate_decorator(DesktopSettings& desktopSetting, BRect rect,
|
||||
window_look look, uint32 flag)
|
||||
{
|
||||
return new MacDecorator(desktopSetting, rec, loo, flag);
|
||||
return new MacDecorator(desktopSetting, rect, look, flag);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
Copyright 2009, Haiku.
|
||||
Distributed under the terms of the MIT License.
|
||||
* Copyright 2009-2010, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
/*! Decorator looking like Windows 95 */
|
||||
|
||||
|
||||
@@ -28,7 +29,8 @@
|
||||
|
||||
WinDecorator::WinDecorator(DesktopSettings& settings, BRect rect,
|
||||
window_look look, uint32 flags)
|
||||
: Decorator(settings, rect, look, flags)
|
||||
:
|
||||
Decorator(settings, rect, look, flags)
|
||||
{
|
||||
taboffset=0;
|
||||
|
||||
@@ -100,15 +102,6 @@ WinDecorator::FontsChanged(DesktopSettings& settings, BRegion* updateRegion)
|
||||
}
|
||||
|
||||
|
||||
// SetLook
|
||||
|
||||
|
||||
// SetFlags
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
WinDecorator::MoveBy(BPoint pt)
|
||||
{
|
||||
@@ -170,34 +163,33 @@ WinDecorator::Clicked(BPoint pt, int32 buttons, int32 modifiers)
|
||||
{
|
||||
if (fCloseRect.Contains(pt)) {
|
||||
STRACE(("WinDecorator():Clicked() - Close\n"));
|
||||
return DEC_CLOSE;
|
||||
return CLICK_CLOSE;
|
||||
}
|
||||
|
||||
if (fZoomRect.Contains(pt)) {
|
||||
STRACE(("WinDecorator():Clicked() - Zoom\n"));
|
||||
return DEC_ZOOM;
|
||||
return CLICK_ZOOM;
|
||||
}
|
||||
|
||||
// Clicking in the tab?
|
||||
if (fTabRect.Contains(pt)) {
|
||||
// Here's part of our window management stuff
|
||||
/* TODO This is missing DEC_MOVETOFRONT
|
||||
/* TODO This is missing CLICK_MOVETOFRONT
|
||||
if(buttons==B_PRIMARY_MOUSE_BUTTON && !IsFocus())
|
||||
return DEC_MOVETOFRONT;
|
||||
return CLICK_MOVETOFRONT;
|
||||
*/
|
||||
return DEC_DRAG;
|
||||
return CLICK_DRAG;
|
||||
}
|
||||
|
||||
// We got this far, so user is clicking on the border?
|
||||
if(fBorderRect.Contains(pt) && !fFrame.Contains(pt))
|
||||
{
|
||||
if (fBorderRect.Contains(pt) && !fFrame.Contains(pt)) {
|
||||
STRACE(("WinDecorator():Clicked() - Resize\n"));
|
||||
return DEC_RESIZE;
|
||||
return CLICK_RESIZE;
|
||||
}
|
||||
|
||||
// Guess user didn't click anything
|
||||
STRACE(("WinDecorator():Clicked()\n"));
|
||||
return DEC_NONE;
|
||||
return CLICK_NONE;
|
||||
}
|
||||
|
||||
|
||||
@@ -362,7 +354,9 @@ WinDecorator::_DrawClose(BRect r)
|
||||
fDrawingEngine->StrokeLine(rect.RightTop(),rect.LeftBottom());
|
||||
}
|
||||
|
||||
void WinDecorator::_DrawMinimize(BRect r)
|
||||
|
||||
void
|
||||
WinDecorator::_DrawMinimize(BRect r)
|
||||
{
|
||||
// Just like DrawZoom, but for a Minimize button
|
||||
DrawBeveledRect(r,GetMinimize());
|
||||
@@ -401,18 +395,19 @@ WinDecorator::_DrawTab(BRect r)
|
||||
void
|
||||
WinDecorator::DrawBeveledRect(BRect r, bool down)
|
||||
{
|
||||
RGBColor higher,high,mid,low,lower;
|
||||
RGBColor higher;
|
||||
RGBColor high;
|
||||
RGBColor mid;
|
||||
RGBColor low;
|
||||
RGBColor lower;
|
||||
|
||||
if(down)
|
||||
{
|
||||
if (down) {
|
||||
lower.SetColor(255,255,255);
|
||||
low.SetColor(216,216,216);
|
||||
mid.SetColor(192,192,192);
|
||||
high.SetColor(128,128,128);
|
||||
higher.SetColor(0,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
higher.SetColor(255,255,255);
|
||||
high.SetColor(216,216,216);
|
||||
mid.SetColor(192,192,192);
|
||||
@@ -475,9 +470,9 @@ void
|
||||
WinDecorator::_UpdateFont(DesktopSettings& settings)
|
||||
{
|
||||
ServerFont font;
|
||||
if (fLook == B_FLOATING_WINDOW_LOOK) {
|
||||
if (fLook == B_FLOATING_WINDOW_LOOK)
|
||||
settings.GetDefaultPlainFont(font);
|
||||
} else
|
||||
else
|
||||
settings.GetDefaultBoldFont(font);
|
||||
|
||||
font.SetFlags(B_FORCE_ANTIALIASING);
|
||||
@@ -533,13 +528,15 @@ WinDecorator::_DrawFrame(BRect rect)
|
||||
}
|
||||
|
||||
|
||||
extern "C" float get_decorator_version(void)
|
||||
extern "C" float
|
||||
get_decorator_version(void)
|
||||
{
|
||||
return 1.00;
|
||||
}
|
||||
|
||||
|
||||
extern "C" Decorator *instantiate_decorator(DesktopSettings &desktopSetting, BRect rect,
|
||||
extern "C" Decorator *
|
||||
instantiate_decorator(DesktopSettings &desktopSetting, BRect rect,
|
||||
window_look wlook, int32 wflags)
|
||||
{
|
||||
return new WinDecorator(desktopSetting, rect, wlook, wflags);
|
||||
|
||||
Reference in New Issue
Block a user