1
0

textbase.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef NULLSOFT_WASABI_TEXTBASE_H
  2. #define NULLSOFT_WASABI_TEXTBASE_H
  3. #include <api/wnd/wndclass/bufferpaintwnd.h>
  4. #include <tataki/color/filteredcolor.h>
  5. #include <tataki/color/skinclr.h>
  6. #include <bfc/string/StringW.h>
  7. #define TEXTBASE_PARENT BufferPaintWnd
  8. class TextBase : public TEXTBASE_PARENT, public SkinCallbackI
  9. {
  10. public:
  11. TextBase();
  12. virtual ~TextBase();
  13. ARGB32 GetColor(int alt=0);
  14. void GetFontInfo(Wasabi::FontInfo *_font, int alt=0);
  15. void SetTextColor(ARGB32 c, int alt=0);
  16. void SetFontSize(const wchar_t *strvalue, int alt=0);
  17. void SetFont(const wchar_t *name, int alt=0);
  18. void SetAntialias(int a, int alt=0);
  19. void SetFontAlign(int al);
  20. virtual void setDblClickParam(const wchar_t *p);
  21. virtual const wchar_t *getDblClickParam();
  22. virtual void setRClickParam(const wchar_t *p);
  23. virtual const wchar_t *getRClickParam();
  24. protected:
  25. /* Virtual methods to override */
  26. virtual void invalidateTextBuffer()=0;
  27. /*static */void CreateXMLParameters(int master_handle);
  28. private:
  29. StringW dblClickAction;
  30. StringW rClickAction;
  31. /* Font Info */
  32. FilteredColor color[2];
  33. SkinColor scolor[2];
  34. int color_mode[2];
  35. StringW font[2];
  36. int bold[2];
  37. int italic[2];
  38. int antialias[2];
  39. int align;
  40. protected:
  41. int fontsize[2];
  42. int lpadding, rpadding;
  43. int grab;
  44. private:
  45. /* XML Parameters */
  46. enum
  47. {
  48. TEXTBASE_SETCOLOR,
  49. TEXTBASE_SETALTCOLOR,
  50. TEXTBASE_SETFONTSIZE,
  51. TEXTBASE_SETFONT,
  52. TEXTBASE_SETALTFONT,
  53. TEXTBASE_SETALTFONTSIZE,
  54. TEXTBASE_SETBOLD,
  55. TEXTBASE_SETITALIC,
  56. TEXTBASE_SETALTBOLD,
  57. TEXTBASE_SETALTITALIC,
  58. TEXTBASE_SETANTIALIAS,
  59. TEXTBASE_SETALTANTIALIAS,
  60. TEXTBASE_SETDBLCLKACTION,
  61. TEXTBASE_SETRCLKACTION,
  62. TEXTBASE_SETALIGN,
  63. TEXTBASE_SETLPADDING,
  64. TEXTBASE_SETRPADDING,
  65. TEXTBASE_RCLICKPARAM,
  66. TEXTBASE_DBLCLICKPARAM,
  67. };
  68. static XMLParamPair params[];
  69. int xuihandle;
  70. StringW dblclickparam;
  71. StringW rclickparam;
  72. protected:
  73. /* Methods that TextBase overrides */
  74. int setXuiParam(int _xuihandle, int attrid, const wchar_t *name, const wchar_t *strval);
  75. int onInit();
  76. int skincb_onColorThemeChanged(const wchar_t *newcolortheme);
  77. int onLeftButtonDblClk(int x, int y);
  78. int onRightButtonDown(int x, int y);
  79. virtual int wantAutoContextMenu() { return rClickAction.isempty(); }
  80. };
  81. #endif