1 /* 2 * Copyright 2006, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 9 #ifndef MAIN_WINDOW_H 10 #define MAIN_WINDOW_H 11 12 #include <Window.h> 13 14 class PadView; 15 16 enum { 17 MSG_SHOW_BORDER = 'shbr', 18 MSG_HIDE_BORDER = 'hdbr', 19 20 MSG_TOGGLE_AUTORAISE = 'tgar', 21 MSG_SHOW_ON_ALL_WORKSPACES = 'awrk', 22 23 MSG_SET_DESCRIPTION = 'dscr', 24 25 MSG_ADD_WINDOW = 'addw', 26 }; 27 28 class MainWindow : public BWindow { 29 public: 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, 45 float height); 46 47 // MainWindow 48 void ToggleAutoRaise(); 49 bool AutoRaise() const 50 { return fAutoRaise; } 51 bool ShowOnAllWorkspaces() const 52 { return fShowOnAllWorkspaces; } 53 54 BPoint ScreenPosition() const 55 { return fScreenPosition; } 56 57 bool LoadSettings(const BMessage* message); 58 void SaveSettings(BMessage* message); 59 BMessage* Settings() const 60 { return fSettings; } 61 62 private: 63 void _GetLocation(); 64 void _AdjustLocation(BRect frame); 65 void _AddDefaultButtons(); 66 void _AddEmptyButtons(); 67 68 BMessage* fSettings; 69 PadView* fPadView; 70 int32 fLastID; 71 72 float fBorderDist; 73 BPoint fScreenPosition; // not really the position, 0...1 = left...right 74 75 BRect fNamePanelFrame; 76 77 bool fAutoRaise; 78 bool fShowOnAllWorkspaces; 79 }; 80 81 #endif // MAIN_WINDOW_H 82