xref: /haiku/src/apps/terminal/AppearPrefView.h (revision 323b65468e5836bb27a5e373b14027d902349437)
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_SCHEMA_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_WARN_ON_EXIT_CHANGED			= 'mwec';
27 static const uint32 MSG_COLS_CHANGED					= 'mccl';
28 static const uint32 MSG_ROWS_CHANGED					= 'mcrw';
29 static const uint32 MSG_HISTORY_CHANGED 				= 'mhst';
30 
31 static const uint32 MSG_PREF_MODIFIED					= 'mpmo';
32 
33 
34 struct color_schema;
35 class BCheckBox;
36 class BColorControl;
37 class BMenu;
38 class BMenuField;
39 class BPopUpMenu;
40 class BTextControl;
41 
42 
43 class AppearancePrefView : public BGroupView {
44 public:
45 								AppearancePrefView(const char* name,
46 									const BMessenger &messenger);
47 
48 	virtual	void				Revert();
49 	virtual void				MessageReceived(BMessage* message);
50 	virtual void				AttachedToWindow();
51 
52 	virtual	void				GetPreferredSize(float* _width,
53 									float* _height);
54 
55 private:
56 			void				_EnableCustomColors(bool enable);
57 
58 			void				_ChangeColorSchema(color_schema* schema);
59 			void				_SetCurrentColorSchema(BMenuField* field);
60 
61 	static	BMenu*				_MakeFontMenu(uint32 command,
62 									const char* defaultFamily,
63 									const char* defaultStyle);
64 	static	BMenu*				_MakeSizeMenu(uint32 command,
65 									uint8 defaultSize);
66 
67 	static	BPopUpMenu*			_MakeMenu(uint32 msg, const char** items,
68 										const char* defaultItem);
69 
70 	static	BPopUpMenu*			_MakeColorSchemaMenu(uint32 msg,
71 									const color_schema** schemas,
72 									const color_schema* defaultItemName);
73 
74 			BCheckBox*			fWarnOnExit;
75 			BMenuField*			fFont;
76 			BMenuField*			fFontSize;
77 
78 			BMenuField*			fColorSchemaField;
79 			BMenuField*			fColorField;
80 			BColorControl*		fColorControl;
81 
82 			BTextControl*		fTabTitle;
83 			BTextControl*		fWindowTitle;
84 
85 			BMessenger			fTerminalMessenger;
86 };
87 
88 
89 #endif	// APPEARANCE_PREF_VIEW_H
90