Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
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
14namespace hdi
15{
16 namespace core
17 {
18 class Callback;
19 class PopupEntry;
20 class Font;
21
25 class PopupMenu : public Widget
26 {
27 public:
28 typedef std::vector<PopupEntry> EntryVector;
29
42
50 PopupMenu(const PopupMenu& popup_);
51
60 PopupMenu(const Point& loc_, const double width_);
61
73 const Point& loc_,
74 const double width_,
75 const EntryVector& entries_,
76 const int32_t initialIndex_
77 );
78
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::unique_ptr<PopupEntry> currentEntry() const;
241
250 virtual bool currentUserData(void*& data__) const;
251
262 virtual const std::vector< std::shared_ptr<PopupEntry> >* const entries() const;
263
271 virtual void setEntries(const EntryVector& entries_);
272
281 virtual bool hasEntry(const std::string& id_) const;
282
291 virtual std::shared_ptr<PopupEntry> entryWithID(const std::string& id_) const;
292
303 virtual bool pushEntry(const PopupEntry& entry_);
304
319 virtual bool popEntry(PopupEntry& entry__);
320
335 virtual bool insertEntry(const std::string& id_, const PopupEntry& entry_);
336
352 virtual bool removeEntry(const std::string& id_, PopupEntry& entry__);
353
359 virtual void clearEntries();
360
366 virtual void valueChanged();
367
375 virtual Callback* const valueChangedCallback() const;
376
384 virtual void setValueChangedCallback(const Callback& callback_);
385
391 virtual void update();
392 };
393
394 typedef std::unique_ptr<PopupMenu> PopupMenuUP;
395 typedef std::shared_ptr<PopupMenu> PopupMenuSP;
396 typedef std::weak_ptr<PopupMenu> PopupMenuWP;
397 }
398}
399
400#endif
401// __HDI_CORE_POPUP_MENU__
Base class for templated __Callback class.
Definition: hdicoreCallback.h:68
Font class to allow for easy font manipulation.
Definition: hdicoreFont.h:183
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
Popup menu widget, allowing for a single preset entry to be chosen at a time.
Definition: hdicorePopupMenu.h:26
virtual std::string currentID() const
Gets the ID of the currently selected entry.
virtual bool popEntry(PopupEntry &entry__)
Pops an entry off the list (i.e. from the end)
virtual ~PopupMenu()
PopupMenu destructor.
virtual bool setCurrentValue(const std::string &value_)
Sets the currently selected entry by string value.
PopupMenu(const PopupMenu &popup_)
Constructs a new PopupMenu object from an existing PopupMenu object (copy constructor)
virtual PopupMenu * clone() const
Convenience method to clone a PopupMenu object on the heap.
virtual std::string currentValue() const
Gets the string value of the currently selected entry.
virtual void clearEntries()
Clears all entries contained by the widget.
virtual void setValueChangedCallback(const Callback &callback_)
Sets the value changed callback.
virtual const std::vector< std::shared_ptr< PopupEntry > > *const entries() const
Gets the entries vector.
virtual bool insertEntry(const std::string &id_, const PopupEntry &entry_)
Inserts an entry into the list of entries at a given position.
PopupMenu(const Point &loc_, const double width_, const EntryVector &entries_, const int32_t initialIndex_)
Constructs a PopupMenu widget with a list of entries and an initial index selection.
PopupMenu(const Point &loc_, const double width_)
Constructs an empty PopupMenu widget at a given location of a given width.
virtual void update()
Force the popup menu to update its entries.
virtual bool pushEntry(const PopupEntry &entry_)
Pushes an entry onto the list (i.e. at the end)
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...
PopupMenu(const Point &loc_, const double width_, const EntryVector &entries_, const std::string &initialID_)
Constructs a PopupMenu widget with a list of entries and an initial ID selection.
PopupMenu()
Constructs an empty PopupMenu object.
virtual void valueChanged()
Simulates the popup menu having its value changed.
virtual bool currentUserData(void *&data__) const
Gets the user data for the current entry.
virtual bool removeEntry(const std::string &id_, PopupEntry &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 std::shared_ptr< PopupEntry > entryWithID(const std::string &id_) const
Gets the entry with the given ID, provided it exists within the widget.
virtual Callback *const valueChangedCallback() const
Gets the value changed callback for the popup menu.
virtual bool hasEntry(const std::string &id_) const
Gets whether the entries vector already contains an entry, based on its ID.
virtual std::unique_ptr< PopupEntry > currentEntry() const
Gets the current entry object.
virtual bool setCurrentID(const std::string &id_)
Sets the currently selected entry by ID.
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 void deselectUnknownEntry()
In the case of a (prior) mixed popup state, this will deselect and destroy the blank entry.
virtual void setEntries(const EntryVector &entries_)
Allows the entries in an popup menu to be changed out entirely.
virtual int32_t currentIndex() const
Gets the index of the currently selected entry.
virtual void selectUnknownEntry()
In the case of a mixed popup state, this will create and select a blank entry.
Base class for all interface widgets; handles many common needs, e.g. text, position,...
Definition: hdicoreWidget.h:30
Header file for plugin user interface widgets.