1 /* 2 * Copyright 2001-2010, Haiku, Inc. 3 * Copyright 2003-2004 Kian Duffy, myob@users.sourceforge.net 4 * Parts Copyright 1998-1999 Kazuho Okui and Takashi Murai. 5 * All rights reserved. Distributed under the terms of the MIT license. 6 */ 7 #ifndef APPEARANCE_PREF_VIEW_H 8 #define APPEARANCE_PREF_VIEW_H 9 10 11 #include <GroupView.h> 12 #include <Messenger.h> 13 #include <ObjectList.h> 14 #include <String.h> 15 16 17 static const uint32 MSG_HALF_FONT_CHANGED = 'mchf'; 18 static const uint32 MSG_HALF_SIZE_CHANGED = 'mchs'; 19 static const uint32 MSG_FULL_FONT_CHANGED = 'mcff'; 20 static const uint32 MSG_FULL_SIZE_CHANGED = 'mcfs'; 21 static const uint32 MSG_COLOR_FIELD_CHANGED = 'mccf'; 22 static const uint32 MSG_COLOR_CHANGED = 'mcbc'; 23 static const uint32 MSG_COLOR_SCHEME_CHANGED = 'mccs'; 24 25 static const uint32 MSG_TAB_TITLE_SETTING_CHANGED = 'mtts'; 26 static const uint32 MSG_WINDOW_TITLE_SETTING_CHANGED = 'mwts'; 27 static const uint32 MSG_BLINK_CURSOR_CHANGED = 'mbcc'; 28 static const uint32 MSG_ALLOW_BOLD_CHANGED = 'mabc'; 29 static const uint32 MSG_USE_OPTION_AS_META_CHANGED = 'momc'; 30 static const uint32 MSG_WARN_ON_EXIT_CHANGED = 'mwec'; 31 static const uint32 MSG_COLS_CHANGED = 'mccl'; 32 static const uint32 MSG_HISTORY_CHANGED = 'mhst'; 33 // TODO MSG_ENCODING_CHANGED? 34 35 static const uint32 MSG_PREF_MODIFIED = 'mpmo'; 36 37 38 struct color_scheme; 39 class BCheckBox; 40 class BColorControl; 41 class BMenu; 42 class BMenuField; 43 class BPopUpMenu; 44 class BTextControl; 45 46 47 class AppearancePrefView : public BGroupView { 48 public: 49 AppearancePrefView(const char* name, 50 const BMessenger &messenger); 51 52 virtual void Revert(); 53 virtual void MessageReceived(BMessage* message); 54 virtual void AttachedToWindow(); 55 56 private: 57 void _ChangeColorScheme(color_scheme* scheme); 58 void _SetCurrentColorScheme(); 59 void _SetEncoding(const char* encoding); 60 void _SetWindowSize(int rows, int cols); 61 62 static BMenu* _MakeFontMenu(uint32 command, 63 const char* defaultFamily, 64 const char* defaultStyle); 65 static BMenu* _MakeFontSizeMenu(const char* label, 66 uint32 command, 67 const char* family, 68 const char* style, 69 const char* size); 70 71 static BPopUpMenu* _MakeMenu(uint32 msg, const char** items, 72 const char* defaultItem); 73 74 static BPopUpMenu* _MakeColorSchemeMenu(uint32 msg, 75 BObjectList<const color_scheme> *items); 76 static void _MakeColorSchemeMenuItem(uint32 msg, 77 const color_scheme *item, 78 BPopUpMenu* menu); 79 80 void _MarkSelectedFont(const char* family, 81 const char* style, const char* size); 82 83 BCheckBox* fBlinkCursor; 84 BCheckBox* fAllowBold; 85 BCheckBox* fUseOptionAsMetaKey; 86 BCheckBox* fWarnOnExit; 87 BMenuField* fFontField; 88 89 BMenuField* fWindowSizeField; 90 BMenuField* fEncodingField; 91 92 BMenuField* fColorSchemeField; 93 BMenuField* fColorField; 94 BColorControl* fColorControl; 95 96 BTextControl* fTabTitle; 97 BTextControl* fWindowTitle; 98 99 BMessenger fTerminalMessenger; 100 }; 101 102 103 #endif // APPEARANCE_PREF_VIEW_H 104