HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AP_Interface Class Reference

#include <AP_Interface.h>

+ Inheritance diagram for AP_Interface:

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_StringgetName () 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_ValuefindValueSymbol (const char *symbol) const
 Find the UI_Value for the given named value symbol. More...
 
UI_ValuegetValueSymbol (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_ObjectgetObjectSymbol (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 >
TfindObject (const char *name) const
 
template<typename T >
TfindValue (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_Objectoperator= (const UI_Object &)=delete
 
virtual int interestingEvent (UI_EventType t, UI_DeviceEvent *event) const
 
virtual void deleteReferences (UI_Object *to_whom)
 
UI_ObjectgetParent () 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_ObjectListdependents () 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_ValueListvalueInterests () 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_ManagergetManager ()
 
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_NamedValueMapgetValueTable () const
 
UI_NamedObjectMapgetObjectTable () const
 
void processKeyBindingProxyRequests ()
 
- Protected Member Functions inherited from UI_Object
UI_ObjectListdependents ()
 
virtual void preTerminateCallback ()
 

Static Protected Member Functions

static void setTheMainApplication (AP_Interface *app)
 
static AP_InterfacegetMainApplication ()
 
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
 

Detailed Description

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.

Examples:
ui/cmd_ui.C.

Definition at line 47 of file AP_Interface.h.

Constructor & Destructor Documentation

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.

AP_Interface::~AP_Interface ( )
override

Member Function Documentation

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.

const char* AP_Interface::className ( ) const
overridevirtual
static void AP_Interface::clearTheMainApplication ( )
staticprotected
static FILE* AP_Interface::createPreferenceFile ( const char *  filename)
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.

template<typename T >
T* AP_Interface::findObject ( const char *  name) const
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.

template<typename T >
T* AP_Interface::findValue ( const char *  name) const
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 int AP_Interface::getAppExitCode ( )
static
virtual bool AP_Interface::getCoreDumpFileName ( UT_WorkBuffer name)
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.

bool AP_Interface::getFunctionKeyScript ( int  key,
UI_Event event,
UT_String script 
)
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().

static AP_Interface* AP_Interface::getMainApplication ( )
inlinestaticprotected

Definition at line 274 of file AP_Interface.h.

const UT_String& AP_Interface::getName ( ) const
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.

UI_NamedObjectMap* AP_Interface::getObjectTable ( ) const
inlineprotected

Definition at line 282 of file AP_Interface.h.

static bool AP_Interface::getSaveWindowGeoPref ( )
staticprotected
static const char* AP_Interface::getStartupDesktop ( )
static
UI_Value* AP_Interface::getValueSymbol ( const char *  symbol,
int  create = 1 
)

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().

Examples:
ui/cmd_ui.C.
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.

UI_NamedValueMap* AP_Interface::getValueTable ( ) const
inlineprotected

Definition at line 281 of file AP_Interface.h.

static bool AP_Interface::getWindowGeometry ( int width,
int height,
int left,
int bottom,
bool &  maximized,
bool  use_pref 
)
staticprotected
void AP_Interface::handleEvent ( UI_Event event)
overridevirtual

Reimplemented from UI_Object.

bool AP_Interface::hasKeyDelegateSymbol ( const char *  symbol) const

Returns whether the current key delegate symbol is defined.

virtual void AP_Interface::initApplication ( UI_Manager uims,
int  argc,
const char **  argv 
)
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 bool AP_Interface::isAppExiting ( )
static

Returns true if the application is exiting.

virtual int AP_Interface::loadAppState ( )
virtual
bool AP_Interface::loadUIInitPrefs ( )
static void AP_Interface::loadWindowGeometry ( UI_Window *  window,
bool  default_maximized,
bool  use_pref 
)
staticprotected
static bool AP_Interface::loadWindowGeoPref ( int w,
int h,
int left,
int bottom,
bool &  maximized 
)
staticprotected
static const char* AP_Interface::mapIntToStr ( int  index,
const std::pair< const char *, int > *  map 
)
static
static int AP_Interface::mapStrToInt ( const char *  label,
const std::pair< const char *, int > *  map 
)
static
virtual void AP_Interface::outputUsage ( int  argc,
const char **  argv 
) const
virtual
void AP_Interface::processKeyBindingProxyRequests ( )
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.

Examples:
ui/cmd_ui.C.
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 int AP_Interface::saveAppData ( const char *  filename)
virtual
virtual int AP_Interface::saveAppState ( )
virtual
virtual void AP_Interface::saveOnCoreDump ( )
virtual
void AP_Interface::saveUIInitPrefs ( const char *  layout_level,
fpreal  uiscale,
int  playbarui 
)
static void AP_Interface::saveWindowGeoPref ( )
staticprotected
static void AP_Interface::setAppExitCode ( int  exit_code)
static
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.

void AP_Interface::setObjectSymbol ( const char *  symbol,
UI_Object who,
int  warn = 1 
)

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.

static void AP_Interface::setTheMainApplication ( AP_Interface app)
staticprotected
void AP_Interface::setValueSymbol ( const char *  symbol,
UI_Value value,
bool  warn = true 
)

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.

Examples:
ui/cmd_ui.C.
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().

Friends And Related Function Documentation

friend class si_CrashHandler
friend

Definition at line 307 of file AP_Interface.h.

Member Data Documentation

UI_EventMethod const* AP_Interface::myMethods
protected

Definition at line 279 of file AP_Interface.h.

UT_String AP_Interface::myName
protected

Definition at line 277 of file AP_Interface.h.

const char* const* AP_Interface::myValueNames
protected

Definition at line 278 of file AP_Interface.h.

const std::pair<const char *, int> AP_Interface::theFileChooserStyleMap[]
static

Menu items and their mapping for file chooser style preference.

Definition at line 242 of file AP_Interface.h.


The documentation for this class was generated from the following file: