Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicoreComboBox.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_COMBO_BOX__
8#define __HDI_CORE_COMBO_BOX__
9
10#include <vector>
11
12#include "hdicoreWidget.h"
13
14namespace hdi
15{
16 namespace core
17 {
18 class Callback;
19 class PopupEntry;
20
24 class ComboBox : public Widget
25 {
26 public:
27 typedef std::vector<PopupEntry> EntryVector;
28
33 {
34 UnknownAlignment = 0,
35 LeftAlignment = 10,
36 CenterAlignment = 20,
37 RightAlignment = 30
38 };
39
51
59 ComboBox(const ComboBox& combobox_);
60
69 ComboBox(const Point& loc_, const double width_);
70
82 const Point& loc_,
83 const double width_,
84 const EntryVector& entries_,
85 const int32_t initialIndex_
86 );
87
101 const Point& loc_,
102 const double width_,
103 const EntryVector& entries_,
104 const std::string& initialID_
105 );
106
120 const Point& loc_,
121 const double width_,
122 const EntryVector& entries_,
123 const std::string& value_
124 );
125
131 virtual ~ComboBox();
132
141 virtual ComboBox& operator=(const ComboBox& rhs_);
142
156 virtual ComboBox* clone() const;
157
173 virtual ComboBox* duplicate() const;
174
182 virtual Alignment alignment() const;
183
191 virtual void setAlignment(const Alignment alignment_);
192
200 virtual bool bold() const;
201
209 virtual void setBold(const bool bold_);
210
218 virtual bool italic() const;
219
227 virtual void setItalic(const bool italic_);
228
237 virtual int32_t currentIndex() const;
238
247 virtual bool setCurrentIndex(const int32_t index_);
248
256 virtual std::string currentID() const;
257
266 virtual bool setCurrentID(const std::string& id_);
267
276 virtual std::string currentValue() const;
277
287 virtual bool setCurrentValue(const std::string& value_);
288
296 virtual std::unique_ptr<PopupEntry> currentEntry() const;
297
306 virtual bool currentUserData(void*& data__) const;
307
318 virtual const std::vector< std::shared_ptr<PopupEntry> >* const entries() const;
319
328 virtual bool hasEntry(const std::string& id_) const;
329
338 virtual std::shared_ptr<PopupEntry> entryWithID(const std::string& id_) const;
339
347 virtual void setEntries(const EntryVector& entries_);
348
359 virtual bool pushEntry(const PopupEntry& entry_);
360
370 virtual bool popEntry(PopupEntry& entry__);
371
386 virtual bool insertEntry(const std::string& id_, const PopupEntry& entry_);
387
398 virtual bool removeEntry(const std::string& id_, PopupEntry& entry__);
399
405 virtual void clearEntries();
406
422 virtual bool selectionRange(uint32_t& pos__, uint32_t& len__) const;
423
438 virtual void setSelectionRange(const uint32_t pos_, const uint32_t len_);
439
455 virtual bool selectionRangeUTF32(uint32_t& pos__, uint32_t& len__) const;
456
471 virtual void setSelectionRangeUTF32(const uint32_t pos_, const uint32_t len_);
472
484 virtual std::string lastCharTyped() const;
485
501
507 virtual void valueChanging();
508
516 virtual Callback* const valueChangingCallback() const;
517
525 virtual void setValueChangingCallback(const Callback& callback_);
526
532 virtual void valueChanged();
533
541 virtual Callback* const valueChangedCallback() const;
542
550 virtual void setValueChangedCallback(const Callback& callback_);
551
557 virtual void update();
558
566 virtual bool expanded() const;
567
575 virtual void setExpanded(const bool exp_);
576 };
577
578 typedef std::unique_ptr<ComboBox> ComboBoxUP;
579 typedef std::shared_ptr<ComboBox> ComboBoxSP;
580 typedef std::weak_ptr<ComboBox> ComboBoxWP;
581 }
582}
583
584#endif
585// __HDI_CORE_COMBO_BOX__
Base class for templated __Callback class.
Definition: hdicoreCallback.h:68
Combo box widget, which consists of a text-field for custom input and a popup menu for preset values.
Definition: hdicoreComboBox.h:25
virtual Callback *const valueChangingCallback() const
Gets the value changing callback for the combo box.
virtual std::string currentValue() const
Gets the string value of the currently selected entry (or the custom value, if the user has entered o...
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 void setExpanded(const bool exp_)
Sets the expansion state of the combo box's popup menu.
ComboBox(const Point &loc_, const double width_)
Constructs a combo box.
virtual void valueChanged()
Simulates the combo box having its value changed.
virtual void setItalic(const bool italic_)
Sets the font style.
virtual bool bold() const
Gets whether the text is bold.
ComboBox()
Constructs an empty ComboBox object.
Alignment
Text alignment options.
Definition: hdicoreComboBox.h:33
static ComboBox ComboBoxWithID(const Point &loc_, const double width_, const EntryVector &entries_, const std::string &initialID_)
Named constructor for a combo box with an initial ID selected.
virtual bool setCurrentID(const std::string &id_)
Sets the currently selected entry by ID.
virtual bool expanded() const
Gets the expansion state of the combo box's popup menu.
ComboBox(const ComboBox &combobox_)
Constructs a new ComboBox object from an existing ComboBox object (copy constructor)
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)
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 setAlignment(const Alignment alignment_)
Sets the current alignment of the text field.
virtual ComboBox * duplicate() const
Convenience method to duplicate a ComboBox object, creating a new and identical UI element to the tar...
virtual void valueChanging()
Simulates the value of the combo box changing.
virtual int32_t currentIndex() const
Gets the index of the currently selected entry.
virtual bool removeEntry(const std::string &id_, PopupEntry &entry__)
Removes a specific entry from the list of entries.
virtual bool popEntry(PopupEntry &entry__)
Pops an entry off the list (i.e. from the end)
virtual bool setCurrentIndex(const int32_t index_)
Sets the currently selected entry by index.
virtual ~ComboBox()
ComboBox destructor.
virtual bool currentUserData(void *&data__) const
Gets the user data for the current entry.
virtual void setBold(const bool bold_)
Sets the font weight.
virtual std::shared_ptr< PopupEntry > entryWithID(const std::string &id_) const
Gets the entry with the given ID, provided it exists within the widget.
virtual void setValueChangedCallback(const Callback &callback_)
Sets the value changed callback.
virtual bool pushEntry(const PopupEntry &entry_)
Pushes an entry onto the list (i.e. at the end)
virtual void setValueChangingCallback(const Callback &callback_)
Sets the value changing callback.
virtual std::unique_ptr< PopupEntry > currentEntry() const
Gets the current entry object.
ComboBox(const Point &loc_, const double width_, const EntryVector &entries_, const int32_t initialIndex_)
Constructs a combo box.
virtual void setEntries(const EntryVector &entries_)
Allows the entries in an combo box to be changed out entirely.
virtual std::string currentID() const
Gets the ID of the currently selected entry.
virtual bool hasEntry(const std::string &id_) const
Gets whether the entries vector already contains an entry, based on its ID.
virtual ModifierKey lastModifierKeys() const
Gets the last set of modifier keys used when typing into the field.
virtual ComboBox & operator=(const ComboBox &rhs_)
Allows one ComboBox object to be assigned from another.
virtual bool insertEntry(const std::string &id_, const PopupEntry &entry_)
Inserts an entry into the list of entries at a given position.
virtual Callback *const valueChangedCallback() const
Gets the value changed callback for the combo box.
virtual void clearEntries()
Clears all entries contained by the widget.
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 Alignment alignment() const
Gets the current alignment of the text field.
virtual bool italic() const
Gets whether the text is italicized.
virtual ComboBox * clone() const
Convenience method to clone a ComboBox object on the heap.
virtual void update()
Force the combo box to update its entries.
virtual std::string lastCharTyped() const
Gets the last character typed into the field.
virtual bool setCurrentValue(const std::string &value_)
Sets the currently selected entry by string value.
virtual const std::vector< std::shared_ptr< PopupEntry > > *const entries() const
Gets the entries vector.
static ComboBox ComboBoxWithValue(const Point &loc_, const double width_, const EntryVector &entries_, const std::string &value_)
Named constructor for a combo box with an initial string value (whether it's in the entries_ argument...
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:38
Allows combo boxes, popups, and flyouts to store more data than simply strings and indices.
Definition: hdicorePopupEntry.h:20
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.