* 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:
parent
3c50a64697
commit
2069f565e8
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2006, Haiku.
|
* Copyright 2001-2010, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* 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
|
// the user might be clicking on and gradually work our way out into larger
|
||||||
// rectangles.
|
// rectangles.
|
||||||
if (!(fFlags & B_NOT_CLOSABLE) && fCloseRect.Contains(pt))
|
if (!(fFlags & B_NOT_CLOSABLE) && fCloseRect.Contains(pt))
|
||||||
return DEC_CLOSE;
|
return CLICK_CLOSE;
|
||||||
|
|
||||||
if (!(fFlags & B_NOT_ZOOMABLE) && fZoomRect.Contains(pt))
|
if (!(fFlags & B_NOT_ZOOMABLE) && fZoomRect.Contains(pt))
|
||||||
return DEC_ZOOM;
|
return CLICK_ZOOM;
|
||||||
|
|
||||||
if (fLook == B_DOCUMENT_WINDOW_LOOK && fResizeRect.Contains(pt))
|
if (fLook == B_DOCUMENT_WINDOW_LOOK && fResizeRect.Contains(pt))
|
||||||
return DEC_RESIZE;
|
return CLICK_RESIZE;
|
||||||
|
|
||||||
bool clicked = false;
|
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
|
// tab sliding in any case if either shift key is held down
|
||||||
// except sliding up-down by moving mouse left-right would look strange
|
// except sliding up-down by moving mouse left-right would look strange
|
||||||
if ((modifiers & B_SHIFT_KEY) && (fLook != kLeftTitledWindowLook))
|
if ((modifiers & B_SHIFT_KEY) && (fLook != kLeftTitledWindowLook))
|
||||||
return DEC_SLIDETAB;
|
return CLICK_SLIDE_TAB;
|
||||||
|
|
||||||
clicked = true;
|
clicked = true;
|
||||||
} else if (fLeftBorder.Contains(pt) || fRightBorder.Contains(pt)
|
} 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),
|
BRect temp(BPoint(fBottomBorder.right - 18, fBottomBorder.bottom - 18),
|
||||||
fBottomBorder.RightBottom());
|
fBottomBorder.RightBottom());
|
||||||
if (temp.Contains(pt))
|
if (temp.Contains(pt))
|
||||||
return DEC_RESIZE;
|
return CLICK_RESIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
clicked = true;
|
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
|
// resize area with the second mouse button. So we check this after
|
||||||
// the check above
|
// the check above
|
||||||
if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0)
|
if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0)
|
||||||
return DEC_MOVETOBACK;
|
return CLICK_MOVE_TO_BACK;
|
||||||
|
|
||||||
if (fWasDoubleClick && !(fFlags & B_NOT_MINIMIZABLE))
|
if (fWasDoubleClick && !(fFlags & B_NOT_MINIMIZABLE))
|
||||||
return DEC_MINIMIZE;
|
return CLICK_MINIMIZE;
|
||||||
|
|
||||||
return DEC_DRAG;
|
return CLICK_DRAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Guess user didn't click anything
|
// Guess user didn't click anything
|
||||||
return DEC_NONE;
|
return CLICK_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2009, Haiku.
|
* Copyright 2009-2010, Haiku.
|
||||||
Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*! Decorator looking like Mac OS 9 */
|
/*! Decorator looking like Mac OS 9 */
|
||||||
|
|
||||||
@ -29,7 +30,8 @@
|
|||||||
|
|
||||||
MacDecorator::MacDecorator(DesktopSettings& settings, BRect rect,
|
MacDecorator::MacDecorator(DesktopSettings& settings, BRect rect,
|
||||||
window_look look, uint32 flags)
|
window_look look, uint32 flags)
|
||||||
: Decorator(settings, rect, look, flags)
|
:
|
||||||
|
Decorator(settings, rect, look, flags)
|
||||||
{
|
{
|
||||||
frame_highcol = (rgb_color){ 255, 255, 255, 255 };
|
frame_highcol = (rgb_color){ 255, 255, 255, 255 };
|
||||||
frame_midcol = (rgb_color){ 216, 216, 216, 255 };
|
frame_midcol = (rgb_color){ 216, 216, 216, 255 };
|
||||||
@ -184,9 +186,6 @@ MacDecorator::ResizeBy(BPoint offset, BRegion* dirty)
|
|||||||
_DoLayout();
|
_DoLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
// settablocation
|
|
||||||
// setsettings
|
|
||||||
// getsettings
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MacDecorator::Draw(BRect update)
|
MacDecorator::Draw(BRect update)
|
||||||
@ -211,8 +210,6 @@ MacDecorator::Draw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// getsizelimits
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MacDecorator::GetFootprint(BRegion* region)
|
MacDecorator::GetFootprint(BRegion* region)
|
||||||
{
|
{
|
||||||
@ -243,22 +240,22 @@ MacDecorator::Clicked(BPoint point, int32 buttons, int32 modifiers)
|
|||||||
{
|
{
|
||||||
if (!(fFlags & B_NOT_CLOSABLE) && fCloseRect.Contains(point)) {
|
if (!(fFlags & B_NOT_CLOSABLE) && fCloseRect.Contains(point)) {
|
||||||
STRACE(("MacDecorator():Clicked() - Close\n"));
|
STRACE(("MacDecorator():Clicked() - Close\n"));
|
||||||
return DEC_CLOSE;
|
return CLICK_CLOSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(fFlags & B_NOT_ZOOMABLE) && fZoomRect.Contains(point)) {
|
if (!(fFlags & B_NOT_ZOOMABLE) && fZoomRect.Contains(point)) {
|
||||||
STRACE(("MacDecorator():Clicked() - Zoom\n"));
|
STRACE(("MacDecorator():Clicked() - Zoom\n"));
|
||||||
return DEC_ZOOM;
|
return CLICK_ZOOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clicking in the tab?
|
// Clicking in the tab?
|
||||||
if (fTabRect.Contains(point)) {
|
if (fTabRect.Contains(point)) {
|
||||||
// Here's part of our window management stuff
|
// 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())
|
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?
|
// 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)
|
|| fLook == B_MODAL_WINDOW_LOOK)
|
||||||
&& fBorderRect.Contains(point) && !fFrame.Contains(point)) {
|
&& fBorderRect.Contains(point) && !fFrame.Contains(point)) {
|
||||||
STRACE(("MacDecorator():Clicked() - Resize\n"));
|
STRACE(("MacDecorator():Clicked() - Resize\n"));
|
||||||
return DEC_RESIZE;
|
return CLICK_RESIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Guess user didn't click anything
|
// Guess user didn't click anything
|
||||||
STRACE(("MacDecorator():Clicked()\n"));
|
STRACE(("MacDecorator():Clicked()\n"));
|
||||||
return DEC_NONE;
|
return CLICK_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -514,7 +511,7 @@ MacDecorator::_DrawFrame(BRect invalid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MacDecorator::_DrawTab(BRect invalid)
|
MacDecorator::_DrawTab(BRect invalid)
|
||||||
{
|
{
|
||||||
// If a window has a tab, this will draw it and any buttons which are
|
// If a window has a tab, this will draw it and any buttons which are
|
||||||
@ -526,9 +523,7 @@ MacDecorator::_DrawTab(BRect invalid)
|
|||||||
fDrawingEngine->SetHighColor(RGBColor(frame_midcol));
|
fDrawingEngine->SetHighColor(RGBColor(frame_midcol));
|
||||||
fDrawingEngine->FillRect(rect,frame_midcol);
|
fDrawingEngine->FillRect(rect,frame_midcol);
|
||||||
|
|
||||||
|
if (IsFocus()) {
|
||||||
if(IsFocus())
|
|
||||||
{
|
|
||||||
fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightTop(),frame_lowercol);
|
fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightTop(),frame_lowercol);
|
||||||
fDrawingEngine->StrokeLine(rect.LeftTop(),rect.LeftBottom(),frame_lowercol);
|
fDrawingEngine->StrokeLine(rect.LeftTop(),rect.LeftBottom(),frame_lowercol);
|
||||||
fDrawingEngine->StrokeLine(rect.RightBottom(),rect.RightTop(),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);
|
fDrawingEngine->StrokeLine(rect.RightBottom(),rect.RightTop(),frame_lowcol);
|
||||||
|
|
||||||
// Draw the neat little lines on either side of the title if there's room
|
// 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
|
// Left side
|
||||||
|
|
||||||
BPoint offset(fCloseRect.right+5,fCloseRect.top),
|
BPoint offset(fCloseRect.right+5,fCloseRect.top),
|
||||||
pt2(fTabRect.left+textoffset-5,fCloseRect.top);
|
pt2(fTabRect.left+textoffset-5,fCloseRect.top);
|
||||||
fDrawState.SetHighColor(RGBColor(frame_highcol));
|
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());
|
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
||||||
offset.y+=2;
|
offset.y+=2;
|
||||||
pt2.y+=2;
|
pt2.y+=2;
|
||||||
@ -558,43 +551,41 @@ MacDecorator::_DrawTab(BRect invalid)
|
|||||||
offset.Set(fCloseRect.right+6,fCloseRect.top+1),
|
offset.Set(fCloseRect.right+6,fCloseRect.top+1),
|
||||||
pt2.Set(fTabRect.left+textoffset-4,fCloseRect.top+1);
|
pt2.Set(fTabRect.left+textoffset-4,fCloseRect.top+1);
|
||||||
fDrawState.SetHighColor(RGBColor(frame_lowcol));
|
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());
|
||||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
offset.y += 2;
|
||||||
offset.y+=2;
|
pt2.y += 2;
|
||||||
pt2.y+=2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Right side
|
// Right side
|
||||||
|
|
||||||
offset.Set(fTabRect.left+textoffset+titlepixelwidth+6,fZoomRect.top),
|
offset.Set(fTabRect.left + textoffset + titlepixelwidth + 6,
|
||||||
pt2.Set(fZoomRect.left-6,fZoomRect.top);
|
fZoomRect.top), pt2.Set(fZoomRect.left - 6, fZoomRect.top);
|
||||||
if(offset.x<pt2.x)
|
if (offset.x < pt2.x) {
|
||||||
{
|
|
||||||
fDrawState.SetHighColor(RGBColor(frame_highcol));
|
fDrawState.SetHighColor(RGBColor(frame_highcol));
|
||||||
for(int32 i=0;i<6;i++)
|
for (int32 i = 0; i < 6; i++) {
|
||||||
{
|
fDrawingEngine->StrokeLine(offset, pt2,
|
||||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
fDrawState.HighColor());
|
||||||
offset.y+=2;
|
offset.y += 2;
|
||||||
pt2.y+=2;
|
pt2.y += 2;
|
||||||
}
|
}
|
||||||
offset.Set(fTabRect.left+textoffset+titlepixelwidth+7,fZoomRect.top+1),
|
offset.Set(fTabRect.left+textoffset + titlepixelwidth + 7,
|
||||||
pt2.Set(fZoomRect.left-5,fZoomRect.top+1);
|
fZoomRect.top + 1), pt2.Set(fZoomRect.left - 5,
|
||||||
|
fZoomRect.top + 1);
|
||||||
fDrawState.SetHighColor(frame_lowcol);
|
fDrawState.SetHighColor(frame_lowcol);
|
||||||
for(int32 i=0;i<6;i++)
|
for(int32 i = 0; i < 6; i++) {
|
||||||
{
|
fDrawingEngine->StrokeLine(offset, pt2,
|
||||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
fDrawState.HighColor());
|
||||||
offset.y+=2;
|
offset.y += 2;
|
||||||
pt2.y+=2;
|
pt2.y += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Draw the buttons if we're supposed to
|
// Draw the buttons if we're supposed to
|
||||||
if(!(fFlags & B_NOT_CLOSABLE))
|
if (!(fFlags & B_NOT_CLOSABLE))
|
||||||
_DrawClose(fCloseRect);
|
_DrawClose(fCloseRect);
|
||||||
if(!(fFlags & B_NOT_ZOOMABLE))
|
if (!(fFlags & B_NOT_ZOOMABLE))
|
||||||
_DrawZoom(fZoomRect);
|
_DrawZoom(fZoomRect);
|
||||||
} else {
|
} else {
|
||||||
// Not focused - Just draw a plain light grey area with the title in the middle
|
// Not focused - Just draw a plain light grey area with the title in the middle
|
||||||
@ -610,42 +601,42 @@ MacDecorator::_DrawTab(BRect invalid)
|
|||||||
void
|
void
|
||||||
MacDecorator::_DrawClose(BRect r)
|
MacDecorator::_DrawClose(BRect r)
|
||||||
{
|
{
|
||||||
bool down=GetClose();
|
bool down = GetClose();
|
||||||
|
|
||||||
// Just like DrawZoom, but for a close button
|
// Just like DrawZoom, but for a close button
|
||||||
BRect rect(r);
|
BRect rect(r);
|
||||||
|
|
||||||
BPoint offset(r.LeftTop()),pt2(r.RightTop());
|
BPoint offset(r.LeftTop()), pt2(r.RightTop());
|
||||||
|
|
||||||
// Topleft dark grey border
|
// Topleft dark grey border
|
||||||
pt2.x--;
|
pt2.x--;
|
||||||
fDrawingEngine->SetHighColor(RGBColor(136,136,136));
|
fDrawingEngine->SetHighColor(RGBColor(136, 136, 136));
|
||||||
fDrawingEngine->StrokeLine(offset,pt2);
|
fDrawingEngine->StrokeLine(offset, pt2);
|
||||||
|
|
||||||
pt2=r.LeftBottom();
|
pt2 = r.LeftBottom();
|
||||||
pt2.y--;
|
pt2.y--;
|
||||||
fDrawingEngine->StrokeLine(offset,pt2);
|
fDrawingEngine->StrokeLine(offset, pt2);
|
||||||
|
|
||||||
// Bottomright white border
|
// Bottomright white border
|
||||||
offset=r.RightBottom();
|
offset = r.RightBottom();
|
||||||
pt2=r.RightTop();
|
pt2 = r.RightTop();
|
||||||
pt2.y++;
|
pt2.y++;
|
||||||
fDrawingEngine->SetHighColor(RGBColor(255,255,255));
|
fDrawingEngine->SetHighColor(RGBColor(255, 255, 255));
|
||||||
fDrawingEngine->StrokeLine(offset,pt2);
|
fDrawingEngine->StrokeLine(offset, pt2);
|
||||||
|
|
||||||
pt2=r.LeftBottom();
|
pt2 = r.LeftBottom();
|
||||||
pt2.x++;
|
pt2.x++;
|
||||||
fDrawingEngine->StrokeLine(offset,pt2);
|
fDrawingEngine->StrokeLine(offset, pt2);
|
||||||
|
|
||||||
// Black outline
|
// Black outline
|
||||||
rect.InsetBy(1,1);
|
rect.InsetBy(1, 1);
|
||||||
fDrawingEngine->SetHighColor(RGBColor(0,0,0));
|
fDrawingEngine->SetHighColor(RGBColor(0, 0, 0));
|
||||||
fDrawingEngine->StrokeRect(rect);
|
fDrawingEngine->StrokeRect(rect);
|
||||||
|
|
||||||
// Double-shaded button
|
// Double-shaded button
|
||||||
rect.InsetBy(1,1);
|
rect.InsetBy(1, 1);
|
||||||
_DrawBlendedRect(fDrawingEngine, rect, down);
|
_DrawBlendedRect(fDrawingEngine, rect, down);
|
||||||
rect.InsetBy(1,1);
|
rect.InsetBy(1, 1);
|
||||||
_DrawBlendedRect(fDrawingEngine, rect, !down);
|
_DrawBlendedRect(fDrawingEngine, rect, !down);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,7 +644,7 @@ MacDecorator::_DrawClose(BRect r)
|
|||||||
void
|
void
|
||||||
MacDecorator::_DrawTitle(BRect rect)
|
MacDecorator::_DrawTitle(BRect rect)
|
||||||
{
|
{
|
||||||
if(IsFocus())
|
if (IsFocus())
|
||||||
fDrawingEngine->SetHighColor(fFocusTextColor);
|
fDrawingEngine->SetHighColor(fFocusTextColor);
|
||||||
else
|
else
|
||||||
fDrawingEngine->SetHighColor(fNonFocusTextColor);
|
fDrawingEngine->SetHighColor(fNonFocusTextColor);
|
||||||
@ -662,18 +653,19 @@ MacDecorator::_DrawTitle(BRect rect)
|
|||||||
|
|
||||||
fTruncatedTitle = Title();
|
fTruncatedTitle = Title();
|
||||||
fDrawState.Font().TruncateString(&fTruncatedTitle, B_TRUNCATE_END,
|
fDrawState.Font().TruncateString(&fTruncatedTitle, B_TRUNCATE_END,
|
||||||
(fZoomRect.left - 5) - (fCloseRect.right + 5));
|
(fZoomRect.left - 5) - (fCloseRect.right + 5));
|
||||||
fTruncatedTitleLength = fTruncatedTitle.Length();
|
fTruncatedTitleLength = fTruncatedTitle.Length();
|
||||||
fDrawingEngine->SetFont(fDrawState.Font());
|
fDrawingEngine->SetFont(fDrawState.Font());
|
||||||
|
|
||||||
fDrawingEngine->DrawString(fTruncatedTitle,fTruncatedTitleLength,
|
fDrawingEngine->DrawString(fTruncatedTitle,fTruncatedTitleLength,
|
||||||
BPoint(fTabRect.left+textoffset,fCloseRect.bottom-1));
|
BPoint(fTabRect.left+textoffset,fCloseRect.bottom-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacDecorator::_DrawZoom(BRect r)
|
void
|
||||||
|
MacDecorator::_DrawZoom(BRect r)
|
||||||
{
|
{
|
||||||
bool down=GetClose();
|
bool down = GetClose();
|
||||||
|
|
||||||
// Just like DrawZoom, but for a close button
|
// Just like DrawZoom, but for a close button
|
||||||
BRect rect(r);
|
BRect rect(r);
|
||||||
@ -681,84 +673,85 @@ void MacDecorator::_DrawZoom(BRect r)
|
|||||||
BPoint offset(r.LeftTop()),pt2(r.RightTop());
|
BPoint offset(r.LeftTop()),pt2(r.RightTop());
|
||||||
|
|
||||||
pt2.x--;
|
pt2.x--;
|
||||||
fDrawState.SetHighColor(RGBColor(136,136,136));
|
fDrawState.SetHighColor(RGBColor(136, 136, 136));
|
||||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
fDrawingEngine->StrokeLine(offset, pt2, fDrawState.HighColor());
|
||||||
|
|
||||||
pt2=r.LeftBottom();
|
pt2 = r.LeftBottom();
|
||||||
pt2.y--;
|
pt2.y--;
|
||||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
fDrawingEngine->StrokeLine(offset, pt2, fDrawState.HighColor());
|
||||||
|
|
||||||
offset=r.RightBottom();
|
offset = r.RightBottom();
|
||||||
pt2=r.RightTop();
|
pt2 = r.RightTop();
|
||||||
pt2.y++;
|
pt2.y++;
|
||||||
fDrawState.SetHighColor(RGBColor(255,255,255));
|
fDrawState.SetHighColor(RGBColor(255, 255, 255));
|
||||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
fDrawingEngine->StrokeLine(offset, pt2, fDrawState.HighColor());
|
||||||
|
|
||||||
pt2=r.LeftBottom();
|
pt2 = r.LeftBottom();
|
||||||
pt2.x++;
|
pt2.x++;
|
||||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
fDrawingEngine->StrokeLine(offset, pt2, fDrawState.HighColor());
|
||||||
|
|
||||||
rect.InsetBy(1,1);
|
rect.InsetBy(1, 1);
|
||||||
fDrawState.SetHighColor(RGBColor(0,0,0));
|
fDrawState.SetHighColor(RGBColor(0, 0, 0));
|
||||||
fDrawingEngine->StrokeRect(rect,fDrawState.HighColor());
|
fDrawingEngine->StrokeRect(rect, fDrawState.HighColor());
|
||||||
|
|
||||||
rect.InsetBy(1,1);
|
rect.InsetBy(1, 1);
|
||||||
_DrawBlendedRect(fDrawingEngine, rect, down);
|
_DrawBlendedRect(fDrawingEngine, rect, down);
|
||||||
rect.InsetBy(1,1);
|
rect.InsetBy(1,1);
|
||||||
_DrawBlendedRect(fDrawingEngine, rect, !down);
|
_DrawBlendedRect(fDrawingEngine, rect, !down);
|
||||||
|
|
||||||
rect.top+=2;
|
rect.top += 2;
|
||||||
rect.left--;
|
rect.left--;
|
||||||
rect.right++;
|
rect.right++;
|
||||||
|
|
||||||
fDrawState.SetHighColor(RGBColor(0,0,0));
|
fDrawState.SetHighColor(RGBColor(0, 0, 0));
|
||||||
fDrawingEngine->StrokeLine(rect.LeftTop(),rect.RightTop(),fDrawState.HighColor());
|
fDrawingEngine->StrokeLine(rect.LeftTop(), rect.RightTop(),
|
||||||
|
fDrawState.HighColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MacDecorator::_DrawMinimize(BRect r)
|
MacDecorator::_DrawMinimize(BRect r)
|
||||||
{
|
{
|
||||||
bool down=GetClose();
|
bool down = GetClose();
|
||||||
|
|
||||||
// Just like DrawZoom, but for a close button
|
// Just like DrawZoom, but for a close button
|
||||||
BRect rect(r);
|
BRect rect(r);
|
||||||
|
|
||||||
BPoint offset(r.LeftTop()),pt2(r.RightTop());
|
BPoint offset(r.LeftTop()), pt2(r.RightTop());
|
||||||
|
|
||||||
pt2.x--;
|
pt2.x--;
|
||||||
fDrawState.SetHighColor(RGBColor(136,136,136));
|
fDrawState.SetHighColor(RGBColor(136, 136, 136));
|
||||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
fDrawingEngine->StrokeLine(offset, pt2, fDrawState.HighColor());
|
||||||
|
|
||||||
pt2=r.LeftBottom();
|
pt2 = r.LeftBottom();
|
||||||
pt2.y--;
|
pt2.y--;
|
||||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
fDrawingEngine->StrokeLine(offset, pt2, fDrawState.HighColor());
|
||||||
|
|
||||||
offset=r.RightBottom();
|
offset = r.RightBottom();
|
||||||
pt2=r.RightTop();
|
pt2 = r.RightTop();
|
||||||
pt2.y++;
|
pt2.y++;
|
||||||
fDrawState.SetHighColor(RGBColor(255,255,255));
|
fDrawState.SetHighColor(RGBColor(255, 255, 255));
|
||||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
fDrawingEngine->StrokeLine(offset, pt2, fDrawState.HighColor());
|
||||||
|
|
||||||
pt2=r.LeftBottom();
|
pt2 = r.LeftBottom();
|
||||||
pt2.x++;
|
pt2.x++;
|
||||||
fDrawingEngine->StrokeLine(offset,pt2,fDrawState.HighColor());
|
fDrawingEngine->StrokeLine(offset, pt2, fDrawState.HighColor());
|
||||||
|
|
||||||
rect.InsetBy(1,1);
|
rect.InsetBy(1, 1);
|
||||||
fDrawState.SetHighColor(RGBColor(0,0,0));
|
fDrawState.SetHighColor(RGBColor(0, 0, 0));
|
||||||
fDrawingEngine->StrokeRect(rect,fDrawState.HighColor());
|
fDrawingEngine->StrokeRect(rect, fDrawState.HighColor());
|
||||||
|
|
||||||
rect.InsetBy(1,1);
|
rect.InsetBy(1, 1);
|
||||||
_DrawBlendedRect(fDrawingEngine, rect, down);
|
_DrawBlendedRect(fDrawingEngine, rect, down);
|
||||||
rect.InsetBy(1,1);
|
rect.InsetBy(1, 1);
|
||||||
_DrawBlendedRect(fDrawingEngine, rect, !down);
|
_DrawBlendedRect(fDrawingEngine, rect, !down);
|
||||||
|
|
||||||
rect.top+=4;
|
rect.top += 4;
|
||||||
rect.bottom-=4;
|
rect.bottom -= 4;
|
||||||
rect.InsetBy(-2,0);
|
rect.InsetBy(-2, 0);
|
||||||
|
|
||||||
fDrawState.SetHighColor(RGBColor(0,0,0));
|
fDrawState.SetHighColor(RGBColor(0, 0, 0));
|
||||||
fDrawingEngine->StrokeRect(rect,fDrawState.HighColor());
|
fDrawingEngine->StrokeRect(rect, 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;
|
return 1.00;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" Decorator *(instantiate_decorator)(DesktopSettings &desktopSetting, BRect rec,
|
extern "C" Decorator*
|
||||||
window_look loo, uint32 flag)
|
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,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2009, Haiku.
|
* Copyright 2009-2010, Haiku.
|
||||||
Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*! Decorator looking like Windows 95 */
|
/*! Decorator looking like Windows 95 */
|
||||||
|
|
||||||
@ -28,7 +29,8 @@
|
|||||||
|
|
||||||
WinDecorator::WinDecorator(DesktopSettings& settings, BRect rect,
|
WinDecorator::WinDecorator(DesktopSettings& settings, BRect rect,
|
||||||
window_look look, uint32 flags)
|
window_look look, uint32 flags)
|
||||||
: Decorator(settings, rect, look, flags)
|
:
|
||||||
|
Decorator(settings, rect, look, flags)
|
||||||
{
|
{
|
||||||
taboffset=0;
|
taboffset=0;
|
||||||
|
|
||||||
@ -100,15 +102,6 @@ WinDecorator::FontsChanged(DesktopSettings& settings, BRegion* updateRegion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// SetLook
|
|
||||||
|
|
||||||
|
|
||||||
// SetFlags
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WinDecorator::MoveBy(BPoint pt)
|
WinDecorator::MoveBy(BPoint pt)
|
||||||
{
|
{
|
||||||
@ -170,34 +163,33 @@ WinDecorator::Clicked(BPoint pt, int32 buttons, int32 modifiers)
|
|||||||
{
|
{
|
||||||
if (fCloseRect.Contains(pt)) {
|
if (fCloseRect.Contains(pt)) {
|
||||||
STRACE(("WinDecorator():Clicked() - Close\n"));
|
STRACE(("WinDecorator():Clicked() - Close\n"));
|
||||||
return DEC_CLOSE;
|
return CLICK_CLOSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fZoomRect.Contains(pt)) {
|
if (fZoomRect.Contains(pt)) {
|
||||||
STRACE(("WinDecorator():Clicked() - Zoom\n"));
|
STRACE(("WinDecorator():Clicked() - Zoom\n"));
|
||||||
return DEC_ZOOM;
|
return CLICK_ZOOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clicking in the tab?
|
// Clicking in the tab?
|
||||||
if (fTabRect.Contains(pt)) {
|
if (fTabRect.Contains(pt)) {
|
||||||
// Here's part of our window management stuff
|
// 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())
|
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?
|
// 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"));
|
STRACE(("WinDecorator():Clicked() - Resize\n"));
|
||||||
return DEC_RESIZE;
|
return CLICK_RESIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Guess user didn't click anything
|
// Guess user didn't click anything
|
||||||
STRACE(("WinDecorator():Clicked()\n"));
|
STRACE(("WinDecorator():Clicked()\n"));
|
||||||
return DEC_NONE;
|
return CLICK_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -328,7 +320,7 @@ WinDecorator::_DrawZoom(BRect r)
|
|||||||
rect.bottom--;
|
rect.bottom--;
|
||||||
rect.right--;
|
rect.right--;
|
||||||
|
|
||||||
if(GetZoom())
|
if (GetZoom())
|
||||||
rect.OffsetBy(1,1);
|
rect.OffsetBy(1,1);
|
||||||
|
|
||||||
fDrawingEngine->SetHighColor(RGBColor(0,0,0));
|
fDrawingEngine->SetHighColor(RGBColor(0,0,0));
|
||||||
@ -351,7 +343,7 @@ WinDecorator::_DrawClose(BRect r)
|
|||||||
rect.right--;
|
rect.right--;
|
||||||
rect.top--;
|
rect.top--;
|
||||||
|
|
||||||
if(GetClose())
|
if (GetClose())
|
||||||
rect.OffsetBy(1,1);
|
rect.OffsetBy(1,1);
|
||||||
|
|
||||||
fDrawingEngine->SetHighColor(RGBColor(0,0,0));
|
fDrawingEngine->SetHighColor(RGBColor(0,0,0));
|
||||||
@ -362,7 +354,9 @@ WinDecorator::_DrawClose(BRect r)
|
|||||||
fDrawingEngine->StrokeLine(rect.RightTop(),rect.LeftBottom());
|
fDrawingEngine->StrokeLine(rect.RightTop(),rect.LeftBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinDecorator::_DrawMinimize(BRect r)
|
|
||||||
|
void
|
||||||
|
WinDecorator::_DrawMinimize(BRect r)
|
||||||
{
|
{
|
||||||
// Just like DrawZoom, but for a Minimize button
|
// Just like DrawZoom, but for a Minimize button
|
||||||
DrawBeveledRect(r,GetMinimize());
|
DrawBeveledRect(r,GetMinimize());
|
||||||
@ -401,18 +395,19 @@ WinDecorator::_DrawTab(BRect r)
|
|||||||
void
|
void
|
||||||
WinDecorator::DrawBeveledRect(BRect r, bool down)
|
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);
|
lower.SetColor(255,255,255);
|
||||||
low.SetColor(216,216,216);
|
low.SetColor(216,216,216);
|
||||||
mid.SetColor(192,192,192);
|
mid.SetColor(192,192,192);
|
||||||
high.SetColor(128,128,128);
|
high.SetColor(128,128,128);
|
||||||
higher.SetColor(0,0,0);
|
higher.SetColor(0,0,0);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
higher.SetColor(255,255,255);
|
higher.SetColor(255,255,255);
|
||||||
high.SetColor(216,216,216);
|
high.SetColor(216,216,216);
|
||||||
mid.SetColor(192,192,192);
|
mid.SetColor(192,192,192);
|
||||||
@ -475,9 +470,9 @@ void
|
|||||||
WinDecorator::_UpdateFont(DesktopSettings& settings)
|
WinDecorator::_UpdateFont(DesktopSettings& settings)
|
||||||
{
|
{
|
||||||
ServerFont font;
|
ServerFont font;
|
||||||
if (fLook == B_FLOATING_WINDOW_LOOK) {
|
if (fLook == B_FLOATING_WINDOW_LOOK)
|
||||||
settings.GetDefaultPlainFont(font);
|
settings.GetDefaultPlainFont(font);
|
||||||
} else
|
else
|
||||||
settings.GetDefaultBoldFont(font);
|
settings.GetDefaultBoldFont(font);
|
||||||
|
|
||||||
font.SetFlags(B_FORCE_ANTIALIASING);
|
font.SetFlags(B_FORCE_ANTIALIASING);
|
||||||
@ -489,18 +484,18 @@ WinDecorator::_UpdateFont(DesktopSettings& settings)
|
|||||||
void
|
void
|
||||||
WinDecorator::_DrawFrame(BRect rect)
|
WinDecorator::_DrawFrame(BRect rect)
|
||||||
{
|
{
|
||||||
if(fLook==B_NO_BORDER_WINDOW_LOOK)
|
if (fLook == B_NO_BORDER_WINDOW_LOOK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fBorderRect == fFrame)
|
if (fBorderRect == fFrame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BRect r=fBorderRect;
|
BRect r = fBorderRect;
|
||||||
|
|
||||||
fDrawingEngine->SetHighColor(frame_lowercol);
|
fDrawingEngine->SetHighColor(frame_lowercol);
|
||||||
fDrawingEngine->StrokeRect(r);
|
fDrawingEngine->StrokeRect(r);
|
||||||
|
|
||||||
if ( fLook == B_BORDERED_WINDOW_LOOK)
|
if (fLook == B_BORDERED_WINDOW_LOOK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BPoint pt;
|
BPoint pt;
|
||||||
@ -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;
|
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)
|
window_look wlook, int32 wflags)
|
||||||
{
|
{
|
||||||
return new WinDecorator(desktopSetting, rect, wlook, wflags);
|
return new WinDecorator(desktopSetting, rect, wlook, wflags);
|
||||||
|
Loading…
Reference in New Issue
Block a user