Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
hdicorePopupMenu.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_POPUP_MENU__
8 #define __HDI_CORE_POPUP_MENU__
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  class Font;
21 
25  class PopupMenu : public Widget
26  {
27  public:
28  typedef std::vector<ListEntry> EntryVector;
29 
41  PopupMenu();
42 
50  PopupMenu(const PopupMenu& popup_);
51 
60  PopupMenu(const Point& loc_, const double width_);
61 
72  PopupMenu(
73  const Point& loc_,
74  const double width_,
75  const EntryVector& entries_,
76  const int32_t initialIndex_
77  );
78 
90  PopupMenu(
91  const Point& loc_,
92  const double width_,
93  const EntryVector& entries_,
94  const std::string& initialID_
95  );
96 
110  static PopupMenu FontMenu(const Point& loc_, const double width_, const Font& font_);
111 
117  virtual ~PopupMenu();
118 
127  virtual PopupMenu& operator=(const PopupMenu& rhs_);
128 
142  virtual PopupMenu* clone() const;
143 
160  virtual PopupMenu* duplicate() const;
161 
167  virtual void selectUnknownEntry();
168 
174  virtual void deselectUnknownEntry();
175 
183  virtual int32_t currentIndex() const;
184 
193  virtual bool setCurrentIndex(const int32_t index_);
194 
202  virtual std::string currentID() const;
203 
212  virtual bool setCurrentID(const std::string& id_);
213 
221  virtual std::string currentValue() const;
222 
231  virtual bool setCurrentValue(const std::string& value_);
232 
240  virtual std::auto_ptr<ListEntry> currentEntry() const;
241 
250  virtual bool currentUserData(void*& data__) const;
251 
262  virtual const std::vector< ListEntry* >* const entries() const;
263 
271  virtual void setEntries(const EntryVector& entries_);
272 
281  virtual bool hasEntry(const std::string& id_) const;
282 
293  virtual bool pushEntry(const ListEntry& entry_);
294 
309  virtual bool popEntry(ListEntry& entry__);
310 
325  virtual bool insertEntry(const std::string& id_, const ListEntry& entry_);
326 
342  virtual bool removeEntry(const std::string& id_, ListEntry& entry__);
343 
349  virtual void clearEntries();
350 
356  virtual void valueChanged();
357 
365  virtual Callback* const valueChangedCallback() const;
366 
374  virtual void setValueChangedCallback(const Callback& callback_);
375 
381  virtual void update();
382  };
383 
384  typedef std::auto_ptr<PopupMenu> PopupMenuAP;
385  }
386 }
387 
388 #endif
389 // __HDI_CORE_POPUP_MENU__
Base class for all interface widgets; handles many common needs, e.g. text, position, size, etc.
Definition: hdicoreWidget.h:39
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.
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:26
virtual void setValueChangedCallback(const Callback &callback_)
Sets the value changed callback.
virtual void clearEntries()
Clears all entries contained by the widget.
PopupMenu()
Constructs an empty PopupMenu object.
virtual Callback *const valueChangedCallback() const
Gets the value changed callback for the popup menu.
virtual bool popEntry(ListEntry &entry__)
Pops an entry off the list (i.e. from the end)
virtual bool currentUserData(void *&data__) const
Gets the user data for the current entry.
virtual void valueChanged()
Simulates the popup menu having its value changed.
virtual bool insertEntry(const std::string &id_, const ListEntry &entry_)
Inserts an entry into the list of entries at a given position.
Allows combo boxes, popups, and lists to store more data than simply strings and indices.
Definition: hdicoreListEntry.h:24
virtual std::auto_ptr< ListEntry > currentEntry() const
Gets the current entry object.
Base class for templated __Callback class.
Definition: hdicoreCallback.h:67
virtual void selectUnknownEntry()
In the case of a mixed popup state, this will create and select a blank entry.
virtual bool removeEntry(const std::string &id_, ListEntry &entry__)
Removes a specific entry from the list of entries.
virtual PopupMenu & operator=(const PopupMenu &rhs_)
Allows one PopupMenu object to be assigned from another.
virtual ~PopupMenu()
PopupMenu destructor.
Font class to allow for easy font manipulation.
Definition: hdicoreFont.h:170
virtual int32_t currentIndex() const
Gets the index of the currently selected entry.
virtual bool setCurrentIndex(const int32_t index_)
Sets the currently selected entry by index.
virtual PopupMenu * duplicate() const
Convenience method to duplicate a PopupMenu object, creating a new and identical UI element to the ta...
virtual void setEntries(const EntryVector &entries_)
Allows the entries in an popup menu to be changed out entirely.
Popup menu widget, allowing for a single preset entry to be chosen at a time.
Definition: hdicorePopupMenu.h:25
Definition: hdicoreaiArray.h:12
Header file for Illustrator user interface widgets.
virtual void update()
Force the popup menu to update its entries.
static PopupMenu FontMenu(const Point &loc_, const double width_, const Font &font_)
Static named constructor for creating a font menu with a preselected font object. ...
virtual const std::vector< ListEntry * > *const entries() const
Gets the entries vector.
virtual std::string currentValue() const
Gets the string value of the currently selected entry.
virtual bool pushEntry(const ListEntry &entry_)
Pushes an entry onto the list (i.e. at the end)
virtual PopupMenu * clone() const
Convenience method to clone a PopupMenu object on the heap.
virtual void deselectUnknownEntry()
In the case of a (prior) mixed popup state, this will deselect and destroy the blank entry...
virtual bool setCurrentID(const std::string &id_)
Sets the currently selected entry by ID.
virtual bool setCurrentValue(const std::string &value_)
Sets the currently selected entry by string value.