Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
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 
14 namespace hdi
15 {
16  namespace core
17  {
18  class Callback;
19  class ListEntry;
20 
24  class ComboBox : public Widget
25  {
26  public:
27  typedef std::vector<ListEntry> EntryVector;
28 
32  enum Alignment
33  {
34  UnknownAlignment = 0,
35  LeftAlignment = 10,
36  CenterAlignment = 20,
37  RightAlignment = 30
38  };
39 
50  ComboBox();
51 
59  ComboBox(const ComboBox& combobox_);
60 
69  ComboBox(const Point& loc_, const double width_);
70 
81  ComboBox(
82  const Point& loc_,
83  const double width_,
84  const EntryVector& entries_,
85  const int32_t initialIndex_
86  );
87 
100  static ComboBox ComboBoxWithID(
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::auto_ptr<ListEntry> currentEntry() const;
297 
306  virtual bool currentUserData(void*& data__) const;
307 
318  virtual const std::vector< ListEntry* >* const entries() const;
319 
328  virtual bool hasEntry(const std::string& id_) const;
329 
337  virtual void setEntries(const EntryVector& entries_);
338 
349  virtual bool pushEntry(const ListEntry& entry_);
350 
360  virtual bool popEntry(ListEntry& entry__);
361 
376  virtual bool insertEntry(const std::string& id_, const ListEntry& entry_);
377 
388  virtual bool removeEntry(const std::string& id_, ListEntry& entry__);
389 
395  virtual void clearEntries();
396 
402  virtual void valueChanging();
403 
411  virtual Callback* const valueChangingCallback() const;
412 
420  virtual void setValueChangingCallback(const Callback& callback_);
421 
427  virtual void valueChanged();
428 
436  virtual Callback* const valueChangedCallback() const;
437 
445  virtual void setValueChangedCallback(const Callback& callback_);
446 
452  virtual void update();
453  };
454 
455  typedef std::auto_ptr<ComboBox> ComboBoxAP;
456  }
457 }
458 
459 #endif
460 // __HDI_CORE_COMBO_BOX__
virtual bool removeEntry(const std::string &id_, ListEntry &entry__)
Removes a specific entry from the list of entries.
virtual void clearEntries()
Clears all entries contained by the widget.
Combo box widget, which consists of a text-field for custom input and a popup menu for preset values...
Definition: hdicoreComboBox.h:24
Base class for all interface widgets; handles many common needs, e.g. text, position, size, etc.
Definition: hdicoreWidget.h:39
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 std::string currentID() const
Gets the ID of the currently selected entry.
virtual void setValueChangedCallback(const Callback &callback_)
Sets the value changed callback.
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.
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:26
virtual int32_t currentIndex() const
Gets the index of the currently selected entry.
virtual void setValueChangingCallback(const Callback &callback_)
Sets the value changing callback.
virtual bool setCurrentValue(const std::string &value_)
Sets the currently selected entry by string value.
virtual bool italic() const
Gets whether the text is italicized.
virtual void setBold(const bool bold_)
Sets the font weight.
virtual void setAlignment(const Alignment alignment_)
Sets the current alignment of the text field.
virtual void update()
Force the combo box to update its entries.
virtual bool pushEntry(const ListEntry &entry_)
Pushes an entry onto the list (i.e. at the end)
ComboBox()
Constructs an empty ComboBox object.
virtual ~ComboBox()
ComboBox destructor.
virtual Callback *const valueChangingCallback() const
Gets the value changing callback for the combo box.
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...
virtual void setEntries(const EntryVector &entries_)
Allows the entries in an combo box to be changed out entirely.
virtual std::auto_ptr< ListEntry > currentEntry() const
Gets the current entry object.
virtual ComboBox * duplicate() const
Convenience method to duplicate a ComboBox object, creating a new and identical UI element to the tar...
Allows combo boxes, popups, and lists to store more data than simply strings and indices.
Definition: hdicoreListEntry.h:24
Base class for templated __Callback class.
Definition: hdicoreCallback.h:67
virtual bool bold() const
Gets whether the text is bold.
virtual ComboBox * clone() const
Convenience method to clone a ComboBox object on the heap.
virtual bool setCurrentID(const std::string &id_)
Sets the currently selected entry by ID.
virtual const std::vector< ListEntry * > *const entries() const
Gets the entries vector.
Definition: hdicoreaiArray.h:12
Alignment
Text alignment options.
Definition: hdicoreComboBox.h:32
Header file for Illustrator user interface widgets.
virtual void valueChanging()
Simulates the value of the combo box changing.
virtual bool currentUserData(void *&data__) const
Gets the user data for the current entry.
virtual void valueChanged()
Simulates the combo box having its value changed.
virtual ComboBox & operator=(const ComboBox &rhs_)
Allows one ComboBox object to be assigned from another.
virtual Alignment alignment() const
Gets the current alignment of the text field.
virtual bool setCurrentIndex(const int32_t index_)
Sets the currently selected entry by index.
virtual bool insertEntry(const std::string &id_, const ListEntry &entry_)
Inserts an entry into the list of entries at a given position.
virtual void setItalic(const bool italic_)
Sets the font style.
virtual bool popEntry(ListEntry &entry__)
Pops an entry off the list (i.e. from the end)
virtual Callback *const valueChangedCallback() const
Gets the value changed callback for the combo box.
virtual bool hasEntry(const std::string &id_) const
Gets whether the entries vector already contains an entry, based on its ID.