HDK
|
#include <AP_Interface.h>
Public Member Functions | |
AP_Interface () | |
AP_Interface (const char *myname, const char *const *names, UI_EventMethod const *methods) | |
~AP_Interface () override | |
const char * | className () const override |
const UT_String & | getName () const |
Return the name passed in the constructor. More... | |
void | wireInterface (UI_Manager *uims) |
void | unwireInterface (UI_Manager *uims) |
bool | readUIFile (const char *ui_filename, bool quiet=false) |
bool | readPreferenceFile (const char *pref_filename, bool quiet=false) |
void | setValueSymbol (const char *symbol, UI_Value *value, bool warn=true) |
UI_Value * | findValueSymbol (const char *symbol) const |
Find the UI_Value for the given named value symbol. More... | |
UI_Value * | getValueSymbol (const char *symbol, int create=1) |
int | getValueSymbols (UT_StringArray &symbols, UT_Array< UI_Value * > &values) const |
void | setObjectSymbol (const char *symbol, UI_Object *who, int warn=1) |
UI_Object * | getObjectSymbol (const char *symbol) const |
UI_Feel * | getFeelSymbol (const char *symbol) const |
UI_Feel * | findValueFeel (UI_Value *value) const |
int | getFeelSymbols (UT_StringArray &symbols, UT_Array< UI_Feel * > &feels) const |
void | setKeyDelegateSymbol (const char *symbol, UI_KeyDelegateSPtr delegate, bool warn=true) |
bool | hasKeyDelegateSymbol (const char *symbol) const |
Returns whether the current key delegate symbol is defined. More... | |
UI_KeyDelegateSPtr | findKeyDelegateSymbol (const char *symbol) const |
Find the UI_KeyDelegate for the given named key delegate symbol. More... | |
UI_KeyDelegateSPtr | getKeyDelegateSymbol (const char *symbol, int create=1) |
void | removeObjectSymbol (const char *symbol) |
Delete the entry for the given object symbol name. More... | |
void | removeValueSymbol (const char *symbol) |
Delete the entry for the given value symbol name. More... | |
template<typename T > | |
T * | findObject (const char *name) const |
template<typename T > | |
T * | findValue (const char *name) const |
virtual void | initApplication (UI_Manager *uims, int argc, const char **argv) |
virtual void | outputUsage (int argc, const char **argv) const |
void | resetApplication () |
void | handleEvent (UI_Event *event) override |
virtual int | saveAppData (const char *filename) |
virtual int | loadAppState () |
virtual int | saveAppState () |
virtual void | saveOnCoreDump () |
virtual bool | getCoreDumpFileName (UT_WorkBuffer &name) |
bool | loadUIInitPrefs () |
void | saveUIInitPrefs (const char *layout_level, fpreal uiscale, int playbarui) |
bool | restoreUIInitPrefs () |
bool | getFunctionKeyScript (int key, UI_Event *event, UT_String &script) |
void | setKeyBindingProxySrc (const char *symbol, UI_Feel *src, bool warn=true) |
void | addKeyBindingProxyRef (const char *symbol, UI_Feel *ref, bool warn=true) |
Public Member Functions inherited from UI_Object | |
UI_Object () | |
virtual | ~UI_Object () |
UI_Object (const UI_Object &)=delete | |
UI_Object & | operator= (const UI_Object &)=delete |
virtual int | interestingEvent (UI_EventType t, UI_DeviceEvent *event) const |
virtual void | deleteReferences (UI_Object *to_whom) |
UI_Object * | getParent () const |
void | setParent (UI_Object *p) |
bool | isAncestor (const UI_Object *who) const |
void | addDependent (UI_Object *who) |
bool | removeDependent (UI_Object *who) |
bool | replaceDependent (UI_Object *who, UI_Object *with) |
bool | isDependent (UI_Object *who) const |
bool | hasDependents () const |
const UI_ObjectList & | dependents () const |
void | sendEvent (const UI_Event &e) const |
void | distributeEvent (UI_Event *event, int upwards) |
void | relayEvent (UI_Event *event, UI_Object *target) |
void | generateEvent (UI_EventType t, UI_Object *target) |
void | purgeEvents (UI_EventType t, UI_Object *target, UI_EventMethod method=0) |
void | triggerImmediateEvent (UI_Event *event, int upwards) |
int | getProxyId () |
void | bumpQueueCount (int dir) |
void | setName (const char *symbolName) |
const char * | getName () const |
void | buildFullPath (UT_WorkBuffer &string) const |
void | debugQueueEventsFor (const UI_Value *value, const char *name, UI_EventType t=UI_EVENT_NO_EVENT) const |
const UI_ValueList & | valueInterests () const |
void | interestedInValue (UI_Value *) |
void | removeValueInterest (UI_Value *) |
void | addKeyDelegateClientship (UI_KeyDelegate *) |
void | removeKeyDelegateClientship (UI_KeyDelegate *) |
Static Public Member Functions | |
static FILE * | createPreferenceFile (const char *filename) |
static int | mapStrToInt (const char *label, const std::pair< const char *, int > *map) |
static const char * | mapIntToStr (int index, const std::pair< const char *, int > *map) |
static void | setAppExitCode (int exit_code) |
static int | getAppExitCode () |
static bool | isAppExiting () |
Returns true if the application is exiting. More... | |
static const char * | getStartupDesktop () |
Static Public Member Functions inherited from UI_Object | |
static UI_Manager * | getManager () |
static UI_Queue * | getInputQueue () |
static int | keycmp (const char *, int key) |
static int | keycmp (const char *, int key, const UI_HotkeyEcho &) |
static void | keyEcho (const char *, const UI_HotkeyEcho &) |
static void | actionKeyEcho (const char *, const char *custom_suffix=0) |
static void | toggleKeyEcho (const char *, bool new_value) |
Static Public Attributes | |
static const std::pair< const char *, int > | theFileChooserStyleMap [] |
Menu items and their mapping for file chooser style preference. More... | |
Protected Member Functions | |
UI_NamedValueMap * | getValueTable () const |
UI_NamedObjectMap * | getObjectTable () const |
void | processKeyBindingProxyRequests () |
Protected Member Functions inherited from UI_Object | |
UI_ObjectList & | dependents () |
virtual void | preTerminateCallback () |
Static Protected Member Functions | |
static void | setTheMainApplication (AP_Interface *app) |
static AP_Interface * | getMainApplication () |
static void | clearTheMainApplication () |
static void | loadWindowGeometry (UI_Window *window, bool default_maximized, bool use_pref) |
static bool | getWindowGeometry (int &width, int &height, int &left, int &bottom, bool &maximized, bool use_pref) |
static bool | getSaveWindowGeoPref () |
static void | saveWindowGeoPref () |
static bool | loadWindowGeoPref (int &w, int &h, int &left, int &bottom, bool &maximized) |
Protected Attributes | |
UT_String | myName |
const char *const * | myValueNames |
UI_EventMethod const * | myMethods |
Friends | |
class | si_CrashHandler |
Base class for interfaces. This class' main responsibility is to maintain hash tables of named UI_Feel "object symbol" and UI_Value "value symbol" items.
Definition at line 47 of file AP_Interface.h.
AP_Interface::AP_Interface | ( | ) |
AP_Interface::AP_Interface | ( | const char * | myname, |
const char *const * | names, | ||
UI_EventMethod const * | methods | ||
) |
Construct with given name and predefined value names with corresponding interests. The actual values are not created until wireInteface() is called. Typically, initApplication() is first called to create the the values and then wireInterface() is called afterwards to attach the methods to the corresponding values.
|
override |
void AP_Interface::addKeyBindingProxyRef | ( | const char * | symbol, |
UI_Feel * | ref, | ||
bool | warn = true |
||
) |
This class maintains a table of requests to assign some feels as binding proxies for other feels.
Such requests often originate during the parsing of .ui files that occurs in subclass initApplication() overrides. These requests are identified by a name, and the order in which the source and references are registered does not matter.
The pointers to the feels are only temporarily stored until a call to processKeyBindingProxyRequests() occurs. At the moment this occurs as part of the wireInterface() method.
|
overridevirtual |
Reimplemented from UI_Object.
Reimplemented in HDK_Sample::MyDialog, HDK_Sample::MSS_CustomBrushState, HDK_Sample::MSS_BrushHairLen, and HDK_Sample::MSS_BrushHairLenSelector.
|
staticprotected |
|
static |
Create new preference file given its base name using standard rules (eg. in $HOME/houdiniX.Y). This may return nullptr if a .nosave file is found.
UI_KeyDelegateSPtr AP_Interface::findKeyDelegateSymbol | ( | const char * | symbol | ) | const |
Find the UI_KeyDelegate for the given named key delegate symbol.
|
inline |
Find the pointer for the given object symbol name, dynamically casted to the given template type.
Definition at line 168 of file AP_Interface.h.
|
inline |
Find the pointer for the given value symbol name, dynamically casted to the given template type.
Definition at line 176 of file AP_Interface.h.
UI_Feel* AP_Interface::findValueFeel | ( | UI_Value * | value | ) | const |
Find the UI_Feel for the given value pointer. Returns nullptr if it doesn't exist.
UI_Value* AP_Interface::findValueSymbol | ( | const char * | symbol | ) | const |
Find the UI_Value for the given named value symbol.
|
static |
|
virtual |
UI_Feel* AP_Interface::getFeelSymbol | ( | const char * | symbol | ) | const |
Find the UI_Feel for the given object symbol name. Returns nullptr if it doesn't exist. This is equivalent to findObject<UI_Feel*>(symbol).
int AP_Interface::getFeelSymbols | ( | UT_StringArray & | symbols, |
UT_Array< UI_Feel * > & | feels | ||
) | const |
Returns all the Symbol/UI_Feel's pairs from the FeelSymbol table return array will contain nullptr values if its symbol doesn't exist.
UI_KeyDelegateSPtr AP_Interface::getKeyDelegateSymbol | ( | const char * | symbol, |
int | create = 1 |
||
) |
Get the UI_KeyDelegate for the given named key delegate symbol, creating it if it doesn't exist yet. If 'create' is false, then getKeyDelegateSymbol() is the same as findKeyDelegateSymbol().
|
inlinestaticprotected |
Definition at line 274 of file AP_Interface.h.
|
inline |
Return the name passed in the constructor.
Definition at line 65 of file AP_Interface.h.
UI_Object* AP_Interface::getObjectSymbol | ( | const char * | symbol | ) | const |
Find the UI_Object for the given object symbol name. Returns nullptr if it doesn't exist.
|
inlineprotected |
Definition at line 282 of file AP_Interface.h.
|
staticprotected |
|
static |
Get the UI_Value for the given named value symbol, creating it if it doesn't exist yet. If 'create' is false, then getValueSymbol() is the same as findValueSymbol().
int AP_Interface::getValueSymbols | ( | UT_StringArray & | symbols, |
UT_Array< UI_Value * > & | values | ||
) | const |
Returns all the Symbol/UI_Value's pairs from the ValueSymbol table return array will contain nullptr values if its symbol doesn't exist.
|
inlineprotected |
Definition at line 281 of file AP_Interface.h.
|
staticprotected |
bool AP_Interface::hasKeyDelegateSymbol | ( | const char * | symbol | ) | const |
Returns whether the current key delegate symbol is defined.
|
virtual |
Initialize this object. This method is intended to be overriden by subclasses since the base class implementation is empty. The subclass typically calls readUIFile() here to create the interface which populates the object and value symbols.
Reimplemented in BM_SimpleState, BM_InputSelector, BM_ParmState, and MSS_SingleOpState.
|
static |
Returns true
if the application is exiting.
|
virtual |
bool AP_Interface::loadUIInitPrefs | ( | ) |
|
staticprotected |
|
staticprotected |
|
static |
|
static |
|
protected |
bool AP_Interface::readPreferenceFile | ( | const char * | pref_filename, |
bool | quiet = false |
||
) |
Read the given preference file given its base name using standard rules. The values will be initialized according to the parsed file into this object.
bool AP_Interface::readUIFile | ( | const char * | ui_filename, |
bool | quiet = false |
||
) |
Turns a .ui file into UI gadgets. If quiet is true, no errors or warnings are printed.
void AP_Interface::removeObjectSymbol | ( | const char * | symbol | ) |
Delete the entry for the given object symbol name.
void AP_Interface::removeValueSymbol | ( | const char * | symbol | ) |
Delete the entry for the given value symbol name.
void AP_Interface::resetApplication | ( | ) |
Resets this object by calling unwireInterface() and then destroying all objects and values.
bool AP_Interface::restoreUIInitPrefs | ( | ) |
|
virtual |
|
virtual |
|
virtual |
|
staticprotected |
void AP_Interface::setKeyBindingProxySrc | ( | const char * | symbol, |
UI_Feel * | src, | ||
bool | warn = true |
||
) |
This class maintains a table of requests to assign some feels as binding proxies for other feels.
Such requests often originate during the parsing of .ui files that occurs in subclass initApplication() overrides. These requests are identified by a name, and the order in which the source and references are registered does not matter.
The pointers to the feels are only temporarily stored until a call to processKeyBindingProxyRequests() occurs. At the moment this occurs as part of the wireInterface() method.
void AP_Interface::setKeyDelegateSymbol | ( | const char * | symbol, |
UI_KeyDelegateSPtr | delegate, | ||
bool | warn = true |
||
) |
Set the named key delegate symbol to the corresponding pointer. If warn is true, then a warning will be issued if the name already exists as an object or value symbol, or if the key delegate symbol name already previously existed.
Set the named object symbol to the corresponding pointer. If warn is true, then a warning will be issued if the name already exists as a value or key delegate symbol, or if the object symbol name already previously existed.
|
staticprotected |
Set the named value symbol to the corresponding pointer. If warn is true, then a warning will be issued if the name already exists as an object or key delegate symbol, or if the value symbol name already previously existed.
void AP_Interface::unwireInterface | ( | UI_Manager * | uims | ) |
void AP_Interface::wireInterface | ( | UI_Manager * | uims | ) |
Attach values names to the methods passed in the constructor. The actual UI_Value's are typically created by calling initApplication() first. If the values do not exist yet, then they are automatically created into uims (if not nullptr), else they will created in this object.
This method also calls processKeyBindingProxyRequests().
|
friend |
Definition at line 307 of file AP_Interface.h.
|
protected |
Definition at line 279 of file AP_Interface.h.
|
protected |
Definition at line 277 of file AP_Interface.h.
|
protected |
Definition at line 278 of file AP_Interface.h.
|
static |
Menu items and their mapping for file chooser style preference.
Definition at line 242 of file AP_Interface.h.