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, 31 BRect frame); 32 MainWindow(const char* name, 33 BRect frame, 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 66 BMessage* fSettings; 67 PadView* fPadView; 68 int32 fLastID; 69 70 float fBorderDist; 71 BPoint fScreenPosition; // 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