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