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 <String.h> 14 15 16 static const uint32 MSG_HALF_FONT_CHANGED = 'mchf'; 17 static const uint32 MSG_HALF_SIZE_CHANGED = 'mchs'; 18 static const uint32 MSG_FULL_FONT_CHANGED = 'mcff'; 19 static const uint32 MSG_FULL_SIZE_CHANGED = 'mcfs'; 20 static const uint32 MSG_COLOR_FIELD_CHANGED = 'mccf'; 21 static const uint32 MSG_COLOR_CHANGED = 'mcbc'; 22 static const uint32 MSG_COLOR_SCHEME_CHANGED = 'mccs'; 23 24 static const uint32 MSG_TAB_TITLE_SETTING_CHANGED = 'mtts'; 25 static const uint32 MSG_WINDOW_TITLE_SETTING_CHANGED = 'mwts'; 26 static const uint32 MSG_BLINK_CURSOR_CHANGED = 'mbcc'; 27 static const uint32 MSG_ALLOW_BOLD_CHANGED = 'mabc'; 28 static const uint32 MSG_USE_OPTION_AS_META_CHANGED = 'momc'; 29 static const uint32 MSG_WARN_ON_EXIT_CHANGED = 'mwec'; 30 static const uint32 MSG_COLS_CHANGED = 'mccl'; 31 static const uint32 MSG_HISTORY_CHANGED = 'mhst'; 32 // TODO MSG_ENCODING_CHANGED? 33 34 static const uint32 MSG_PREF_MODIFIED = 'mpmo'; 35 36 37 struct color_scheme; 38 class BCheckBox; 39 class BColorControl; 40 class BMenu; 41 class BMenuField; 42 class BPopUpMenu; 43 class BTextControl; 44 45 46 class AppearancePrefView : public BGroupView { 47 public: 48 AppearancePrefView(const char* name, 49 const BMessenger &messenger); 50 51 virtual void Revert(); 52 virtual void MessageReceived(BMessage* message); 53 virtual void AttachedToWindow(); 54 55 private: 56 void _ChangeColorScheme(color_scheme* scheme); 57 void _SetCurrentColorScheme(); 58 void _SetEncoding(const char* encoding); 59 void _SetWindowSize(int rows, int cols); 60 61 static BMenu* _MakeFontMenu(uint32 command, 62 const char* defaultFamily, 63 const char* defaultStyle); 64 static BMenu* _MakeFontSizeMenu(const char* label, 65 uint32 command, 66 const char* family, 67 const char* style, 68 const char* size); 69 70 static BPopUpMenu* _MakeMenu(uint32 msg, const char** items, 71 const char* defaultItem); 72 73 static BPopUpMenu* _MakeColorSchemeMenu(uint32 msg, 74 const color_scheme** schemes, 75 const color_scheme* defaultItemName); 76 77 void _MarkSelectedFont(const char* family, 78 const char* style, const char* size); 79 80 BCheckBox* fBlinkCursor; 81 BCheckBox* fAllowBold; 82 BCheckBox* fUseOptionAsMetaKey; 83 BCheckBox* fWarnOnExit; 84 BMenuField* fFontField; 85 86 BMenuField* fWindowSizeField; 87 BMenuField* fEncodingField; 88 89 BMenuField* fColorSchemeField; 90 BMenuField* fColorField; 91 BColorControl* fColorControl; 92 93 BTextControl* fTabTitle; 94 BTextControl* fWindowTitle; 95 96 BMessenger fTerminalMessenger; 97 }; 98 99 100 #endif // APPEARANCE_PREF_VIEW_H 101