Modified ColorWell class to visually fit in with other GUI controls

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5424 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2003-11-20 22:57:20 +00:00
parent 329b5b99b6
commit ce09dfb8e6
3 changed files with 33 additions and 26 deletions
+14 -19
View File
@@ -88,17 +88,6 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
} }
AddChild(mb); AddChild(mb);
*/ */
BRect wellrect(0,0,20,20);
wellrect.OffsetTo(Bounds().Width()-(wellrect.Width()+10),25);
colorwell=new ColorWell(wellrect,new BMessage(COLOR_DROPPED));
AddChild(colorwell);
wellrect.OffsetTo(10,25);
wellrect.right=colorwell->Frame().left - 20;
// colorset_label=new BStringView(wellrect,"colorset_label","Color Set: ");
// AddChild(colorset_label);
// colorset_label->ResizeToPreferred();
// Set up list of color attributes // Set up list of color attributes
BRect rect(10,10,200,100); BRect rect(10,10,200,100);
@@ -137,6 +126,13 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
attrlist->AddItem(new ColorWhichItem((color_which)B_INACTIVE_WINDOW_TAB_COLOR)); attrlist->AddItem(new ColorWhichItem((color_which)B_INACTIVE_WINDOW_TAB_COLOR));
attrlist->AddItem(new ColorWhichItem((color_which)B_INACTIVE_WINDOW_TAB_TEXT_COLOR)); attrlist->AddItem(new ColorWhichItem((color_which)B_INACTIVE_WINDOW_TAB_TEXT_COLOR));
BRect wellrect(0,0,50,50);
wellrect.OffsetTo(rect.right + 42,25);
colorwell=new ColorWell(wellrect,new BMessage(COLOR_DROPPED),true);
AddChild(colorwell);
picker=new BColorControl(BPoint(10,scrollview->Frame().bottom+20),B_CELLS_32x8,5.0,"Picker", picker=new BColorControl(BPoint(10,scrollview->Frame().bottom+20),B_CELLS_32x8,5.0,"Picker",
new BMessage(UPDATE_COLOR)); new BMessage(UPDATE_COLOR));
AddChild(picker); AddChild(picker);
@@ -320,7 +316,6 @@ void APRView::MessageReceived(BMessage *msg)
if(!revert->IsEnabled()) if(!revert->IsEnabled())
revert->SetEnabled(true); revert->SetEnabled(true);
// SetColorSetName("<untitled>");
Window()->PostMessage(SET_UI_COLORS); Window()->PostMessage(SET_UI_COLORS);
break; break;
} }
@@ -379,7 +374,6 @@ void APRView::MessageReceived(BMessage *msg)
defaults->SetEnabled(false); defaults->SetEnabled(false);
revert->SetEnabled(false); revert->SetEnabled(false);
// SetColorSetName(currentset->name.String());
Window()->PostMessage(SET_UI_COLORS); Window()->PostMessage(SET_UI_COLORS);
break; break;
} }
@@ -404,9 +398,9 @@ void APRView::MessageReceived(BMessage *msg)
} }
} }
/*
BMenu *APRView::LoadColorSets(void) BMenu *APRView::LoadColorSets(void)
{ {
STRACE(("Loading color sets from disk\n")); STRACE(("Loading color sets from disk\n"));
// This function populates the member menu *colorset_menu with the color // This function populates the member menu *colorset_menu with the color
@@ -482,7 +476,7 @@ BMenu *APRView::LoadColorSets(void)
return menu; return menu;
} }
/* int32 count=dir.CountEntries(); int32 count=dir.CountEntries();
BMessage *msg; BMessage *msg;
for(int32 i=0;i<count;i++) for(int32 i=0;i<count;i++)
@@ -497,9 +491,10 @@ BMenu *APRView::LoadColorSets(void)
msg->AddString("name",name); msg->AddString("name",name);
menu->AddItem(new BMenuItem(name.String(),msg)); menu->AddItem(new BMenuItem(name.String(),msg));
} }
*/
return menu; return menu;
} }
*/
void APRView::LoadColorSet(const BString &name) void APRView::LoadColorSet(const BString &name)
{ {
@@ -589,9 +584,9 @@ void APRView::SetColorSetName(const char *name)
BString namestr("Color Set: "); BString namestr("Color Set: ");
currentset->name.SetTo(name); currentset->name.SetTo(name);
namestr+=name; namestr+=name;
colorset_label->SetText(namestr.String()); colorwell_label->SetText(namestr.String());
colorset_label->ResizeToPreferred(); colorwell_label->ResizeToPreferred();
colorset_label->Invalidate(); colorwell_label->Invalidate();
} }
*/ */
void APRView::SaveSettings(void) void APRView::SaveSettings(void)
+1 -6
View File
@@ -61,19 +61,14 @@ public:
protected: protected:
friend APRWindow; friend APRWindow;
void UpdateControlsFromAttr(const char *string); void UpdateControlsFromAttr(const char *string);
BMenu *LoadColorSets(void); // BMenu *LoadColorSets(void);
// void SaveColorSet(const BString &name);
void LoadColorSet(const BString &name); void LoadColorSet(const BString &name);
// void SetColorSetName(const char *name);
BColorControl *picker; BColorControl *picker;
BButton *apply,*revert,*defaults; BButton *apply,*revert,*defaults;
BListView *attrlist; BListView *attrlist;
color_which attribute; color_which attribute;
BString attrstring; BString attrstring;
BScrollView *scrollview; BScrollView *scrollview;
// BStringView *colorset_label;
// BMenu *colorset_menu,*settings_menu;
// BFilePanel *savepanel;
ColorWell *colorwell; ColorWell *colorwell;
ColorSet *currentset,*prevset; ColorSet *currentset,*prevset;
+18 -1
View File
@@ -110,7 +110,24 @@ void ColorWell::Draw(BRect update)
{ {
FillRect(Bounds()); FillRect(Bounds());
if(is_enabled) if(is_enabled)
StrokeRect(Bounds(),B_SOLID_LOW); {
BRect r(Bounds());
SetHighColor(184,184,184);
StrokeRect(r);
SetHighColor(255,255,255);
StrokeLine(BPoint(r.right,r.top+1), r.RightBottom());
r.InsetBy(1,1);
SetHighColor(216,216,216);
StrokeLine(r.RightTop(), r.RightBottom());
SetHighColor(96,96,96);
StrokeLine(r.LeftTop(), r.RightTop());
StrokeLine(r.LeftTop(), r.LeftBottom());
}
} }
else else
{ {