xref: /haiku/src/apps/launchbox/MainWindow.h (revision 8d1863708046e19583d17c048b0ca3c7058d98fb)
1 /*
2  * Copyright 2006 - 2009, Stephan Aßmus <superstippi@gmx.de>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef MAIN_WINDOW_H
6 #define MAIN_WINDOW_H
7 
8 #include <Window.h>
9 
10 
11 class PadView;
12 
13 enum {
14 	MSG_SHOW_BORDER				= 'shbr',
15 	MSG_HIDE_BORDER				= 'hdbr',
16 
17 	MSG_TOGGLE_AUTORAISE		= 'tgar',
18 	MSG_SHOW_ON_ALL_WORKSPACES	= 'awrk',
19 
20 	MSG_SET_DESCRIPTION			= 'dscr',
21 
22 	MSG_ADD_WINDOW				= 'addw',
23 };
24 
25 
26 class MainWindow : public BWindow {
27 public:
28 								MainWindow(const char* name, BRect frame,
29 									bool addDefaultButtons = false);
30 								MainWindow(const char* name, BRect frame,
31 									BMessage* settings);
32 	virtual						~MainWindow();
33 
34 	// BWindow interface
35 	virtual	bool				QuitRequested();
36 	virtual	void				MessageReceived(BMessage* message);
37 
38 	virtual	void				Show();
39 	virtual	void				ScreenChanged(BRect frame, color_space format);
40 	virtual void				WorkspaceActivated(int32 workspace, bool active);
41 	virtual	void				FrameMoved(BPoint origin);
42 	virtual	void				FrameResized(float width,  float height);
43 
44 	// MainWindow
45 			void				ToggleAutoRaise();
46 			bool				AutoRaise() const
47 									{ return fAutoRaise; }
48 			bool				ShowOnAllWorkspaces() const
49 									{ return fShowOnAllWorkspaces; }
50 
51 			BPoint				ScreenPosition() const
52 									{ return fScreenPosition; }
53 
54 			bool				LoadSettings(const BMessage* message);
55 			void				SaveSettings(BMessage* message);
56 			BMessage*			Settings() const
57 									{ return fSettings; }
58 
59 private:
60  			void				_GetLocation();
61 			void				_AdjustLocation(BRect frame);
62 			void				_AddDefaultButtons();
63 			void				_AddEmptyButtons();
64 
65 			BMessage*			fSettings;
66 			PadView*			fPadView;
67 			int32				fLastID;
68 
69 			float				fBorderDist;
70 			BPoint				fScreenPosition;
71 				// not really the position, 0...1 = left...right
72 
73 			BRect				fNamePanelFrame;
74 
75 			bool				fAutoRaise;
76 			bool				fShowOnAllWorkspaces;
77 };
78 
79 #endif // MAIN_WINDOW_H
80