SavvyUI C++ UI Library
Loading...
Searching...
No Matches
RichText.h
Go to the documentation of this file.
1#pragma once
2
3#include "Button.h"
4
5class RichText: public Component, public ActionListener
6{
7 WinHandle _hRichTextWnd;
8 Button _boldBtn, _italicBtn, _underlineBtn, _fontNameBtn, _fontSizeBtn,
9 _alignLeftBtn, _alignRightBtn, _alignCenterBtn, _printBtn;
10
11 long _buttonsRowHeight;
12 BOOL _readOnly;
13 int _maxLength;
14
15 wstring _formattedText, _text;
16
17protected:
27 BOOL getCreateWindowOptions(wstring& title, UINT& widownStyles, wstring& wndClassName, BOOL& isCustomWndProc);
28
33
34public:
39
43 virtual ~RichText();
44
48 void clear();
49
50 void setReadOnly(BOOL readOnly);
51
52 void setMaxLength(int maxLen);
53
55 void setFormattedText(const wstring& rtfText);
56
57 wstring getText();
58 void setText(const wstring& plainText);
59
60 wstring getSelectedText();
61// void replaceSelectedText(const wstring& newText);
62
63 BOOL toggleSelectedTextStyling(DWORD mask, DWORD effect);
64 BOOL alignSelectedText(int alignment/*-1: left, 0: center, 1: right*/);
65 BOOL setSelectedTextFontName(const wstring& fontName);
66 BOOL setSelectedTextFontSize(long fontSize);
67
68 BOOL selectText(const wstring& textToFind);
69
70 BOOL canUndo();
71 BOOL undo();
72 BOOL canRedo();
73 BOOL redo();
74
75 BOOL print();
76
81
87 void onPaint(Graphics *g);
88
89 void onAction(const ActionEvent& ev);
90
92
93public:
94
95 void onDataChanged(WinHandle hTarget, const wstring& newValue, const ProcParams& procParams);
96};
HWND WinHandle
Definition Common.h:16
Definition EventListeners.h:38
Definition EventListeners.h:46
A clickable UI component representing a button with customizable text and type.
Definition Button.h:13
Component()
Constructs a new Component instance.
Definition EventListeners.h:15
Definition Graphics.h:171
Definition Component.h:9
void addDataChangedListener(DataChangeListener *l)
BOOL print()
void setReadOnly(BOOL readOnly)
BOOL setSelectedTextFontName(const wstring &fontName)
void setText(const wstring &plainText)
BOOL setSelectedTextFontSize(long fontSize)
void setMaxLength(int maxLen)
wstring getSelectedText()
virtual ~RichText()
Destructor for the RichText component.
void windowCreated()
Called when the window is created.
void onWindowResized()
Handles window resize events.
void onDataChanged(WinHandle hTarget, const wstring &newValue, const ProcParams &procParams)
Called when data changes in the component.
void onAction(const ActionEvent &ev)
wstring getText()
wstring getFormattedText()
void setFormattedText(const wstring &rtfText)
void onPaint(Graphics *g)
Paints the RichText including panels and active content.
BOOL selectText(const wstring &textToFind)
BOOL getCreateWindowOptions(wstring &title, UINT &widownStyles, wstring &wndClassName, BOOL &isCustomWndProc)
Retrieves window creation options.
RichText()
Constructs a new RichText component.
void clear()
Clears all panels.
BOOL redo()
BOOL canRedo()
BOOL alignSelectedText(int alignment)
BOOL undo()
BOOL toggleSelectedTextStyling(DWORD mask, DWORD effect)
BOOL canUndo()