1
0

sepwnd.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include <precomp.h>
  2. #include <tataki/bitmap/bitmap.h>
  3. #include <api/wnd/basewnd.h>
  4. #include "sepwnd.h"
  5. #include <tataki/canvas/canvas.h>
  6. #include <api/wnd/PaintCanvas.h>
  7. SepWnd::SepWnd() {
  8. bitmap = NULL;
  9. orientation = SEP_UNKNOWN;
  10. }
  11. SepWnd::~SepWnd() {
  12. if (bitmap) delete bitmap;
  13. }
  14. int SepWnd::onPaint(Canvas *canvas) {
  15. PaintBltCanvas paintcanvas;
  16. if (canvas == NULL) {
  17. if (!paintcanvas.beginPaintNC(this)) return 0;
  18. canvas = &paintcanvas;
  19. }
  20. if (!bitmap) {
  21. switch (orientation) {
  22. case SEP_VERTICAL:
  23. bitmap = new SkinBitmap(L"studio.FrameVerticalDivider");
  24. break;
  25. case SEP_HORIZONTAL:
  26. bitmap = new SkinBitmap(L"studio.FrameHorizontalDivider");
  27. break;
  28. case SEP_UNKNOWN:
  29. return 1;
  30. }
  31. ASSERT(bitmap != NULL);
  32. }
  33. RECT r;
  34. getClientRect(&r);
  35. RenderBaseTexture(canvas, r);
  36. if (bitmap) {
  37. bitmap->stretchToRectAlpha(canvas, &r, 128);
  38. }
  39. return 1;
  40. }
  41. int SepWnd::setOrientation(int which) {
  42. orientation = which;
  43. return 1;
  44. }
  45. int SepWnd::onInit() {
  46. SEPWND_PARENT::onInit();
  47. return 1;
  48. }
  49. void SepWnd::freeResources() {
  50. SEPWND_PARENT::freeResources();
  51. if (bitmap) delete bitmap;
  52. bitmap = NULL;
  53. }