pm_panel.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * File : pm_panel.h
  3. * COPYRIGHT (C) 2012-2017, Shanghai Real-Thread Technology Co., Ltd
  4. *
  5. * Change Logs:
  6. * Date Author Notes
  7. * 2017-11-05 realthread the first version
  8. */
  9. #pragma once
  10. #include <pm_container.h>
  11. #include <pm_image.h>
  12. namespace Persimmon
  13. {
  14. class Panel : public Container
  15. {
  16. public:
  17. enum type
  18. {
  19. VERTICAL = 1 << 0,
  20. HORIZONTAL = 1 << 1,
  21. LEFT = 1 << 2,
  22. TOP = 1 << 3,
  23. };
  24. DEFINE_CLASS_ENUM_FLAG_OPERATORS(type);
  25. Panel(const Rect rect, enum type tp = VERTICAL);
  26. virtual ~Panel();
  27. void setScrollbar(Image *yImg, Image *xImg);
  28. void addItem(Widget *w);
  29. void fixChildrenExtent(int xOffset, int yOffset);
  30. virtual bool handleGestureEvent(struct rtgui_event_gesture *gev,
  31. const struct rtgui_gesture *gest);
  32. virtual void render(struct rtgui_dc* dc, const Point &dcPoint = Point(),
  33. const Rect &srcRect = Rect(),
  34. RenderFlag flags = DrawNormal);
  35. protected:
  36. enum type mtype;
  37. private:
  38. int yLastPosition, yFirstPosition;
  39. int xLastPosition, xFirstPosition;
  40. int yMovePitch, xMovePitch;
  41. Image *yImage, *xImage;
  42. };
  43. }