1*1b370545SJessica Hamilton /* 2*1b370545SJessica Hamilton * Copyright 2022, Haiku. All rights reserved. 3*1b370545SJessica Hamilton * Distributed under the terms of the MIT License. 4*1b370545SJessica Hamilton */ 5*1b370545SJessica Hamilton #ifndef THEME_VIEW_H 6*1b370545SJessica Hamilton #define THEME_VIEW_H 7*1b370545SJessica Hamilton 8*1b370545SJessica Hamilton 9*1b370545SJessica Hamilton #include <Button.h> 10*1b370545SJessica Hamilton #include <ColorControl.h> 11*1b370545SJessica Hamilton #include <GroupView.h> 12*1b370545SJessica Hamilton #include <ListItem.h> 13*1b370545SJessica Hamilton #include <ListView.h> 14*1b370545SJessica Hamilton #include <Menu.h> 15*1b370545SJessica Hamilton #include <MenuBar.h> 16*1b370545SJessica Hamilton #include <MenuField.h> 17*1b370545SJessica Hamilton #include <MenuItem.h> 18*1b370545SJessica Hamilton #include <Message.h> 19*1b370545SJessica Hamilton #include <Messenger.h> 20*1b370545SJessica Hamilton #include <ObjectList.h> 21*1b370545SJessica Hamilton #include <ScrollBar.h> 22*1b370545SJessica Hamilton #include <ScrollView.h> 23*1b370545SJessica Hamilton #include <String.h> 24*1b370545SJessica Hamilton #include <StringView.h> 25*1b370545SJessica Hamilton #include <View.h> 26*1b370545SJessica Hamilton 27*1b370545SJessica Hamilton #include "Colors.h" 28*1b370545SJessica Hamilton 29*1b370545SJessica Hamilton 30*1b370545SJessica Hamilton static const uint32 MSG_COLOR_SCHEME_CHANGED = 'mccs'; 31*1b370545SJessica Hamilton static const uint32 MSG_SET_CURRENT_COLOR = 'sccl'; 32*1b370545SJessica Hamilton static const uint32 MSG_UPDATE_COLOR = 'upcl'; 33*1b370545SJessica Hamilton static const uint32 MSG_COLOR_ATTRIBUTE_CHOSEN = 'atch'; 34*1b370545SJessica Hamilton static const uint32 MSG_THEME_MODIFIED = 'tmdf'; 35*1b370545SJessica Hamilton static const uint32 MSG_SET_COLOR = 'sclr'; 36*1b370545SJessica Hamilton 37*1b370545SJessica Hamilton static const char* const kRGBColor = "RGBColor"; 38*1b370545SJessica Hamilton static const char* const kName = "name"; 39*1b370545SJessica Hamilton 40*1b370545SJessica Hamilton class ThemeWindow; 41*1b370545SJessica Hamilton class ColorPreview; 42*1b370545SJessica Hamilton class BMenu; 43*1b370545SJessica Hamilton class BMenuField; 44*1b370545SJessica Hamilton class BPopUpMenu; 45*1b370545SJessica Hamilton class BTextView; 46*1b370545SJessica Hamilton 47*1b370545SJessica Hamilton class ThemeView : public BGroupView { 48*1b370545SJessica Hamilton public: 49*1b370545SJessica Hamilton ThemeView(const char *name, 50*1b370545SJessica Hamilton const BMessenger &messenger); 51*1b370545SJessica Hamilton virtual ~ThemeView(); 52*1b370545SJessica Hamilton 53*1b370545SJessica Hamilton virtual void AttachedToWindow(); 54*1b370545SJessica Hamilton virtual void WindowActivated(bool active); 55*1b370545SJessica Hamilton virtual void MessageReceived(BMessage *msg); 56*1b370545SJessica Hamilton 57*1b370545SJessica Hamilton void SetDefaults(); 58*1b370545SJessica Hamilton void Revert(); 59*1b370545SJessica Hamilton void UpdateMenu(); 60*1b370545SJessica Hamilton 61*1b370545SJessica Hamilton private: 62*1b370545SJessica Hamilton void _UpdateStyle(); 63*1b370545SJessica Hamilton void _ChangeColorScheme(color_scheme* scheme); 64*1b370545SJessica Hamilton void _SetCurrentColorScheme(); 65*1b370545SJessica Hamilton void _SetCurrentColor(rgb_color color); 66*1b370545SJessica Hamilton void _SetColor(const char* name, rgb_color color); 67*1b370545SJessica Hamilton 68*1b370545SJessica Hamilton void _MakeColorSchemeMenu(); 69*1b370545SJessica Hamilton void _MakeColorSchemeMenuItem(const color_scheme *item); 70*1b370545SJessica Hamilton 71*1b370545SJessica Hamilton private: 72*1b370545SJessica Hamilton BColorControl* fPicker; 73*1b370545SJessica Hamilton BListView* fAttrList; 74*1b370545SJessica Hamilton const char* fName; 75*1b370545SJessica Hamilton BScrollView* fScrollView; 76*1b370545SJessica Hamilton ColorPreview* fColorPreview; 77*1b370545SJessica Hamilton BMenuField* fColorSchemeField; 78*1b370545SJessica Hamilton BPopUpMenu* fColorSchemeMenu; 79*1b370545SJessica Hamilton BTextView* fPreview; 80*1b370545SJessica Hamilton 81*1b370545SJessica Hamilton BMessage fPrevColors; 82*1b370545SJessica Hamilton BMessage fDefaultColors; 83*1b370545SJessica Hamilton BMessage fCurrentColors; 84*1b370545SJessica Hamilton 85*1b370545SJessica Hamilton BMessenger fTerminalMessenger; 86*1b370545SJessica Hamilton 87*1b370545SJessica Hamilton public: 88*1b370545SJessica Hamilton static const char* kColorTable[]; 89*1b370545SJessica Hamilton }; 90*1b370545SJessica Hamilton 91*1b370545SJessica Hamilton #endif // THEME_VIEW_H 92