Updated style to come pretty close to matching OT style guidelines
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19158 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,43 +1,24 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: APRMain.cpp
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: Main file for Appearance
|
||||
//
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2002-2006, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm ([email protected])
|
||||
*/
|
||||
#include "APRMain.h"
|
||||
#include "APRWindow.h"
|
||||
#include <stdio.h>
|
||||
#include "defs.h"
|
||||
|
||||
APRApplication::APRApplication(void)
|
||||
: BApplication(APPEARANCE_APP_SIGNATURE)
|
||||
: BApplication(APPEARANCE_APP_SIGNATURE)
|
||||
{
|
||||
fWindow=new APRWindow( BRect(100,100,540,390) );
|
||||
fWindow = new APRWindow(BRect(100,100,540,390));
|
||||
fWindow->Show();
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
int
|
||||
main(int, char**)
|
||||
{
|
||||
APRApplication myApplication;
|
||||
myApplication.Run();
|
||||
|
||||
@@ -1,32 +1,12 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: APRMain.h
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: Main header for Appearance
|
||||
//
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef APR_WORLD_H
|
||||
#define APR_WORLD_H
|
||||
/*
|
||||
* Copyright 2002-2006, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm ([email protected])
|
||||
*/
|
||||
#ifndef APR_MAIN_H
|
||||
#define APR_MAIN_H
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
|
||||
@@ -1,33 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: APRView.cpp
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: color handler for the app
|
||||
//
|
||||
// Handles all the grunt work. Color settings are stored in a BMessage to
|
||||
// allow for easy transition to and from disk. The messy details are in the
|
||||
// hard-coded strings to translate the enumerated color_which defines to
|
||||
// strings and such, but even those should be easy to maintain.
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2002-2006, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm ([email protected])
|
||||
*/
|
||||
#include <OS.h>
|
||||
#include <Directory.h>
|
||||
#include <Alert.h>
|
||||
@@ -59,160 +36,157 @@ APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
// Set up list of color attributes
|
||||
// Set up list of color fAttributes
|
||||
BRect rect(10,10,200,85);
|
||||
attrlist = new BListView(rect,"AttributeList");
|
||||
fAttrList = new BListView(rect,"AttributeList");
|
||||
|
||||
scrollview = new BScrollView("ScrollView",attrlist, B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
fScrollView = new BScrollView("ScrollView",fAttrList, B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
0, false, true);
|
||||
AddChild(scrollview);
|
||||
scrollview->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
AddChild(fScrollView);
|
||||
fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
attrlist->SetSelectionMessage(new BMessage(ATTRIBUTE_CHOSEN));
|
||||
fAttrList->SetSelectionMessage(new BMessage(ATTRIBUTE_CHOSEN));
|
||||
|
||||
attrlist->AddItem(new ColorWhichItem(B_PANEL_BACKGROUND_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_PANEL_TEXT_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_DOCUMENT_BACKGROUND_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_DOCUMENT_TEXT_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_CONTROL_BACKGROUND_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_CONTROL_TEXT_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_CONTROL_BORDER_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_CONTROL_HIGHLIGHT_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_NAVIGATION_BASE_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_NAVIGATION_PULSE_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_SHINE_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_SHADOW_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem(B_MENU_BACKGROUND_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_MENU_SELECTED_BACKGROUND_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem(B_MENU_ITEM_TEXT_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem(B_MENU_SELECTED_ITEM_TEXT_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_MENU_SELECTED_BORDER_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_TOOLTIP_BACKGROUND_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem(B_PANEL_BACKGROUND_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_PANEL_TEXT_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_DOCUMENT_BACKGROUND_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_DOCUMENT_TEXT_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_CONTROL_BACKGROUND_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_CONTROL_TEXT_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_CONTROL_BORDER_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_CONTROL_HIGHLIGHT_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_NAVIGATION_BASE_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_NAVIGATION_PULSE_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_SHINE_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_SHADOW_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem(B_MENU_BACKGROUND_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_MENU_SELECTED_BACKGROUND_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem(B_MENU_ITEM_TEXT_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem(B_MENU_SELECTED_ITEM_TEXT_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_MENU_SELECTED_BORDER_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_TOOLTIP_BACKGROUND_COLOR));
|
||||
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_SUCCESS_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_FAILURE_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem(B_WINDOW_TAB_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_WINDOW_TAB_TEXT_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_INACTIVE_WINDOW_TAB_COLOR));
|
||||
attrlist->AddItem(new ColorWhichItem((color_which)B_INACTIVE_WINDOW_TAB_TEXT_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_SUCCESS_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_FAILURE_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem(B_WINDOW_TAB_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_WINDOW_TAB_TEXT_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_INACTIVE_WINDOW_TAB_COLOR));
|
||||
fAttrList->AddItem(new ColorWhichItem((color_which)B_INACTIVE_WINDOW_TAB_TEXT_COLOR));
|
||||
|
||||
|
||||
BRect wellrect(0,0,50,50);
|
||||
wellrect.OffsetTo(rect.right + 30, rect.top +
|
||||
(scrollview->Bounds().Height() - wellrect.Height())/2 );
|
||||
(fScrollView->Bounds().Height() - wellrect.Height())/2 );
|
||||
|
||||
colorwell = new ColorWell(wellrect,new BMessage(COLOR_DROPPED),true);
|
||||
AddChild(colorwell);
|
||||
fColorWell = new ColorWell(wellrect,new BMessage(COLOR_DROPPED),true);
|
||||
AddChild(fColorWell);
|
||||
|
||||
// Center the list and color well
|
||||
|
||||
rect = scrollview->Frame();
|
||||
rect = fScrollView->Frame();
|
||||
rect.right = wellrect.right;
|
||||
rect.OffsetTo((Bounds().Width()-rect.Width())/2,rect.top);
|
||||
|
||||
picker = new BColorControl(BPoint(10,scrollview->Frame().bottom+20),B_CELLS_32x8,5.0,"Picker",
|
||||
fPicker = new BColorControl(BPoint(10,fScrollView->Frame().bottom+20),B_CELLS_32x8,5.0,"fPicker",
|
||||
new BMessage(UPDATE_COLOR));
|
||||
AddChild(picker);
|
||||
AddChild(fPicker);
|
||||
|
||||
defaults = new BButton(BRect(0,0,1,1),"DefaultsButton","Defaults",
|
||||
fDefaults = new BButton(BRect(0,0,1,1),"DefaultsButton","Defaults",
|
||||
new BMessage(DEFAULT_SETTINGS),
|
||||
B_FOLLOW_LEFT |B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
|
||||
defaults->ResizeToPreferred();
|
||||
defaults->MoveTo((picker->Frame().right-(defaults->Frame().Width()*2)-20)/2,picker->Frame().bottom+20);
|
||||
AddChild(defaults);
|
||||
fDefaults->ResizeToPreferred();
|
||||
fDefaults->MoveTo((fPicker->Frame().right-(fDefaults->Frame().Width()*2)-20)/2,fPicker->Frame().bottom+20);
|
||||
AddChild(fDefaults);
|
||||
|
||||
|
||||
BRect cvrect(defaults->Frame());
|
||||
BRect cvrect(fDefaults->Frame());
|
||||
cvrect.OffsetBy(cvrect.Width() + 20,0);
|
||||
|
||||
revert = new BButton(cvrect,"RevertButton","Revert",
|
||||
fRevert = new BButton(cvrect,"RevertButton","Revert",
|
||||
new BMessage(REVERT_SETTINGS),
|
||||
B_FOLLOW_LEFT |B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
|
||||
AddChild(revert);
|
||||
revert->SetEnabled(false);
|
||||
AddChild(fRevert);
|
||||
fRevert->SetEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
APRView::~APRView(void)
|
||||
{
|
||||
ColorSet::SaveColorSet("/boot/home/config/settings/app_server/system_colors",currentset);
|
||||
ColorSet::SaveColorSet("/boot/home/config/settings/app_server/system_colors",fCurrentSet);
|
||||
}
|
||||
|
||||
void APRView::AttachedToWindow(void)
|
||||
void
|
||||
APRView::AttachedToWindow(void)
|
||||
{
|
||||
picker->SetTarget(this);
|
||||
attrlist->SetTarget(this);
|
||||
defaults->SetTarget(this);
|
||||
revert->SetTarget(this);
|
||||
colorwell->SetTarget(this);
|
||||
fPicker->SetTarget(this);
|
||||
fAttrList->SetTarget(this);
|
||||
fDefaults->SetTarget(this);
|
||||
fRevert->SetTarget(this);
|
||||
fColorWell->SetTarget(this);
|
||||
|
||||
picker->SetValue(currentset.StringToColor(attrstring.String()));
|
||||
fPicker->SetValue(fCurrentSet.StringToColor(fAttrString.String()));
|
||||
|
||||
Window()->ResizeTo(MAX(picker->Frame().right,picker->Frame().right) + 10,
|
||||
defaults->Frame().bottom + 10);
|
||||
Window()->ResizeTo(MAX(fPicker->Frame().right,fPicker->Frame().right) + 10,
|
||||
fDefaults->Frame().bottom + 10);
|
||||
LoadSettings();
|
||||
attrlist->Select(0);
|
||||
fAttrList->Select(0);
|
||||
}
|
||||
|
||||
void APRView::MessageReceived(BMessage *msg)
|
||||
void
|
||||
APRView::MessageReceived(BMessage *msg)
|
||||
{
|
||||
if(msg->WasDropped())
|
||||
{
|
||||
if(msg->WasDropped()) {
|
||||
rgb_color *col;
|
||||
ssize_t size;
|
||||
if(msg->FindData("RGBColor",(type_code)'RGBC',(const void**)&col,&size)==B_OK)
|
||||
{
|
||||
picker->SetValue(*col);
|
||||
colorwell->SetColor(*col);
|
||||
colorwell->Invalidate();
|
||||
|
||||
if(msg->FindData("RGBColor",(type_code)'RGBC',(const void**)&col,&size)==B_OK) {
|
||||
fPicker->SetValue(*col);
|
||||
fColorWell->SetColor(*col);
|
||||
fColorWell->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
switch(msg->what)
|
||||
{
|
||||
case UPDATE_COLOR:
|
||||
{
|
||||
// Received from the color picker when its color changes
|
||||
switch(msg->what) {
|
||||
case UPDATE_COLOR: {
|
||||
// Received from the color fPicker when its color changes
|
||||
|
||||
rgb_color col=picker->ValueAsColor();
|
||||
rgb_color col=fPicker->ValueAsColor();
|
||||
|
||||
colorwell->SetColor(col);
|
||||
colorwell->Invalidate();
|
||||
fColorWell->SetColor(col);
|
||||
fColorWell->Invalidate();
|
||||
|
||||
// Update current attribute in the settings
|
||||
currentset.SetColor(attrstring.String(),col);
|
||||
// Update current fAttribute in the settings
|
||||
fCurrentSet.SetColor(fAttrString.String(),col);
|
||||
|
||||
revert->SetEnabled(true);
|
||||
fRevert->SetEnabled(true);
|
||||
|
||||
break;
|
||||
}
|
||||
case ATTRIBUTE_CHOSEN:
|
||||
{
|
||||
// Received when the user chooses a GUI attribute from the list
|
||||
case ATTRIBUTE_CHOSEN: {
|
||||
// Received when the user chooses a GUI fAttribute from the list
|
||||
|
||||
ColorWhichItem *whichitem = (ColorWhichItem*)attrlist->ItemAt( attrlist->CurrentSelection() );
|
||||
ColorWhichItem *whichitem = (ColorWhichItem*)
|
||||
fAttrList->ItemAt(fAttrList->CurrentSelection());
|
||||
|
||||
if(!whichitem)
|
||||
break;
|
||||
|
||||
attrstring=whichitem->Text();
|
||||
fAttrString=whichitem->Text();
|
||||
UpdateControlsFromAttr(whichitem->Text());
|
||||
break;
|
||||
}
|
||||
case REVERT_SETTINGS:
|
||||
{
|
||||
currentset=prevset;
|
||||
UpdateControlsFromAttr(attrstring.String());
|
||||
case REVERT_SETTINGS: {
|
||||
fCurrentSet=fPrevSet;
|
||||
UpdateControlsFromAttr(fAttrString.String());
|
||||
|
||||
revert->SetEnabled(false);
|
||||
fRevert->SetEnabled(false);
|
||||
|
||||
break;
|
||||
}
|
||||
case DEFAULT_SETTINGS:
|
||||
{
|
||||
currentset.SetToDefaults();
|
||||
case DEFAULT_SETTINGS: {
|
||||
fCurrentSet.SetToDefaults();
|
||||
|
||||
UpdateControlsFromAttr(attrstring.String());
|
||||
UpdateControlsFromAttr(fAttrString.String());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -227,16 +201,15 @@ void APRView::LoadSettings(void)
|
||||
// getting them from the server at this point for testing purposes.
|
||||
|
||||
// Query the server for the current settings
|
||||
//BPrivate::get_system_colors(¤tset);
|
||||
//BPrivate::get_system_colors(&fCurrentSet);
|
||||
|
||||
// TODO: remove this and enable the get_system_colors() call
|
||||
if(ColorSet::LoadColorSet("/boot/home/config/settings/app_server/system_colors",¤tset)!=B_OK)
|
||||
{
|
||||
currentset.SetToDefaults();
|
||||
ColorSet::SaveColorSet("/boot/home/config/settings/app_server/system_colors",currentset);
|
||||
if(ColorSet::LoadColorSet("/boot/home/config/settings/app_server/system_colors",&fCurrentSet)!=B_OK) {
|
||||
fCurrentSet.SetToDefaults();
|
||||
ColorSet::SaveColorSet("/boot/home/config/settings/app_server/system_colors",fCurrentSet);
|
||||
}
|
||||
|
||||
prevset = currentset;
|
||||
fPrevSet = fCurrentSet;
|
||||
}
|
||||
|
||||
void APRView::UpdateControlsFromAttr(const char *string)
|
||||
@@ -245,7 +218,7 @@ void APRView::UpdateControlsFromAttr(const char *string)
|
||||
return;
|
||||
STRACE(("Update color for %s\n",string));
|
||||
|
||||
picker->SetValue(currentset.StringToColor(string));
|
||||
colorwell->SetColor(picker->ValueAsColor());
|
||||
colorwell->Invalidate();
|
||||
fPicker->SetValue(fCurrentSet.StringToColor(string));
|
||||
fColorWell->SetColor(fPicker->ValueAsColor());
|
||||
fColorWell->Invalidate();
|
||||
}
|
||||
|
||||
@@ -1,29 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: APRView.cpp
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: color handler for the app
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2002-2006, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm ([email protected])
|
||||
*/
|
||||
#ifndef APR_VIEW_H_
|
||||
#define APR_VIEW_H_
|
||||
|
||||
@@ -62,23 +43,23 @@ protected:
|
||||
|
||||
void UpdateControlsFromAttr(const char *string);
|
||||
|
||||
BColorControl *picker;
|
||||
BColorControl *fPicker;
|
||||
|
||||
BButton *revert;
|
||||
BButton *defaults;
|
||||
BButton *fRevert;
|
||||
BButton *fDefaults;
|
||||
|
||||
BListView *attrlist;
|
||||
BListView *fAttrList;
|
||||
|
||||
color_which attribute;
|
||||
color_which fAttribute;
|
||||
|
||||
BString attrstring;
|
||||
BString fAttrString;
|
||||
|
||||
BScrollView *scrollview;
|
||||
BScrollView *fScrollView;
|
||||
|
||||
ColorWell *colorwell;
|
||||
ColorWell *fColorWell;
|
||||
|
||||
ColorSet currentset;
|
||||
ColorSet prevset;
|
||||
ColorSet fCurrentSet;
|
||||
ColorSet fPrevSet;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,45 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: APRWindow.cpp
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: basic Window class for Appearance
|
||||
//
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2002-2006, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm ([email protected])
|
||||
*/
|
||||
|
||||
#include <Messenger.h>
|
||||
#include "APRWindow.h"
|
||||
#include "APRView.h"
|
||||
#include "defs.h"
|
||||
#include <TabView.h>
|
||||
|
||||
APRWindow::APRWindow(BRect frame)
|
||||
: BWindow(frame, "Appearance", B_TITLED_WINDOW,
|
||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE, B_ALL_WORKSPACES )
|
||||
: BWindow(frame, "Appearance", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE,
|
||||
B_ALL_WORKSPACES )
|
||||
{
|
||||
APRView *colorview=new APRView(Bounds(),"Colors",B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
APRView *colorview = new APRView(Bounds(),"Colors",B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
AddChild(colorview);
|
||||
}
|
||||
|
||||
bool APRWindow::QuitRequested()
|
||||
bool
|
||||
APRWindow::QuitRequested(void)
|
||||
{
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
return(true);
|
||||
|
||||
@@ -1,30 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: APRWindow.h
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: basic Window class for Appearance
|
||||
//
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2002-2006, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm ([email protected])
|
||||
*/
|
||||
#ifndef APR_WINDOW_H
|
||||
#define APR_WINDOW_H
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
* Stephan Aßmus <[email protected]>
|
||||
*/
|
||||
|
||||
/** Class for encapsulating GUI system colors */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <Message.h>
|
||||
@@ -18,7 +16,6 @@
|
||||
#include <String.h>
|
||||
#include "ColorSet.h"
|
||||
|
||||
|
||||
static void
|
||||
set_rgb_color(rgb_color& color, uint8 red, uint8 green, uint8 blue)
|
||||
{
|
||||
@@ -325,8 +322,7 @@ rgb_color
|
||||
ColorSet::StringToColor(const char *string)
|
||||
{
|
||||
rgb_color *col=StringToMember(string);
|
||||
if(!col)
|
||||
{
|
||||
if(!col) {
|
||||
rgb_color c;
|
||||
return c;
|
||||
}
|
||||
@@ -403,117 +399,95 @@ ColorSet::StringToMember(const char *string)
|
||||
rgb_color
|
||||
ColorSet::AttributeToColor(int32 which)
|
||||
{
|
||||
switch(which)
|
||||
{
|
||||
case B_PANEL_BACKGROUND_COLOR:
|
||||
{
|
||||
switch(which) {
|
||||
case B_PANEL_BACKGROUND_COLOR: {
|
||||
return panel_background;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef HAIKU_TARGET_PLATFORM_BEOS
|
||||
case B_PANEL_TEXT_COLOR:
|
||||
{
|
||||
case B_PANEL_TEXT_COLOR: {
|
||||
return panel_text;
|
||||
break;
|
||||
}
|
||||
case B_DOCUMENT_BACKGROUND_COLOR:
|
||||
{
|
||||
case B_DOCUMENT_BACKGROUND_COLOR: {
|
||||
return document_background;
|
||||
break;
|
||||
}
|
||||
case B_DOCUMENT_TEXT_COLOR:
|
||||
{
|
||||
case B_DOCUMENT_TEXT_COLOR: {
|
||||
return document_text;
|
||||
break;
|
||||
}
|
||||
case B_CONTROL_BACKGROUND_COLOR:
|
||||
{
|
||||
case B_CONTROL_BACKGROUND_COLOR: {
|
||||
return control_background;
|
||||
break;
|
||||
}
|
||||
case B_CONTROL_TEXT_COLOR:
|
||||
{
|
||||
case B_CONTROL_TEXT_COLOR: {
|
||||
return control_text;
|
||||
break;
|
||||
}
|
||||
case B_CONTROL_BORDER_COLOR:
|
||||
{
|
||||
case B_CONTROL_BORDER_COLOR: {
|
||||
return control_border;
|
||||
break;
|
||||
}
|
||||
case B_CONTROL_HIGHLIGHT_COLOR:
|
||||
{
|
||||
case B_CONTROL_HIGHLIGHT_COLOR: {
|
||||
return control_highlight;
|
||||
break;
|
||||
}
|
||||
case B_NAVIGATION_BASE_COLOR:
|
||||
{
|
||||
case B_NAVIGATION_BASE_COLOR: {
|
||||
return keyboard_navigation_base;
|
||||
break;
|
||||
}
|
||||
case B_NAVIGATION_PULSE_COLOR:
|
||||
{
|
||||
case B_NAVIGATION_PULSE_COLOR: {
|
||||
return keyboard_navigation_pulse;
|
||||
break;
|
||||
}
|
||||
case B_SHINE_COLOR:
|
||||
{
|
||||
case B_SHINE_COLOR: {
|
||||
return shine;
|
||||
break;
|
||||
}
|
||||
case B_SHADOW_COLOR:
|
||||
{
|
||||
case B_SHADOW_COLOR: {
|
||||
return shadow;
|
||||
break;
|
||||
}
|
||||
case B_MENU_SELECTED_BACKGROUND_COLOR:
|
||||
{
|
||||
case B_MENU_SELECTED_BACKGROUND_COLOR: {
|
||||
return menu_selected_background;
|
||||
break;
|
||||
}
|
||||
case B_MENU_SELECTED_BORDER_COLOR:
|
||||
{
|
||||
case B_MENU_SELECTED_BORDER_COLOR: {
|
||||
return menu_selected_border;
|
||||
break;
|
||||
}
|
||||
case B_TOOLTIP_BACKGROUND_COLOR:
|
||||
{
|
||||
case B_TOOLTIP_BACKGROUND_COLOR: {
|
||||
return tooltip_background;
|
||||
break;
|
||||
}
|
||||
case B_TOOLTIP_TEXT_COLOR:
|
||||
{
|
||||
case B_TOOLTIP_TEXT_COLOR: {
|
||||
return tooltip_text;
|
||||
break;
|
||||
}
|
||||
case B_SUCCESS_COLOR:
|
||||
{
|
||||
case B_SUCCESS_COLOR: {
|
||||
return success;
|
||||
break;
|
||||
}
|
||||
case B_FAILURE_COLOR:
|
||||
{
|
||||
case B_FAILURE_COLOR: {
|
||||
return failure;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case B_MENU_BACKGROUND_COLOR:
|
||||
{
|
||||
case B_MENU_BACKGROUND_COLOR: {
|
||||
return menu_background;
|
||||
break;
|
||||
}
|
||||
case B_MENU_ITEM_TEXT_COLOR:
|
||||
{
|
||||
case B_MENU_ITEM_TEXT_COLOR: {
|
||||
return menu_text;
|
||||
break;
|
||||
}
|
||||
case B_MENU_SELECTED_ITEM_TEXT_COLOR:
|
||||
{
|
||||
case B_MENU_SELECTED_ITEM_TEXT_COLOR: {
|
||||
return menu_selected_text;
|
||||
break;
|
||||
}
|
||||
case B_WINDOW_TAB_COLOR:
|
||||
{
|
||||
case B_WINDOW_TAB_COLOR: {
|
||||
return window_tab;
|
||||
break;
|
||||
}
|
||||
@@ -521,24 +495,20 @@ ColorSet::AttributeToColor(int32 which)
|
||||
// DANGER! DANGER, WILL ROBINSON!!
|
||||
// These are magic numbers to work around compatibility difficulties while still keeping
|
||||
// functionality. This __will__ break following R1
|
||||
case 22:
|
||||
{
|
||||
case 22: {
|
||||
return window_tab_text;
|
||||
break;
|
||||
}
|
||||
case 23:
|
||||
{
|
||||
case 23: {
|
||||
return inactive_window_tab;
|
||||
break;
|
||||
}
|
||||
case 24:
|
||||
{
|
||||
case 24: {
|
||||
return inactive_window_tab_text;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
default: {
|
||||
rgb_color c;
|
||||
return c;
|
||||
break;
|
||||
@@ -549,7 +519,8 @@ ColorSet::AttributeToColor(int32 which)
|
||||
void
|
||||
ColorSet::PrintMember(const rgb_color &color) const
|
||||
{
|
||||
printf("rgb_color(%d, %d, %d, %d)", color.red,color.green,color.blue,color.alpha);
|
||||
printf("rgb_color(%d, %d, %d, %d)",color.red,color.green,color.blue,
|
||||
color.alpha);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,33 +1,14 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: ColorWell.cpp
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: Color display class which accepts drops
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2002-2006, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm ([email protected])
|
||||
*/
|
||||
#include "ColorWell.h"
|
||||
|
||||
ColorWell::ColorWell(BRect frame, BMessage *msg, bool is_rectangle=false)
|
||||
: BView(frame,"ColorWell", B_FOLLOW_LEFT|B_FOLLOW_TOP, B_WILL_DRAW)
|
||||
ColorWell::ColorWell(BRect frame, BMessage *msg, bool is_rectangle)
|
||||
: BView(frame,"ColorWell", B_FOLLOW_LEFT|B_FOLLOW_TOP, B_WILL_DRAW)
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
SetLowColor(0,0,0);
|
||||
@@ -45,42 +26,43 @@ ColorWell::~ColorWell(void)
|
||||
delete invoker;
|
||||
}
|
||||
|
||||
void ColorWell::SetTarget(BHandler *tgt)
|
||||
void
|
||||
ColorWell::SetTarget(BHandler *tgt)
|
||||
{
|
||||
invoker->SetTarget(tgt);
|
||||
}
|
||||
|
||||
void ColorWell::SetColor(rgb_color col)
|
||||
void
|
||||
ColorWell::SetColor(rgb_color col)
|
||||
{
|
||||
SetHighColor(col);
|
||||
currentcol=col;
|
||||
Draw(Bounds());
|
||||
// Invalidate();
|
||||
invoker->Invoke();
|
||||
}
|
||||
|
||||
void ColorWell::SetColor(uint8 r,uint8 g, uint8 b)
|
||||
void
|
||||
ColorWell::SetColor(uint8 r,uint8 g, uint8 b)
|
||||
{
|
||||
SetHighColor(r,g,b);
|
||||
currentcol.red=r;
|
||||
currentcol.green=g;
|
||||
currentcol.blue=b;
|
||||
Draw(Bounds());
|
||||
//Invalidate();
|
||||
invoker->Invoke();
|
||||
}
|
||||
|
||||
void ColorWell::MessageReceived(BMessage *msg)
|
||||
void
|
||||
ColorWell::MessageReceived(BMessage *msg)
|
||||
{
|
||||
// If we received a dropped message, try to see if it has color data
|
||||
// in it
|
||||
if(msg->WasDropped())
|
||||
{
|
||||
if(msg->WasDropped()) {
|
||||
rgb_color *col;
|
||||
uint8 *ptr;
|
||||
ssize_t size;
|
||||
if(msg->FindData("RGBColor",(type_code)'RGBC',(const void**)&ptr,&size)==B_OK)
|
||||
{
|
||||
if(msg->FindData("RGBColor",(type_code)'RGBC',
|
||||
(const void**)&ptr,&size)==B_OK) {
|
||||
col=(rgb_color*)ptr;
|
||||
SetHighColor(*col);
|
||||
}
|
||||
@@ -90,27 +72,26 @@ void ColorWell::MessageReceived(BMessage *msg)
|
||||
BView::MessageReceived(msg);
|
||||
}
|
||||
|
||||
void ColorWell::SetEnabled(bool value)
|
||||
void
|
||||
ColorWell::SetEnabled(bool value)
|
||||
{
|
||||
if(is_enabled!=value)
|
||||
{
|
||||
if(is_enabled!=value) {
|
||||
is_enabled=value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
void ColorWell::Draw(BRect update)
|
||||
void
|
||||
ColorWell::Draw(BRect update)
|
||||
{
|
||||
if(is_enabled)
|
||||
SetHighColor(currentcol);
|
||||
else
|
||||
SetHighColor(disabledcol);
|
||||
|
||||
if(is_rect)
|
||||
{
|
||||
if(is_rect) {
|
||||
FillRect(Bounds());
|
||||
if(is_enabled)
|
||||
{
|
||||
if(is_enabled) {
|
||||
BRect r(Bounds());
|
||||
SetHighColor(184,184,184);
|
||||
StrokeRect(r);
|
||||
@@ -129,20 +110,21 @@ void ColorWell::Draw(BRect update)
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FillEllipse(Bounds());
|
||||
if(is_enabled)
|
||||
StrokeEllipse(Bounds(),B_SOLID_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
rgb_color ColorWell::Color(void) const
|
||||
rgb_color
|
||||
ColorWell::Color(void) const
|
||||
{
|
||||
return currentcol;
|
||||
}
|
||||
|
||||
void ColorWell::SetMode(bool is_rectangle)
|
||||
void
|
||||
ColorWell::SetMode(bool is_rectangle)
|
||||
{
|
||||
is_rect=is_rectangle;
|
||||
}
|
||||
|
||||
@@ -1,29 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: ColorWell.h
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: Color display class which accepts drops
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2002-2006, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm ([email protected])
|
||||
*/
|
||||
#ifndef COLORWELL_H_
|
||||
#define COLORWELL_H_
|
||||
|
||||
|
||||
@@ -1,34 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: ColorWhichItem.cpp
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: ListItem class for managing color_which specifiers
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2002-2006, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm ([email protected])
|
||||
*/
|
||||
#include "ColorWhichItem.h"
|
||||
#include <stdio.h>
|
||||
|
||||
ColorWhichItem::ColorWhichItem(color_which which)
|
||||
: BStringItem(NULL,0,false)
|
||||
: BStringItem(NULL,0,false)
|
||||
{
|
||||
SetAttribute(which);
|
||||
}
|
||||
@@ -38,163 +19,137 @@ ColorWhichItem::~ColorWhichItem(void)
|
||||
// Empty, but exists for just-in-case
|
||||
}
|
||||
|
||||
void ColorWhichItem::SetAttribute(color_which which)
|
||||
void
|
||||
ColorWhichItem::SetAttribute(color_which which)
|
||||
{
|
||||
switch(which)
|
||||
{
|
||||
switch(which) {
|
||||
// cases not existing in R5 which exist in OpenBeOS
|
||||
case B_PANEL_BACKGROUND_COLOR:
|
||||
{
|
||||
case B_PANEL_BACKGROUND_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Panel Background");
|
||||
break;
|
||||
}
|
||||
case B_PANEL_TEXT_COLOR:
|
||||
{
|
||||
case B_PANEL_TEXT_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Panel Text");
|
||||
break;
|
||||
}
|
||||
case B_DOCUMENT_BACKGROUND_COLOR:
|
||||
{
|
||||
case B_DOCUMENT_BACKGROUND_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Document Background");
|
||||
break;
|
||||
}
|
||||
case B_DOCUMENT_TEXT_COLOR:
|
||||
{
|
||||
case B_DOCUMENT_TEXT_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Document Text");
|
||||
break;
|
||||
}
|
||||
case B_CONTROL_BACKGROUND_COLOR:
|
||||
{
|
||||
case B_CONTROL_BACKGROUND_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Control Background");
|
||||
break;
|
||||
}
|
||||
case B_CONTROL_TEXT_COLOR:
|
||||
{
|
||||
case B_CONTROL_TEXT_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Control Text");
|
||||
break;
|
||||
}
|
||||
case B_CONTROL_BORDER_COLOR:
|
||||
{
|
||||
case B_CONTROL_BORDER_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Control Border");
|
||||
break;
|
||||
}
|
||||
case B_CONTROL_HIGHLIGHT_COLOR:
|
||||
{
|
||||
case B_CONTROL_HIGHLIGHT_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Control Highlight");
|
||||
break;
|
||||
}
|
||||
case B_TOOLTIP_BACKGROUND_COLOR:
|
||||
{
|
||||
case B_TOOLTIP_BACKGROUND_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Tooltip Background");
|
||||
break;
|
||||
}
|
||||
case B_TOOLTIP_TEXT_COLOR:
|
||||
{
|
||||
case B_TOOLTIP_TEXT_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Tooltip Text");
|
||||
break;
|
||||
}
|
||||
case B_MENU_BACKGROUND_COLOR:
|
||||
{
|
||||
case B_MENU_BACKGROUND_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Menu Background");
|
||||
break;
|
||||
}
|
||||
case B_MENU_SELECTION_BACKGROUND_COLOR:
|
||||
{
|
||||
case B_MENU_SELECTION_BACKGROUND_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Selected Menu Item Background");
|
||||
break;
|
||||
}
|
||||
case B_MENU_ITEM_TEXT_COLOR:
|
||||
{
|
||||
case B_MENU_ITEM_TEXT_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Menu Item Text");
|
||||
break;
|
||||
}
|
||||
case B_MENU_SELECTED_ITEM_TEXT_COLOR:
|
||||
{
|
||||
case B_MENU_SELECTED_ITEM_TEXT_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Selected Menu Item Text");
|
||||
break;
|
||||
}
|
||||
case B_MENU_SELECTED_BORDER_COLOR:
|
||||
{
|
||||
case B_MENU_SELECTED_BORDER_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Selected Menu Item Border");
|
||||
break;
|
||||
}
|
||||
case B_NAVIGATION_BASE_COLOR:
|
||||
{
|
||||
case B_NAVIGATION_BASE_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Navigation Base");
|
||||
break;
|
||||
}
|
||||
case B_NAVIGATION_PULSE_COLOR:
|
||||
{
|
||||
case B_NAVIGATION_PULSE_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Navigation Pulse");
|
||||
break;
|
||||
}
|
||||
case B_SUCCESS_COLOR:
|
||||
{
|
||||
case B_SUCCESS_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Success");
|
||||
break;
|
||||
}
|
||||
case B_FAILURE_COLOR:
|
||||
{
|
||||
case B_FAILURE_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Failure");
|
||||
break;
|
||||
}
|
||||
case B_SHINE_COLOR:
|
||||
{
|
||||
case B_SHINE_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Shine");
|
||||
break;
|
||||
}
|
||||
case B_SHADOW_COLOR:
|
||||
{
|
||||
case B_SHADOW_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Shadow");
|
||||
break;
|
||||
}
|
||||
case B_WINDOW_TAB_COLOR:
|
||||
{
|
||||
case B_WINDOW_TAB_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Window Tab");
|
||||
break;
|
||||
}
|
||||
case B_WINDOW_TAB_TEXT_COLOR:
|
||||
{
|
||||
case B_WINDOW_TAB_TEXT_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Window Tab Text");
|
||||
break;
|
||||
}
|
||||
case B_INACTIVE_WINDOW_TAB_COLOR:
|
||||
{
|
||||
case B_INACTIVE_WINDOW_TAB_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Inactive Window Tab");
|
||||
break;
|
||||
}
|
||||
case B_INACTIVE_WINDOW_TAB_TEXT_COLOR:
|
||||
{
|
||||
case B_INACTIVE_WINDOW_TAB_TEXT_COLOR: {
|
||||
attribute=which;
|
||||
SetText("Inactive Window Tab Text");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
default: {
|
||||
printf("unknown code '%c%c%c%c'\n",(char)((which & 0xFF000000) >> 24),
|
||||
(char)((which & 0x00FF0000) >> 16),
|
||||
(char)((which & 0x0000FF00) >> 8),
|
||||
@@ -204,7 +159,8 @@ void ColorWhichItem::SetAttribute(color_which which)
|
||||
}
|
||||
}
|
||||
|
||||
color_which ColorWhichItem::GetAttribute(void)
|
||||
color_which
|
||||
ColorWhichItem::GetAttribute(void)
|
||||
{
|
||||
return attribute;
|
||||
}
|
||||
|
||||
@@ -1,29 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// 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: ColorWhichItem.h
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: ListItem class for managing color_which specifiers
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2001-2006, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <[email protected]>
|
||||
*/
|
||||
#ifndef COLORWHICH_ITEM_H
|
||||
#define COLORWHICH_ITEM_H
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright 2002-2006, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm ([email protected])
|
||||
*/
|
||||
#ifndef DEFS_H_
|
||||
#define DEFS_H_
|
||||
|
||||
@@ -10,7 +17,7 @@
|
||||
#define COLOR_SETTINGS_NAME "system_colors"
|
||||
*/
|
||||
|
||||
#define APPEARANCE_APP_SIGNATURE "application/x-vnd.obos-Appearance"
|
||||
#define APPEARANCE_APP_SIGNATURE "application/x-vnd.haiku-Appearance"
|
||||
|
||||
#define APPLY_SETTINGS 'aply'
|
||||
#define REVERT_SETTINGS 'rvrt'
|
||||
|
||||
Reference in New Issue
Block a user