Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicoreTextField.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_TEXTFIELD__
8#define __HDI_CORE_TEXTFIELD__
9
10#include "hdicoreWidget.h"
11
12namespace hdi
13{
14 namespace core
15 {
16 class Callback;
17 class Label;
18
22 class TextField : public Widget
23 {
24 public:
25 friend class Label;
26
31 {
32 UnknownAlignment = 0,
33 LeftAlignment = 10,
34 CenterAlignment = 20,
35 RightAlignment = 30
36 };
37
50
58 TextField(const TextField& field_);
59
69 TextField(const Point& loc_, const std::string& text_, const double width_);
70
76 virtual ~TextField();
77
86 virtual TextField& operator=(const TextField& rhs_);
87
101 virtual TextField* clone() const;
102
113 virtual TextField* duplicate() const;
114
122 virtual Alignment alignment() const;
123
131 virtual void setAlignment(const Alignment alignment_);
132
140 virtual bool bold() const;
141
149 virtual void setBold(const bool bold_);
150
158 virtual bool italic() const;
159
167 virtual void setItalic(const bool italic_);
168
176 virtual std::unique_ptr<Label> label() const;
177
187 virtual void setLabel(Label& label_);
188
194 virtual void removeLabel();
195
211 virtual bool selectionRange(uint32_t& pos__, uint32_t& len__) const;
212
227 virtual void setSelectionRange(const uint32_t pos_, const uint32_t len_);
228
244 virtual bool selectionRangeUTF32(uint32_t& pos__, uint32_t& len__) const;
245
260 virtual void setSelectionRangeUTF32(const uint32_t pos_, const uint32_t len_);
261
273 virtual std::string lastCharTyped() const;
274
290
296 virtual void valueChanging();
297
305 virtual Callback* const valueChangingCallback() const;
306
314 virtual void setValueChangingCallback(const Callback& callback_);
315
321 virtual void valueChanged();
322
330 virtual Callback* const valueChangedCallback() const;
331
339 virtual void setValueChangedCallback(const Callback& callback_);
340
348 virtual bool droppable() const;
349
357 virtual void setDroppable(const bool enable_);
358
366 virtual Callback* const dropCallback() const;
367
375 virtual void setDropCallback(const Callback& callback_);
376
386 virtual std::string droppedData() const;
387
397 virtual Point droppedPoint() const;
398 };
399
400 typedef std::unique_ptr<TextField> TextFieldUP;
401 typedef std::shared_ptr<TextField> TextFieldSP;
402 typedef std::weak_ptr<TextField> TextFieldWP;
403 }
404}
405
406#endif
407// __HDI_CORE_TEXTFIELD__
Base class for templated __Callback class.
Definition: hdicoreCallback.h:68
Label widget, for simply displaying text or images inside a window.
Definition: hdicoreLabel.h:29
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:38
Text field widget, which allows the user to enter arbitrary text values.
Definition: hdicoreTextField.h:23
virtual void valueChanged()
Simulates the text field having its value changed.
virtual void valueChanging()
Simulates the value of the text field changing.
virtual bool droppable() const
Gets whether dropping support for this particular widget is enabled.
virtual Callback *const valueChangingCallback() const
Gets the value changing callback for the text field.
virtual Alignment alignment() const
Gets the current alignment of the text field.
virtual void setDropCallback(const Callback &callback_)
Sets the drop callback for the widget.
TextField(const Point &loc_, const std::string &text_, const double width_)
Constructs an editable text field (single line only)
virtual Callback *const dropCallback() const
Gets the current drop callback for the widget.
virtual bool bold() const
Gets whether the text is bold.
virtual TextField * clone() const
Convenience method to clone a TextField object on the heap.
virtual ModifierKey lastModifierKeys() const
Gets the last set of modifier keys used when typing into the field.
virtual void setItalic(const bool italic_)
Sets the font style.
TextField(const TextField &field_)
Constructs a new TextField object from an existing TextField object (copy constructor)
virtual void removeLabel()
Removes the label that, when clicked, would have focused the target text field.
virtual TextField * duplicate() const
Convenience method to duplicate a TextField object, creating a new and identical UI element to the ta...
virtual bool selectionRange(uint32_t &pos__, uint32_t &len__) const
Gets the selection range of the text in the field, if any, in UTF-8.
virtual TextField & operator=(const TextField &rhs_)
Allows one TextField object to be assigned from another.
virtual bool italic() const
Gets whether the text is italicized.
virtual void setAlignment(const Alignment alignment_)
Sets the current alignment of the text field.
virtual void setSelectionRange(const uint32_t pos_, const uint32_t len_)
Sets the selection range of the text in the field, in UTF-8 (and focuses it)
virtual std::string lastCharTyped() const
Gets the last character typed into the field.
virtual std::unique_ptr< Label > label() const
If the target text field has been associated with a label, this gets said label.
Alignment
Text alignment options.
Definition: hdicoreTextField.h:31
virtual std::string droppedData() const
Gets the data that was passed when the widget received a drop.
virtual void setDroppable(const bool enable_)
Sets whether dropping support for this particular widget is enabled.
virtual Callback *const valueChangedCallback() const
Gets the value changed callback for the text field.
virtual void setLabel(Label &label_)
Sets the label that, when clicked, will focus the target text field.
virtual void setValueChangingCallback(const Callback &callback_)
Sets the value changing callback.
TextField()
Constructs an empty TextField object.
virtual void setBold(const bool bold_)
Sets the font weight.
virtual Point droppedPoint() const
Gets the point at which the drop occurred, in the widget's coordinate system.
virtual void setValueChangedCallback(const Callback &callback_)
Sets the value changed callback.
virtual ~TextField()
TextField destructor.
virtual bool selectionRangeUTF32(uint32_t &pos__, uint32_t &len__) const
Gets the selection range of the text in the field, if any, in UTF-32.
virtual void setSelectionRangeUTF32(const uint32_t pos_, const uint32_t len_)
Sets the selection range of the text in the field, in UTF-32 (and focuses it)
Base class for all interface widgets; handles many common needs, e.g. text, position,...
Definition: hdicoreWidget.h:30
ModifierKey
Describes various modifier keys.
Definition: hdicoreTypes.h:898
Header file for plugin user interface widgets.