windowbar_p.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware)
  2. // Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao)
  3. // SPDX-License-Identifier: Apache-2.0
  4. #ifndef WINDOWBARPRIVATE_H
  5. #define WINDOWBARPRIVATE_H
  6. #include <QBoxLayout>
  7. #include "windowbar.h"
  8. namespace QWK {
  9. class WindowBarPrivate {
  10. Q_DECLARE_PUBLIC(WindowBar)
  11. public:
  12. WindowBarPrivate();
  13. virtual ~WindowBarPrivate();
  14. void init();
  15. WindowBar *q_ptr;
  16. QWidget *w;
  17. bool autoTitle;
  18. bool autoIcon;
  19. enum WindowBarItem {
  20. IconButton,
  21. MenuWidget,
  22. TitleLabel,
  23. PinButton,
  24. MinimizeButton,
  25. MaximizeButton,
  26. CloseButton,
  27. };
  28. QHBoxLayout *layout;
  29. inline QWidget *widgetAt(int index) const {
  30. return layout->itemAt(index)->widget();
  31. }
  32. void setWidgetAt(int index, QWidget *widget);
  33. QWidget *takeWidgetAt(int index);
  34. inline void insertDefaultSpace(int index) {
  35. layout->insertSpacerItem(index, new QSpacerItem(0, 0));
  36. }
  37. private:
  38. Q_DISABLE_COPY(WindowBarPrivate)
  39. };
  40. }
  41. #endif // WINDOWBARPRIVATE_H