abstractwidgetwindow.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. = StarPU-Top for StarPU =
  3. Copyright (C) 2011
  4. William Braik
  5. Yann Courtois
  6. Jean-Marie Couteyen
  7. Anthony Roy
  8. This library is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU Lesser General Public
  10. License as published by the Free Software Foundation; either
  11. version 2.1 of the License, or (at your option) any later version.
  12. This library is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. Lesser General Public License for more details.
  16. You should have received a copy of the GNU Lesser General Public
  17. License along with this library; if not, write to the Free Software
  18. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef ABSTRACTWIDGETWINDOW_H
  21. #define ABSTRACTWIDGETWINDOW_H
  22. class WidgetWindowsManager;
  23. class MainWindow;
  24. #include <QWidget>
  25. #include <QSizeGrip>
  26. #include <QToolButton>
  27. #include <QMouseEvent>
  28. class AbstractWidgetWindow : public QWidget
  29. { /* Abstract class representing a widget window.
  30. It can be put "outside" (flying window) or "inside" (MDI) at any moment.
  31. The widget window is managed by the widget windows manager. */
  32. Q_OBJECT
  33. public:
  34. explicit AbstractWidgetWindow(
  35. WidgetWindowsManager *widgetWindowsManager,
  36. MainWindow *mainWindow,
  37. bool inside = false);
  38. virtual ~AbstractWidgetWindow();
  39. // Getters
  40. int windowId() const;
  41. bool isInside() const;
  42. // Setters
  43. void setInside(bool inside);
  44. protected:
  45. // Components
  46. WidgetWindowsManager *_widgetWindowsManager;
  47. MainWindow *_mainWindow;
  48. QPoint dragPosition;
  49. // GUI components
  50. QSizeGrip *_sizeGrip;
  51. QToolButton *_inOutButton;
  52. // Metadata
  53. int _windowId;
  54. bool _inside;
  55. // Window id generation
  56. int generateWindowId();
  57. // Events
  58. void mousePressEvent(QMouseEvent *event);
  59. void mouseMoveEvent(QMouseEvent *event);
  60. void resizeEvent(QResizeEvent *event);
  61. virtual void closeEvent(QCloseEvent *ce) = 0;
  62. private slots:
  63. // GUI interactions
  64. void on_inOutButton_clicked();
  65. };
  66. #endif // ABSTRACTWIDGETWINDOW_H