1/*
2 * Copyright 2006-2011, 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
11class PadView;
12
13enum {
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	MSG_SETTINGS_CHANGED		= 'stch',
24	MSG_TOGGLE_AUTOSTART		= 'tast'
25};
26
27
28class MainWindow : public BWindow {
29public:
30								MainWindow(const char* name, BRect frame,
31									bool addDefaultButtons = false);
32								MainWindow(const char* name, BRect frame,
33									BMessage* settings);
34	virtual						~MainWindow();
35
36	// BWindow interface
37	virtual	bool				QuitRequested();
38	virtual	void				MessageReceived(BMessage* message);
39
40	virtual	void				Show();
41	virtual	void				ScreenChanged(BRect frame, color_space format);
42	virtual void				WorkspaceActivated(int32 workspace, bool active);
43	virtual	void				FrameMoved(BPoint origin);
44	virtual	void				FrameResized(float width,  float height);
45
46	// MainWindow
47			void				ToggleAutoRaise();
48			bool				AutoRaise() const
49									{ return fAutoRaise; }
50			bool				ShowOnAllWorkspaces() const
51									{ return fShowOnAllWorkspaces; }
52
53			BPoint				ScreenPosition() const
54									{ return fScreenPosition; }
55
56			bool				LoadSettings(const BMessage* message);
57			void				SaveSettings(BMessage* message);
58			BMessage*			Settings() const
59									{ return fSettings; }
60
61private:
62 			void				_GetLocation();
63			void				_AdjustLocation(BRect frame);
64			void				_AddDefaultButtons();
65			void				_AddEmptyButtons();
66
67			void				_NotifySettingsChanged();
68
69private:
70			BMessage*			fSettings;
71			PadView*			fPadView;
72
73			float				fBorderDist;
74			BPoint				fScreenPosition;
75				// not really the position, 0...1 = left...right
76
77			bool				fAutoRaise;
78			bool				fShowOnAllWorkspaces;
79};
80
81#endif // MAIN_WINDOW_H