1 // 2 // Harbour.hh for pekwm 3 // Copyright (C) 2003-2020 Claes Nästén <pekdon@gmail.com> 4 // 5 // This program is licensed under the GNU GPL. 6 // See the LICENSE file for more information. 7 // 8 9 #ifndef _PEKWM_HARBOUR_HH_ 10 #define _PEKWM_HARBOUR_HH_ 11 12 #include "config.h" 13 14 #include "pekwm.hh" 15 16 class AutoProperties; 17 class Config; 18 class DockApp; 19 class RootWO; 20 class Strut; 21 22 #include "Action.hh" 23 24 class Harbour 25 { 26 public: 27 Harbour(Config* cfg, AutoProperties* ap, RootWO *root_wo); 28 ~Harbour(void); 29 30 void addDockApp(DockApp* da); 31 void removeDockApp(DockApp* da); 32 void removeAllDockApps(void); 33 34 DockApp* findDockApp(Window win); 35 DockApp* findDockAppFromFrame(Window win); 36 getSize(void) const37 inline uint getSize(void) const { return _size; } 38 39 void updateGeometry(void); 40 41 void restack(void); 42 void rearrange(void); 43 void loadTheme(void); 44 void updateHarbourSize(void); 45 46 void setStateHidden(StateAction sa); 47 48 void handleButtonEvent(XButtonEvent* ev, DockApp* da); 49 void handleMotionNotifyEvent(XMotionEvent* ev, DockApp* da); 50 void handleConfigureRequestEvent(XConfigureRequestEvent* ev, DockApp* da); 51 52 private: 53 void placeDockApp(DockApp *da); 54 void placeDockAppsSorted(void); 55 void placeDockAppInsideScreen(DockApp *da); 56 57 void getPlaceStartPosition(DockApp *da, int &x, int &y, bool &inc_x); 58 void insertDockAppSorted(DockApp *da); 59 60 void updateStrutSize(void); 61 62 private: 63 Config* _cfg; 64 AutoProperties* _ap; 65 RootWO *_root_wo; 66 67 std::vector<DockApp*> _dapps; 68 bool _hidden; 69 uint _size; 70 Strut *_strut; 71 int _last_button_x, _last_button_y; 72 }; 73 74 namespace pekwm 75 { 76 Harbour* harbour(); 77 } 78 79 #endif // _PEKWM_HARBOUR_HH_ 80