BaseApp.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * BaseApp.h
  3. *
  4. * Created on: Aug 24, 2017
  5. * Author: guoxs
  6. */
  7. #ifndef _APP_BASEAPP_H_
  8. #define _APP_BASEAPP_H_
  9. #include "window/ZKMainWindow.h"
  10. /**
  11. * @brief 应用基类
  12. */
  13. class BaseApp :
  14. public ZKBase::IClickListener,
  15. public ZKMainWindow::ITimerListener {
  16. public:
  17. BaseApp();
  18. virtual ~BaseApp();
  19. bool create();
  20. void show();
  21. void hide();
  22. bool isShow() const;
  23. void updateLocales();
  24. void setPosition(const LayoutPosition &position);
  25. const LayoutPosition& getPosition() const;
  26. protected:
  27. virtual const char* getAppName() const { return NULL; }
  28. /**
  29. * @brief 创建完成回调函数
  30. */
  31. virtual void onCreate();
  32. /**
  33. * @brief 按钮点击事件回调函数
  34. */
  35. virtual void onClick(ZKBase *pBase);
  36. /**
  37. * @brief 定时器回调函数
  38. */
  39. virtual bool onTimer(int id);
  40. /**
  41. * @brief 通过id值找到对应的控件
  42. */
  43. ZKBase* findControlByID(int id);
  44. /**
  45. * @brief 注册定时器
  46. * @param id 定时器id
  47. * @param time 定时器时间周期
  48. */
  49. void registerTimer(int id, int time);
  50. /**
  51. * @brief 反注册定时器
  52. * @param id 定时器id
  53. */
  54. void unregisterTimer(int id);
  55. /**
  56. * @brief 重置定时器
  57. * @param id 定时器id
  58. * @param time 定时器时间周期
  59. */
  60. void resetTimer(int id, int time);
  61. protected:
  62. ZKMainWindow *mMainWndPtr;
  63. };
  64. #endif /* _APP_BASEAPP_H_ */