xref: /haiku/src/apps/terminal/AppearPrefView.h (revision e7d5c75dce28921de0dc981ed840205a67a0c0e5)
1 /*
2  * Copyright 2001-2007, 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 <Messenger.h>
12 #include <String.h>
13 #include <View.h>
14 
15 
16 const ulong MSG_HALF_FONT_CHANGED	= 'mchf';
17 const ulong MSG_HALF_SIZE_CHANGED	= 'mchs';
18 const ulong MSG_FULL_FONT_CHANGED	= 'mcff';
19 const ulong MSG_FULL_SIZE_CHANGED	= 'mcfs';
20 const ulong MSG_COLOR_FIELD_CHANGED	= 'mccf';
21 const ulong MSG_COLOR_CHANGED		= 'mcbc';
22 const ulong MSG_COLOR_SCHEMA_CHANGED		= 'mccs';
23 
24 const ulong MSG_WARN_ON_EXIT_CHANGED	= 'mwec';
25 const ulong MSG_COLS_CHANGED            = 'mccl';
26 const ulong MSG_ROWS_CHANGED            = 'mcrw';
27 const ulong MSG_HISTORY_CHANGED         = 'mhst';
28 
29 const ulong MSG_PREF_MODIFIED		= 'mpmo';
30 
31 
32 struct color_schema;
33 class BColorControl;
34 class BMenu;
35 class BMenuField;
36 class BPopUpMenu;
37 class BCheckBox;
38 
39 class AppearancePrefView : public BView {
40 public:
41 								AppearancePrefView(const char *name,
42 									const BMessenger &messenger);
43 
44 	virtual	void				Revert();
45 	virtual void				MessageReceived(BMessage *message);
46 	virtual void				AttachedToWindow();
47 
48 	virtual	void				GetPreferredSize(float *_width,
49 									float *_height);
50 
51 private:
52 			void				_EnableCustomColors(bool enable);
53 
54 			void				_ChangeColorSchema(color_schema *schema);
55 			void				_SetCurrentColorSchema(BMenuField *field);
56 
57 	static	BMenu*				_MakeFontMenu(uint32 command,
58 									const char *defaultFamily,
59 									const char *defaultStyle);
60 	static	BMenu*				_MakeSizeMenu(uint32 command,
61 									uint8 defaultSize);
62 
63 	static	BPopUpMenu*			_MakeMenu(uint32 msg, const char **items,
64 										const char *defaultItem);
65 
66 	static	BPopUpMenu*			_MakeColorSchemaMenu(uint32 msg, const color_schema **schemas,
67 									const color_schema *defaultItemName);
68 
69 			BCheckBox			*fWarnOnExit;
70 			BMenuField			*fFont;
71 			BMenuField			*fFontSize;
72 
73 			BMenuField			*fColorSchemaField;
74 			BMenuField			*fColorField;
75 			BColorControl		*fColorControl;
76 
77 			BMessenger			fTerminalMessenger;
78 };
79 
80 #endif	// APPEARANCE_PREF_VIEW_H
81