OBOS-only system colors are loaded and used

Added _SetColors() hook function to Decorator API


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3889 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2003-07-07 13:09:42 +00:00
parent d5d9cf4017
commit dae7413e8a
5 changed files with 29 additions and 9 deletions

View File

@ -232,7 +232,7 @@ bool LoadGUIColors(ColorSet *set)
rgb_color *col; rgb_color *col;
ssize_t size; ssize_t size;
if(msg.FindData("Panel Background",(type_code)'RGBC',(const void**)&col,&size)==B_OK) if(msg.FindData("Background",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
set->panel_background=*col; set->panel_background=*col;
if(msg.FindData("Panel Text",(type_code)'RGBC',(const void**)&col,&size)==B_OK) if(msg.FindData("Panel Text",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
set->panel_text=*col; set->panel_text=*col;
@ -256,9 +256,9 @@ bool LoadGUIColors(ColorSet *set)
set->menu_background=*col; set->menu_background=*col;
if(msg.FindData("Selected Menu Item Background",(type_code)'RGBC',(const void**)&col,&size)==B_OK) if(msg.FindData("Selected Menu Item Background",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
set->menu_selected_background=*col; set->menu_selected_background=*col;
if(msg.FindData("Keyboard Navigation Base",(type_code)'RGBC',(const void**)&col,&size)==B_OK) if(msg.FindData("Navigation Base",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
set->keyboard_navigation_base=*col; set->keyboard_navigation_base=*col;
if(msg.FindData("Keyboard Navigation Pulse",(type_code)'RGBC',(const void**)&col,&size)==B_OK) if(msg.FindData("Navigation Pulse",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
set->keyboard_navigation_pulse=*col; set->keyboard_navigation_pulse=*col;
if(msg.FindData("Menu Item Text",(type_code)'RGBC',(const void**)&col,&size)==B_OK) if(msg.FindData("Menu Item Text",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
set->menu_text=*col; set->menu_text=*col;

View File

@ -44,6 +44,7 @@ Decorator::Decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags)
_close_state=false; _close_state=false;
_minimize_state=false; _minimize_state=false;
_zoom_state=false; _zoom_state=false;
_has_focus=false;
_title_string=new BString; _title_string=new BString;
_driver=NULL; _driver=NULL;
@ -84,6 +85,7 @@ Decorator::~Decorator(void)
void Decorator::SetColors(const ColorSet &cset) void Decorator::SetColors(const ColorSet &cset)
{ {
_colors->SetColors(cset); _colors->SetColors(cset);
_SetColors();
} }
/*! /*!
@ -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 \brief Returns the "footprint" of the entire window, including decorator
\return Region representing the window's screen footprint \return Region representing the window's screen footprint

View File

@ -110,6 +110,7 @@ protected:
virtual void _DrawZoom(BRect r); virtual void _DrawZoom(BRect r);
virtual void _SetFocus(void)=0; virtual void _SetFocus(void)=0;
virtual void _DoLayout(void)=0; virtual void _DoLayout(void)=0;
virtual void _SetColors(void);
ColorSet *_colors; ColorSet *_colors;
DisplayDriver *_driver; DisplayDriver *_driver;

View File

@ -66,8 +66,8 @@ DefaultDecorator::DefaultDecorator(BRect rect, int32 wlook, int32 wfeel, int32 w
solidhigh=0xFFFFFFFFFFFFFFFFLL; solidhigh=0xFFFFFFFFFFFFFFFFLL;
solidlow=0; solidlow=0;
tab_highcol=_colors->window_tab; // tab_highcol=_colors->window_tab;
tab_lowcol=_colors->window_tab; // tab_lowcol=_colors->window_tab;
#ifdef DEBUG_DECORATOR #ifdef DEBUG_DECORATOR
printf("DefaultDecorator:\n"); printf("DefaultDecorator:\n");
@ -278,8 +278,10 @@ void DefaultDecorator::_SetFocus(void)
} }
else else
{ {
tab_highcol.SetColor(235,235,235); // tab_highcol.SetColor(235,235,235);
tab_lowcol.SetColor(160,160,160); // tab_lowcol.SetColor(160,160,160);
tab_highcol=_colors->inactive_window_tab;
tab_lowcol=_colors->inactive_window_tab;
button_highcol.SetColor(229,229,229); button_highcol.SetColor(229,229,229);
button_lowcol.SetColor(153,153,153); button_lowcol.SetColor(153,153,153);
@ -353,7 +355,7 @@ void DefaultDecorator::_DrawTab(BRect r)
_layerdata.highcolor=frame_lowcol; _layerdata.highcolor=frame_lowcol;
_driver->StrokeRect(_tabrect,&_layerdata,(int8*)&solidhigh); _driver->StrokeRect(_tabrect,&_layerdata,(int8*)&solidhigh);
_layerdata.highcolor=_colors->window_tab; _layerdata.highcolor=tab_highcol;
_driver->FillRect(_tabrect.InsetByCopy(1,1),&_layerdata,(int8*)&solidhigh); _driver->FillRect(_tabrect.InsetByCopy(1,1),&_layerdata,(int8*)&solidhigh);
// UpdateTitle(layer->name->String()); // UpdateTitle(layer->name->String());
@ -366,6 +368,11 @@ void DefaultDecorator::_DrawTab(BRect r)
_DrawZoom(_zoomrect); _DrawZoom(_zoomrect);
} }
void DefaultDecorator::_SetColors(void)
{
_SetFocus();
}
void DefaultDecorator::DrawBlendedRect(BRect r, bool down) void DefaultDecorator::DrawBlendedRect(BRect r, bool down)
{ {
// This bad boy is used to draw a rectangle with a gradient. // This bad boy is used to draw a rectangle with a gradient.

View File

@ -42,7 +42,6 @@ public:
void Draw(void); void Draw(void);
BRegion *GetFootprint(void); BRegion *GetFootprint(void);
click_type Clicked(BPoint pt, int32 buttons, int32 modifiers); click_type Clicked(BPoint pt, int32 buttons, int32 modifiers);
protected: protected:
void _DrawClose(BRect r); void _DrawClose(BRect r);
void _DrawFrame(BRect r); void _DrawFrame(BRect r);
@ -51,6 +50,7 @@ protected:
void _DrawZoom(BRect r); void _DrawZoom(BRect r);
void _DoLayout(void); void _DoLayout(void);
void _SetFocus(void); void _SetFocus(void);
void _SetColors(void);
void DrawBlendedRect(BRect r, bool down); void DrawBlendedRect(BRect r, bool down);
uint32 taboffset; uint32 taboffset;