30
30
* This defines a non responsive (to clicks) text area, where a text
31
* can easily be printed
31
* can easily be printed.
33
* Textareas can operate in auto-move mode or in layouted mode.
35
* In auto-move mode, which is selected by constructors that take x/y coordinates
36
* as parameters, the given (x,y) is used as the anchor for the text.
37
* The panel automatically changes its size and position so that the
38
* given (x,y) always stay the anchor point. This is incompatible with
39
* using the Textarea in a layouted situation, e.g. inside \ref Box.
41
* In layouted mode, which is selected by the constructor that does not
42
* take coordinates, the textarea simply sets its desired size
43
* appropriately for the contained text.
45
* Finally, there is static mode, which does not change desired or actual
46
* size in any way based on the text.
48
* A multiline Textarea differs from a \ref Multiline_Textarea in that
49
* the latter provides scrollbars.
33
51
struct Textarea : public Panel {
36
* For non-multiline textareas, the dimensions are set automatically,
37
* depending on the text. For multiline textareas, only the height and
38
* vertical position is adjusted automatically. A multiline Textarea differs
39
* from a Multiline_Textarea in that Multiline_Textarea provides scrollbars.
43
60
int32_t x, int32_t y,
44
61
std::string const & text = std::string(),
45
62
Align align = Align_Left, bool multiline = false);
49
65
int32_t x, int32_t y, uint32_t w, uint32_t h,
50
66
Align align = Align_Left, bool multiline = false);
53
68
(Panel * const parent,
54
69
int32_t x, int32_t y, uint32_t w, uint32_t h,
55
70
const std::string & text,
56
71
Align align = Align_Left, bool multiline = false);
74
const std::string & text = std::string(),
75
Align align = Align_Left, bool multiline = false, uint32_t width = 0);
77
void set_layout_mode(LayoutMode lm);
78
void set_fixed_size(const std::string & text);
58
79
void set_text(const std::string &);
59
80
std::string get_text();
60
81
void set_align(Align);
62
83
// Drawing and event handlers
63
84
void draw(RenderTarget &);
65
void set_font(std::string const & name, int32_t size, RGBColor fg) {
86
void set_font(std::string const & name, int32_t size, RGBColor fg);
89
virtual void update_desired_size();
95
LayoutMode m_layoutmode;
76
96
std::string m_text;