Updated support sources
Improved drawing. Strange drawing bug in BeDecorator buttons to be fixed later git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3893 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
10b4673564
commit
136966335a
@ -1,3 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: BeDecorator.cpp
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: Decorator in the style of BeOS R5
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#include <Rect.h>
|
||||
#include "DisplayDriver.h"
|
||||
#include <View.h>
|
||||
#include "LayerData.h"
|
||||
@ -5,26 +32,25 @@
|
||||
#include "BeDecorator.h"
|
||||
#include "RGBColor.h"
|
||||
|
||||
//#define DEBUG_DECOR
|
||||
//#define DEBUG_DECORATOR
|
||||
|
||||
#ifdef DEBUG_DECOR
|
||||
|
||||
#define USE_VIEW_FILL_HACK
|
||||
|
||||
#ifdef DEBUG_DECORATOR
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
BeDecorator::BeDecorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags)
|
||||
: Decorator(rect,wlook,wfeel,wflags)
|
||||
{
|
||||
#ifdef DEBUG_DECOR
|
||||
printf("BeDecorator()\n");
|
||||
#endif
|
||||
taboffset=0;
|
||||
titlepixelwidth=0;
|
||||
|
||||
_SetFocus();
|
||||
|
||||
// These hard-coded assignments will go bye-bye when the system _colors
|
||||
// API is implemented
|
||||
|
||||
// commented these out because they are taken care of by the SetFocus() call
|
||||
SetFocus(false);
|
||||
|
||||
frame_highercol.SetColor(216,216,216);
|
||||
frame_lowercol.SetColor(110,110,110);
|
||||
|
||||
@ -41,55 +67,85 @@ printf("BeDecorator()\n");
|
||||
solidhigh=0xFFFFFFFFFFFFFFFFLL;
|
||||
solidlow=0;
|
||||
|
||||
tab_highcol=_colors->window_tab;
|
||||
tab_lowcol=_colors->window_tab;
|
||||
// tab_highcol=_colors->window_tab;
|
||||
// tab_lowcol=_colors->window_tab;
|
||||
|
||||
#ifdef DEBUG_DECORATOR
|
||||
printf("BeDecorator:\n");
|
||||
printf("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom);
|
||||
#endif
|
||||
}
|
||||
|
||||
BeDecorator::~BeDecorator(void)
|
||||
{
|
||||
#ifdef DEBUG_DECOR
|
||||
printf("~BeDecorator()\n");
|
||||
#ifdef DEBUG_DECORATOR
|
||||
printf("BeDecorator: ~BeDecorator()\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
click_type BeDecorator::Clicked(BPoint pt, int32 buttons, int32 modifiers)
|
||||
{
|
||||
if(_closerect.Contains(pt))
|
||||
{
|
||||
|
||||
#ifdef DEBUG_DECOR
|
||||
printf("BeDecorator():Clicked() - Close\n");
|
||||
#ifdef DEBUG_DECORATOR
|
||||
printf("BeDecorator: Clicked\n");
|
||||
printf("\tPoint: (%.1f,%.1f)\n",pt.x,pt.y);
|
||||
printf("\tButtons:\n");
|
||||
if(buttons==0)
|
||||
printf("\t\tNone\n");
|
||||
else
|
||||
{
|
||||
if(buttons & B_PRIMARY_MOUSE_BUTTON)
|
||||
printf("\t\tPrimary\n");
|
||||
if(buttons & B_SECONDARY_MOUSE_BUTTON)
|
||||
printf("\t\tSecondary\n");
|
||||
if(buttons & B_TERTIARY_MOUSE_BUTTON)
|
||||
printf("\t\tTertiary\n");
|
||||
}
|
||||
printf("\tModifiers:\n");
|
||||
if(modifiers==0)
|
||||
printf("\t\tNone\n");
|
||||
else
|
||||
{
|
||||
if(modifiers & B_CAPS_LOCK)
|
||||
printf("\t\tCaps Lock\n");
|
||||
if(modifiers & B_NUM_LOCK)
|
||||
printf("\t\tNum Lock\n");
|
||||
if(modifiers & B_SCROLL_LOCK)
|
||||
printf("\t\tScroll Lock\n");
|
||||
if(modifiers & B_LEFT_COMMAND_KEY)
|
||||
printf("\t\t Left Command\n");
|
||||
if(modifiers & B_RIGHT_COMMAND_KEY)
|
||||
printf("\t\t Right Command\n");
|
||||
if(modifiers & B_LEFT_CONTROL_KEY)
|
||||
printf("\t\tLeft Control\n");
|
||||
if(modifiers & B_RIGHT_CONTROL_KEY)
|
||||
printf("\t\tRight Control\n");
|
||||
if(modifiers & B_LEFT_OPTION_KEY)
|
||||
printf("\t\tLeft Option\n");
|
||||
if(modifiers & B_RIGHT_OPTION_KEY)
|
||||
printf("\t\tRight Option\n");
|
||||
if(modifiers & B_LEFT_SHIFT_KEY)
|
||||
printf("\t\tLeft Shift\n");
|
||||
if(modifiers & B_RIGHT_SHIFT_KEY)
|
||||
printf("\t\tRight Shift\n");
|
||||
if(modifiers & B_MENU_KEY)
|
||||
printf("\t\tMenu\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
if(_closerect.Contains(pt))
|
||||
return CLICK_CLOSE;
|
||||
}
|
||||
|
||||
if(_zoomrect.Contains(pt))
|
||||
{
|
||||
|
||||
#ifdef DEBUG_DECOR
|
||||
printf("BeDecorator():Clicked() - Zoom\n");
|
||||
#endif
|
||||
|
||||
return CLICK_ZOOM;
|
||||
}
|
||||
|
||||
if(_resizerect.Contains(pt) && _look==B_DOCUMENT_WINDOW_LOOK)
|
||||
{
|
||||
|
||||
#ifdef DEBUG_DECOR
|
||||
printf("BeDecorator():Clicked() - Resize thumb\n");
|
||||
#endif
|
||||
|
||||
return CLICK_RESIZE;
|
||||
}
|
||||
|
||||
// Clicking in the tab?
|
||||
if(_tabrect.Contains(pt))
|
||||
{
|
||||
// Here's part of our window management stuff
|
||||
if(buttons==B_PRIMARY_MOUSE_BUTTON && !GetFocus())
|
||||
return CLICK_MOVETOFRONT;
|
||||
// if(buttons==B_PRIMARY_MOUSE_BUTTON && !GetFocus())
|
||||
// return CLICK_MOVETOFRONT;
|
||||
if(buttons==B_SECONDARY_MOUSE_BUTTON)
|
||||
return CLICK_MOVETOBACK;
|
||||
return CLICK_DRAG;
|
||||
@ -101,9 +157,6 @@ printf("BeDecorator():Clicked() - Resize thumb\n");
|
||||
BRect clientrect(brect.InsetByCopy(3,3));
|
||||
if(brect.Contains(pt) && !clientrect.Contains(pt))
|
||||
{
|
||||
#ifdef DEBUG_DECOR
|
||||
printf("BeDecorator():Clicked() - Drag\n");
|
||||
#endif
|
||||
if(_resizerect.Contains(pt))
|
||||
return CLICK_RESIZE;
|
||||
|
||||
@ -111,28 +164,28 @@ printf("BeDecorator():Clicked() - Drag\n");
|
||||
}
|
||||
|
||||
// Guess user didn't click anything
|
||||
#ifdef DEBUG_DECOR
|
||||
printf("BeDecorator():Clicked()\n");
|
||||
#endif
|
||||
return CLICK_NONE;
|
||||
}
|
||||
|
||||
void BeDecorator::_DoLayout(void)
|
||||
{
|
||||
//debugger("");
|
||||
#ifdef DEBUG_DECORATOR
|
||||
printf("BeDecorator: Do Layout\n");
|
||||
#endif
|
||||
// Here we determine the size of every rectangle that we use
|
||||
// internally when we are given the size of the client rectangle.
|
||||
|
||||
// Current version simply makes everything fit inside the rect
|
||||
// instead of building around it. This will change.
|
||||
|
||||
#ifdef DEBUG_DECOR
|
||||
printf("BeDecorator()::_DoLayout()"); rect.PrintToStream();
|
||||
#endif
|
||||
_tabrect=_frame;
|
||||
_resizerect=_frame;
|
||||
_borderrect=_frame;
|
||||
_closerect=_frame;
|
||||
|
||||
textoffset=(_look==B_FLOATING_WINDOW_LOOK)?5:7;
|
||||
|
||||
_closerect.left+=(_look==B_FLOATING_WINDOW_LOOK)?2:4;
|
||||
_closerect.top+=(_look==B_FLOATING_WINDOW_LOOK)?6:4;
|
||||
_closerect.right=_closerect.left+10;
|
||||
@ -144,16 +197,18 @@ printf("BeDecorator()::_DoLayout()"); rect.PrintToStream();
|
||||
_resizerect.left=_resizerect.right-18;
|
||||
|
||||
_tabrect.bottom=_tabrect.top+18;
|
||||
/* if(GetTitle())
|
||||
if(strlen(GetTitle())>1)
|
||||
{
|
||||
float titlewidth=_closerect.right
|
||||
+_driver->StringWidth(layer->name->String(),
|
||||
layer->name->Length())
|
||||
+35;
|
||||
_tabrect.right=(titlewidth<_frame.right -1)?titlewidth:_frame.right;
|
||||
if(_driver)
|
||||
titlepixelwidth=_driver->StringWidth(GetTitle(),_TitleWidth(), &_layerdata);
|
||||
else
|
||||
titlepixelwidth=10;
|
||||
|
||||
if(_closerect.right+textoffset+titlepixelwidth+35< _frame.Width()-1)
|
||||
_tabrect.right=_tabrect.left+titlepixelwidth;
|
||||
}
|
||||
else
|
||||
*/ _tabrect.right=_tabrect.left+_tabrect.Width()/2;
|
||||
_tabrect.right=_tabrect.left+_tabrect.Width()/2;
|
||||
|
||||
if(_look==B_FLOATING_WINDOW_LOOK)
|
||||
_tabrect.top+=4;
|
||||
@ -165,7 +220,6 @@ printf("BeDecorator()::_DoLayout()"); rect.PrintToStream();
|
||||
_zoomrect.left=_zoomrect.right-10;
|
||||
_zoomrect.bottom=_zoomrect.top+10;
|
||||
|
||||
textoffset=(_look==B_FLOATING_WINDOW_LOOK)?5:7;
|
||||
}
|
||||
|
||||
void BeDecorator::MoveBy(float x, float y)
|
||||
@ -175,6 +229,9 @@ void BeDecorator::MoveBy(float x, float y)
|
||||
|
||||
void BeDecorator::MoveBy(BPoint pt)
|
||||
{
|
||||
#ifdef DEBUG_DECORATOR
|
||||
printf("BeDecorator: Move By (%.1f, %.1f)\n",pt.x,pt.y);
|
||||
#endif
|
||||
// Move all internal rectangles the appropriate amount
|
||||
_frame.OffsetBy(pt);
|
||||
_closerect.OffsetBy(pt);
|
||||
@ -183,31 +240,38 @@ void BeDecorator::MoveBy(BPoint pt)
|
||||
_borderrect.OffsetBy(pt);
|
||||
_zoomrect.OffsetBy(pt);
|
||||
}
|
||||
/*
|
||||
SRegion * BeDecorator::GetFootprint(void)
|
||||
|
||||
BRegion * BeDecorator::GetFootprint(void)
|
||||
{
|
||||
#ifdef DEBUG_DECORATOR
|
||||
printf("BeDecorator: Get Footprint\n");
|
||||
#endif
|
||||
// This function calculates the decorator's footprint in coordinates
|
||||
// relative to the layer. This is most often used to set a WindowBorder
|
||||
// relative to the layer. This is most often used to set a WinBorder
|
||||
// object's visible region.
|
||||
|
||||
SRegion *reg=new SRegion(_borderrect);
|
||||
BRegion *reg=new BRegion(_borderrect);
|
||||
reg->Include(_tabrect);
|
||||
return reg;
|
||||
}
|
||||
*/
|
||||
|
||||
void BeDecorator::_DrawTitle(BRect r)
|
||||
{
|
||||
// Designed simply to redraw the title when it has changed on
|
||||
// the client side.
|
||||
/* _driver->SetDrawingMode(B_OP_OVER);
|
||||
rgb_color tmpcol=_driver->HighColor();
|
||||
_driver->SetHighColor(textcol.red,textcol.green,textcol.blue);
|
||||
_driver->DrawString((char *)string,strlen(string),
|
||||
BPoint(_closerect.right+textoffset,_closerect.bottom-1));
|
||||
_driver->SetHighColor(tmpcol.red,tmpcol.green,tmpcol.blue);
|
||||
_driver->SetDrawingMode(B_OP_COPY);
|
||||
*/
|
||||
_layerdata.highcolor=_colors->window_tab_text;
|
||||
_layerdata.lowcolor=(GetFocus())?_colors->window_tab:_colors->inactive_window_tab;
|
||||
|
||||
int32 titlecount=_ClipTitle((_zoomrect.left-5)-(_closerect.right+textoffset));
|
||||
BString titlestr=GetTitle();
|
||||
if(titlecount<titlestr.CountChars())
|
||||
{
|
||||
titlestr.Truncate(titlecount-1);
|
||||
titlestr+="...";
|
||||
titlecount+=2;
|
||||
}
|
||||
_driver->DrawString(titlestr.String(),titlecount,
|
||||
BPoint(_closerect.right+textoffset,_closerect.bottom+1),&_layerdata);
|
||||
}
|
||||
|
||||
void BeDecorator::_SetFocus(void)
|
||||
@ -217,36 +281,30 @@ void BeDecorator::_SetFocus(void)
|
||||
|
||||
if(GetFocus())
|
||||
{
|
||||
// tab_highcol.SetColor(255,236,33);
|
||||
// tab_lowcol.SetColor(234,181,0);
|
||||
tab_highcol=_colors->window_tab;
|
||||
tab_lowcol=_colors->window_tab;
|
||||
|
||||
button_highcol.SetColor(255,255,0);
|
||||
button_lowcol.SetColor(255,203,0);
|
||||
button_highcol.SetColor(tint_color(_colors->window_tab.GetColor32(),B_LIGHTEN_2_TINT));
|
||||
button_lowcol.SetColor(tint_color(_colors->window_tab.GetColor32(),B_DARKEN_2_TINT));
|
||||
textcol=_colors->window_tab_text;
|
||||
}
|
||||
else
|
||||
{
|
||||
tab_highcol.SetColor(235,235,235);
|
||||
tab_lowcol.SetColor(160,160,160);
|
||||
|
||||
button_highcol.SetColor(229,229,229);
|
||||
button_lowcol.SetColor(153,153,153);
|
||||
button_highcol.SetColor(tint_color(_colors->inactive_window_tab.GetColor32(),B_LIGHTEN_2_TINT));
|
||||
button_lowcol.SetColor(tint_color(_colors->inactive_window_tab.GetColor32(),B_DARKEN_2_TINT));
|
||||
textcol=_colors->inactive_window_tab_text;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BeDecorator::Draw(BRect update)
|
||||
{
|
||||
#ifdef DEBUG_DECORATOR
|
||||
printf("BeDecorator: Draw(%.1f,%.1f,%.1f,%.1f)\n",update.left,update.top,update.right,update.bottom);
|
||||
#endif
|
||||
// We need to draw a few things: the tab, the resize thumb, the borders,
|
||||
// and the buttons
|
||||
|
||||
_DrawTab(update);
|
||||
|
||||
// Draw the top view's client area - just a hack :)
|
||||
RGBColor blue(100,100,255);
|
||||
|
||||
_layerdata.highcolor=blue;
|
||||
_layerdata.highcolor=_colors->document_background;
|
||||
|
||||
if(_borderrect.Intersects(update))
|
||||
_driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh);
|
||||
@ -260,9 +318,7 @@ void BeDecorator::Draw(void)
|
||||
// things
|
||||
|
||||
// Draw the top view's client area - just a hack :)
|
||||
RGBColor blue(100,100,255);
|
||||
|
||||
_layerdata.highcolor=blue;
|
||||
_layerdata.highcolor=_colors->document_background;
|
||||
|
||||
_driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh);
|
||||
DrawFrame();
|
||||
@ -296,13 +352,12 @@ void BeDecorator::_DrawTab(BRect r)
|
||||
if(_look==B_NO_BORDER_WINDOW_LOOK)
|
||||
return;
|
||||
|
||||
_layerdata.highcolor=(GetFocus())?_colors->window_tab:_colors->inactive_window_tab;
|
||||
_driver->FillRect(_tabrect,&_layerdata,(int8*)&solidhigh);
|
||||
_layerdata.highcolor=frame_lowcol;
|
||||
_driver->StrokeRect(_tabrect,&_layerdata,(int8*)&solidhigh);
|
||||
_driver->StrokeLine(_tabrect.LeftBottom(),_tabrect.RightBottom(),&_layerdata,(int8*)&solidhigh);
|
||||
|
||||
// UpdateTitle(layer->name->String());
|
||||
|
||||
_layerdata.highcolor=_colors->window_tab;
|
||||
_driver->FillRect(_tabrect.InsetByCopy(1,1),&_layerdata,(int8*)&solidhigh);
|
||||
_DrawTitle(_tabrect);
|
||||
|
||||
// Draw the buttons if we're supposed to
|
||||
if(!(_flags & B_NOT_CLOSABLE))
|
||||
@ -311,6 +366,11 @@ void BeDecorator::_DrawTab(BRect r)
|
||||
_DrawZoom(_zoomrect);
|
||||
}
|
||||
|
||||
void BeDecorator::_SetColors(void)
|
||||
{
|
||||
_SetFocus();
|
||||
}
|
||||
|
||||
void BeDecorator::DrawBlendedRect(BRect r, bool down)
|
||||
{
|
||||
// This bad boy is used to draw a rectangle with a gradient.
|
||||
@ -371,6 +431,10 @@ void BeDecorator::_DrawFrame(BRect rect)
|
||||
{
|
||||
// Duh, draws the window frame, I think. ;)
|
||||
|
||||
#ifdef USE_VIEW_FILL_HACK
|
||||
_driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh);
|
||||
#endif
|
||||
|
||||
if(_look==B_NO_BORDER_WINDOW_LOOK)
|
||||
return;
|
||||
|
||||
|
@ -1,7 +1,34 @@
|
||||
#ifndef _BEOS_DECORATOR_H_
|
||||
#define _BEOS_DECORATOR_H_
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: BeDecorator.cpp
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: Decorator in the style of BeOS R5
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef _BE_DECORATOR_H_
|
||||
#define _BE_DECORATOR_H_
|
||||
|
||||
#include "Decorator.h"
|
||||
#include <Region.h>
|
||||
|
||||
class BeDecorator: public Decorator
|
||||
{
|
||||
@ -11,13 +38,10 @@ public:
|
||||
|
||||
void MoveBy(float x, float y);
|
||||
void MoveBy(BPoint pt);
|
||||
// void ResizeBy(float x, float y);
|
||||
// void ResizeBy(BPoint pt);
|
||||
void Draw(BRect r);
|
||||
void Draw(void);
|
||||
//SRegion GetFootprint(void);
|
||||
BRegion *GetFootprint(void);
|
||||
click_type Clicked(BPoint pt, int32 buttons, int32 modifiers);
|
||||
|
||||
protected:
|
||||
void _DrawClose(BRect r);
|
||||
void _DrawFrame(BRect r);
|
||||
@ -26,6 +50,7 @@ protected:
|
||||
void _DrawZoom(BRect r);
|
||||
void _DoLayout(void);
|
||||
void _SetFocus(void);
|
||||
void _SetColors(void);
|
||||
void DrawBlendedRect(BRect r, bool down);
|
||||
uint32 taboffset;
|
||||
|
||||
@ -38,6 +63,7 @@ protected:
|
||||
|
||||
bool slidetab;
|
||||
int textoffset;
|
||||
float titlepixelwidth;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -44,9 +44,10 @@ Decorator::Decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags)
|
||||
_close_state=false;
|
||||
_minimize_state=false;
|
||||
_zoom_state=false;
|
||||
_title_string=new BString;
|
||||
_has_focus=false;
|
||||
_title_string=new BString("");
|
||||
_driver=NULL;
|
||||
|
||||
|
||||
_closerect.Set(0,0,1,1);
|
||||
_zoomrect.Set(0,0,1,1);
|
||||
_minimizerect.Set(0,0,1,1);
|
||||
@ -83,8 +84,8 @@ Decorator::~Decorator(void)
|
||||
*/
|
||||
void Decorator::SetColors(const ColorSet &cset)
|
||||
{
|
||||
if(_colors)
|
||||
_colors->SetColors(cset);
|
||||
_colors->SetColors(cset);
|
||||
_SetColors();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -232,6 +233,7 @@ int32 Decorator::GetFlags(void)
|
||||
void Decorator::SetTitle(const char *string)
|
||||
{
|
||||
_title_string->SetTo(string);
|
||||
_DoLayout();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -330,7 +332,7 @@ void Decorator::MoveBy(BPoint pt)
|
||||
necessarily reflect _tabrect offset by the amount given - few people want to
|
||||
slide a tab right off the window - that would be a Bad Thing (TM).
|
||||
*/
|
||||
BRect Decorator::SlideTab(float dx, float dy=0)
|
||||
BRect Decorator::SlideTab(float dx, float dy)
|
||||
{
|
||||
return BRect(0,0,0,0);
|
||||
}
|
||||
@ -486,6 +488,16 @@ void Decorator::_DrawZoom(BRect r)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Hook function for when the color set is updated
|
||||
|
||||
This function is called after the decorator's color set is updated. Quite useful
|
||||
if the decorator uses colors based on those in the system.
|
||||
*/
|
||||
void Decorator::_SetColors(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the "footprint" of the entire window, including decorator
|
||||
\return Region representing the window's screen footprint
|
||||
|
@ -95,6 +95,11 @@ public:
|
||||
|
||||
protected:
|
||||
int32 _ClipTitle(float width);
|
||||
|
||||
/*!
|
||||
\brief Returns the number of characters in the title
|
||||
\return The title character count
|
||||
*/
|
||||
int32 _TitleWidth(void) { return (_title_string)?_title_string->CountChars():0; }
|
||||
|
||||
virtual void _DrawClose(BRect r);
|
||||
@ -105,6 +110,7 @@ protected:
|
||||
virtual void _DrawZoom(BRect r);
|
||||
virtual void _SetFocus(void)=0;
|
||||
virtual void _DoLayout(void)=0;
|
||||
virtual void _SetColors(void);
|
||||
|
||||
ColorSet *_colors;
|
||||
DisplayDriver *_driver;
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define LAYERDATA_H_
|
||||
|
||||
#include <Point.h>
|
||||
#include <View.h>
|
||||
class ServerBitmap;
|
||||
|
||||
class LayerData
|
||||
@ -11,9 +12,9 @@ LayerData(void)
|
||||
{
|
||||
pensize=1.0;
|
||||
penlocation.Set(0,0);
|
||||
drawing_mode=0;
|
||||
bitmap_background=NULL;
|
||||
bitmap_overlay=NULL;
|
||||
draw_mode=B_OP_COPY;
|
||||
background=NULL;
|
||||
overlay=NULL;
|
||||
highcolor.SetColor(0,0,0,255);
|
||||
lowcolor.SetColor(255,255,255,255);
|
||||
//SFont font;
|
||||
@ -21,15 +22,17 @@ LayerData(void)
|
||||
scale=1.0;
|
||||
};
|
||||
|
||||
float pensize;
|
||||
BPoint penlocation;
|
||||
int32 drawing_mode;
|
||||
ServerBitmap *bitmap_background;
|
||||
ServerBitmap *bitmap_overlay;
|
||||
RGBColor highcolor, lowcolor;
|
||||
//SFont font;
|
||||
//bool antialias_text;
|
||||
float scale;
|
||||
float pensize;
|
||||
BPoint penlocation;
|
||||
drawing_mode draw_mode;
|
||||
source_alpha alpha_mode;
|
||||
alpha_function blending_mode;
|
||||
ServerBitmap *background;
|
||||
ServerBitmap *overlay;
|
||||
RGBColor highcolor, lowcolor, viewcolor;
|
||||
// ServerFont *font;
|
||||
float scale;
|
||||
escapement_delta edelta;
|
||||
};
|
||||
|
||||
|
||||
|
@ -44,9 +44,10 @@ Decorator::Decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags)
|
||||
_close_state=false;
|
||||
_minimize_state=false;
|
||||
_zoom_state=false;
|
||||
_title_string=new BString;
|
||||
_has_focus=false;
|
||||
_title_string=new BString("");
|
||||
_driver=NULL;
|
||||
|
||||
|
||||
_closerect.Set(0,0,1,1);
|
||||
_zoomrect.Set(0,0,1,1);
|
||||
_minimizerect.Set(0,0,1,1);
|
||||
@ -83,8 +84,8 @@ Decorator::~Decorator(void)
|
||||
*/
|
||||
void Decorator::SetColors(const ColorSet &cset)
|
||||
{
|
||||
if(_colors)
|
||||
_colors->SetColors(cset);
|
||||
_colors->SetColors(cset);
|
||||
_SetColors();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -232,6 +233,7 @@ int32 Decorator::GetFlags(void)
|
||||
void Decorator::SetTitle(const char *string)
|
||||
{
|
||||
_title_string->SetTo(string);
|
||||
_DoLayout();
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -330,7 +332,7 @@ void Decorator::MoveBy(BPoint pt)
|
||||
necessarily reflect _tabrect offset by the amount given - few people want to
|
||||
slide a tab right off the window - that would be a Bad Thing (TM).
|
||||
*/
|
||||
BRect Decorator::SlideTab(float dx, float dy=0)
|
||||
BRect Decorator::SlideTab(float dx, float dy)
|
||||
{
|
||||
return BRect(0,0,0,0);
|
||||
}
|
||||
@ -486,6 +488,16 @@ void Decorator::_DrawZoom(BRect r)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Hook function for when the color set is updated
|
||||
|
||||
This function is called after the decorator's color set is updated. Quite useful
|
||||
if the decorator uses colors based on those in the system.
|
||||
*/
|
||||
void Decorator::_SetColors(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the "footprint" of the entire window, including decorator
|
||||
\return Region representing the window's screen footprint
|
||||
|
@ -95,6 +95,11 @@ public:
|
||||
|
||||
protected:
|
||||
int32 _ClipTitle(float width);
|
||||
|
||||
/*!
|
||||
\brief Returns the number of characters in the title
|
||||
\return The title character count
|
||||
*/
|
||||
int32 _TitleWidth(void) { return (_title_string)?_title_string->CountChars():0; }
|
||||
|
||||
virtual void _DrawClose(BRect r);
|
||||
@ -105,6 +110,7 @@ protected:
|
||||
virtual void _DrawZoom(BRect r);
|
||||
virtual void _SetFocus(void)=0;
|
||||
virtual void _DoLayout(void)=0;
|
||||
virtual void _SetColors(void);
|
||||
|
||||
ColorSet *_colors;
|
||||
DisplayDriver *_driver;
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define LAYERDATA_H_
|
||||
|
||||
#include <Point.h>
|
||||
#include <View.h>
|
||||
class ServerBitmap;
|
||||
|
||||
class LayerData
|
||||
@ -11,9 +12,9 @@ LayerData(void)
|
||||
{
|
||||
pensize=1.0;
|
||||
penlocation.Set(0,0);
|
||||
drawing_mode=0;
|
||||
bitmap_background=NULL;
|
||||
bitmap_overlay=NULL;
|
||||
draw_mode=B_OP_COPY;
|
||||
background=NULL;
|
||||
overlay=NULL;
|
||||
highcolor.SetColor(0,0,0,255);
|
||||
lowcolor.SetColor(255,255,255,255);
|
||||
//SFont font;
|
||||
@ -21,15 +22,17 @@ LayerData(void)
|
||||
scale=1.0;
|
||||
};
|
||||
|
||||
float pensize;
|
||||
BPoint penlocation;
|
||||
int32 drawing_mode;
|
||||
ServerBitmap *bitmap_background;
|
||||
ServerBitmap *bitmap_overlay;
|
||||
RGBColor highcolor, lowcolor;
|
||||
//SFont font;
|
||||
//bool antialias_text;
|
||||
float scale;
|
||||
float pensize;
|
||||
BPoint penlocation;
|
||||
drawing_mode draw_mode;
|
||||
source_alpha alpha_mode;
|
||||
alpha_function blending_mode;
|
||||
ServerBitmap *background;
|
||||
ServerBitmap *overlay;
|
||||
RGBColor highcolor, lowcolor, viewcolor;
|
||||
// ServerFont *font;
|
||||
float scale;
|
||||
escapement_delta edelta;
|
||||
};
|
||||
|
||||
|
||||
|
@ -19,11 +19,6 @@ printf("WinDecorator()\n");
|
||||
#endif
|
||||
taboffset=0;
|
||||
|
||||
// These hard-coded assignments will go bye-bye when the system colors
|
||||
// API is implemented
|
||||
tab_highcol.SetColor(100,100,255);
|
||||
tab_lowcol.SetColor(40,0,255);
|
||||
|
||||
button_highercol.SetColor(255,255,255);
|
||||
button_lowercol.SetColor(0,0,0);
|
||||
|
||||
@ -34,8 +29,6 @@ printf("WinDecorator()\n");
|
||||
frame_highercol.SetColor(216,216,216);
|
||||
frame_lowercol.SetColor(110,110,110);
|
||||
|
||||
textcol.SetColor(0,0,0);
|
||||
|
||||
frame_highcol=frame_lowercol.MakeBlendColor(frame_highercol,0.75);
|
||||
frame_midcol=frame_lowercol.MakeBlendColor(frame_highercol,0.5);
|
||||
frame_lowcol=frame_lowercol.MakeBlendColor(frame_highercol,0.25);
|
||||
@ -182,13 +175,17 @@ void WinDecorator::_SetFocus(void)
|
||||
|
||||
if(GetFocus())
|
||||
{
|
||||
tab_highcol.SetColor(100,100,255);
|
||||
tab_lowcol.SetColor(40,0,255);
|
||||
// tab_highcol.SetColor(100,100,255);
|
||||
// tab_lowcol.SetColor(40,0,255);
|
||||
tab_highcol=_colors->window_tab;
|
||||
textcol=_colors->window_tab_text;
|
||||
}
|
||||
else
|
||||
{
|
||||
tab_highcol.SetColor(220,220,220);
|
||||
tab_lowcol.SetColor(128,128,128);
|
||||
// tab_highcol.SetColor(220,220,220);
|
||||
// tab_lowcol.SetColor(128,128,128);
|
||||
tab_highcol=_colors->inactive_window_tab;
|
||||
textcol=_colors->inactive_window_tab_text;
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,9 +195,11 @@ void WinDecorator::Draw(BRect update)
|
||||
printf("WinDecorator::Draw(): "); update.PrintToStream();
|
||||
#endif
|
||||
// Draw the top view's client area - just a hack :)
|
||||
RGBColor blue(100,100,255);
|
||||
// RGBColor blue(100,100,255);
|
||||
// _layerdata.highcolor=blue;
|
||||
|
||||
_layerdata.highcolor=blue;
|
||||
_layerdata.highcolor=_colors->document_background;
|
||||
_driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh);
|
||||
|
||||
if(_borderrect.Intersects(update))
|
||||
_driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh);
|
||||
@ -216,9 +215,11 @@ printf("WinDecorator::Draw()\n");
|
||||
#endif
|
||||
|
||||
// Draw the top view's client area - just a hack :)
|
||||
RGBColor blue(100,100,255);
|
||||
// RGBColor blue(100,100,255);
|
||||
// _layerdata.highcolor=blue;
|
||||
|
||||
_layerdata.highcolor=blue;
|
||||
_layerdata.highcolor=_colors->document_background;
|
||||
_driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh);
|
||||
|
||||
_driver->FillRect(_borderrect,&_layerdata,(int8*)&solidhigh);
|
||||
DrawFrame();
|
||||
@ -270,7 +271,7 @@ void WinDecorator::_DrawTab(BRect r)
|
||||
|
||||
// UpdateTitle(layer->name->String());
|
||||
|
||||
_layerdata.highcolor=tab_lowcol;
|
||||
_layerdata.highcolor=tab_highcol;
|
||||
_driver->FillRect(_tabrect.InsetByCopy(1,1),&_layerdata,(int8*)&solidhigh);
|
||||
|
||||
// Draw the buttons if we're supposed to
|
||||
@ -336,6 +337,11 @@ void WinDecorator::DrawBlendedRect(BRect r, bool down)
|
||||
_driver->StrokeRect(r,&_layerdata,(int8*)&solidhigh);
|
||||
}
|
||||
|
||||
void WinDecorator::_SetColors(void)
|
||||
{
|
||||
_SetFocus();
|
||||
}
|
||||
|
||||
void WinDecorator::_DrawFrame(BRect rect)
|
||||
{
|
||||
if(_look==B_NO_BORDER_WINDOW_LOOK)
|
||||
@ -397,4 +403,4 @@ extern "C" float get_decorator_version(void)
|
||||
extern "C" Decorator *instantiate_decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags)
|
||||
{
|
||||
return new WinDecorator(rect,wlook,wfeel,wflags);
|
||||
}
|
||||
}
|
@ -27,6 +27,7 @@ protected:
|
||||
void _DrawMinimize(BRect r);
|
||||
void _DoLayout(void);
|
||||
void _SetFocus(void);
|
||||
void _SetColors(void);
|
||||
void DrawBlendedRect(BRect r, bool down);
|
||||
uint32 taboffset;
|
||||
|
||||
@ -42,4 +43,4 @@ protected:
|
||||
int textoffset;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user