xmainwindow.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef XMAINWINDOW_H
  2. #define XMAINWINDOW_H
  3. #define VALUE_DIS 10
  4. #include <QWidget>
  5. #include <QtCore>
  6. #include <QtGui>
  7. #include <ximagebutton.h>
  8. #include "xtitlebar.h"
  9. #include "xtoolbar.h"
  10. #include "xstatusbar.h"
  11. #include "CustomUI_global.h"
  12. #include "xlabel.h"
  13. class CUSTOMUISHARED_EXPORT XMainWindow : public QWidget
  14. {
  15. Q_OBJECT
  16. public:
  17. explicit XMainWindow(QWidget *parent = 0);
  18. ~XMainWindow();
  19. enum enum_Direction
  20. {
  21. eNone,
  22. eTop = 1,
  23. eRight =2 ,
  24. eBottom =4,
  25. eLeft = 8,
  26. eTopRight = eTop + eRight,
  27. eRightBottom = eRight + eBottom,
  28. eBottomLeft = eBottom + eLeft,
  29. eLeftTop = eLeft + eTop
  30. };
  31. protected:
  32. void paintEvent(QPaintEvent *event);
  33. void mouseDoubleClickEvent(QMouseEvent *event);
  34. void mouseMoveEvent(QMouseEvent *event);
  35. void mousePressEvent(QMouseEvent *event);
  36. void mouseReleaseEvent(QMouseEvent *event);
  37. void moveEvent ( QMoveEvent * event );
  38. signals:
  39. private:
  40. void createFrame();
  41. void createWidget();
  42. void createLayout();
  43. void initUI();
  44. void initVariables();
  45. enum_Direction getPointPos(int nXRelative,int nYRelative);
  46. void setCursorStyle(enum_Direction direction);
  47. void setDragSize(QPoint destPos,enum_Direction direction);
  48. public slots:
  49. void slotOnMoveOffset(QPoint offset);
  50. void slotOnMin();
  51. void slotOnMaxRestore();
  52. void slotOnClose();
  53. private:
  54. QWidget *m_pContentWidget;
  55. QRect m_rectRestoreWindow;
  56. QPoint m_mouseSrcPos;
  57. enum_Direction m_eDirection;
  58. XTitleBar *m_pTitleBar;
  59. XToolBar *m_pToolBar;
  60. XStatusBar *m_pStatusBar;
  61. QVBoxLayout *m_pLayout;
  62. bool m_mouseResizeWindowFlag;
  63. bool m_mouseMoveWindowFlag;
  64. bool m_bMaxWin;
  65. };
  66. #endif // XMAINWINDOW_H