1 /* 2 * Docklike Taskbar - A modern, minimalist taskbar for Xfce 3 * Copyright (c) 2019-2020 Nicolas Szabo <nszabo@vivaldi.net> 4 * Copyright (c) 2020-2021 David Keogh <davidtkeogh@gmail.com> 5 * gnu.org/licenses/gpl-3.0 6 */ 7 8 #ifndef GROUP_HPP 9 #define GROUP_HPP 10 11 #include <gtk/gtk.h> 12 13 #include <algorithm> 14 #include <iostream> 15 #include <math.h> 16 17 #include "AppInfos.hpp" 18 #include "GroupMenu.hpp" 19 #include "GroupWindow.hpp" 20 #include "Helpers.hpp" 21 #include "State.tpp" 22 23 enum IndicatorOrientation 24 { 25 ORIENTATION_AUTOMATIC, 26 ORIENTATION_BOTTOM, 27 ORIENTATION_RIGHT, 28 ORIENTATION_TOP, 29 ORIENTATION_LEFT, 30 }; 31 32 enum IndicatorStyle 33 { 34 STYLE_BARS, 35 STYLE_DOTS, 36 STYLE_RECTS, 37 STYLE_NONE 38 }; 39 40 class GroupWindow; 41 42 class Group 43 { 44 public: 45 Group(AppInfo* appInfo, bool pinned); 46 47 void add(GroupWindow* window); 48 void remove(GroupWindow* window); 49 void electNewTopWindow(); 50 void setTopWindow(GroupWindow* groupWindow); 51 52 void activate(guint32 timestamp); 53 void scrollWindows(guint32 timestamp, GdkScrollDirection direction); 54 void closeAll(); 55 56 void resize(); 57 void updateStyle(); 58 59 void onDraw(cairo_t* cr); 60 void onWindowActivate(GroupWindow* groupWindow); 61 void onWindowUnactivate(); 62 void onButtonPress(GdkEventButton* event); 63 void onButtonRelease(GdkEventButton* event); 64 void onMouseEnter(); 65 void onMouseLeave(); 66 void setMouseLeaveTimeout(); 67 bool onDragMotion(GtkWidget* widget, GdkDragContext* context, int x, int y, guint time); 68 void onDragLeave(const GdkDragContext* context, guint time); 69 void onDragDataGet(const GdkDragContext* context, GtkSelectionData* selectionData, guint info, guint time); 70 void onDragDataReceived(const GdkDragContext* context, int x, int y, const GtkSelectionData* selectionData, guint info, guint time); 71 void onDragBegin(GdkDragContext* context); 72 73 bool mPinned; 74 bool mActive; 75 bool mSFocus; 76 bool mSOpened; 77 bool mSMany; 78 bool mSHover; 79 bool mSSuper; 80 81 uint mTolerablePointerDistance; 82 uint mTopWindowIndex; 83 Store::List<GroupWindow*> mWindows; 84 LogicalState<uint> mWindowsCount; 85 86 AppInfo* mAppInfo; 87 GroupMenu mGroupMenu; 88 89 GtkWidget* mButton; 90 GtkWidget* mLabel; 91 GtkWidget* mImage; 92 GdkPixbuf* mIconPixbuf; 93 94 Help::Gtk::Timeout mLeaveTimeout; 95 Help::Gtk::Timeout mMenuShowTimeout; 96 }; 97 98 #endif // GROUP_HPP 99