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)
 
virtual ~AP_Interface ()
 
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
 
void removeObjectSymbol (const char *symbol)
 Delete the entry for the given object 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)
 
void resetApplication ()
 
virtual void handleEvent (UI_Event *event)
 
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, int playbarui)
 
bool restoreUIInitPrefs ()
 
bool getFunctionKeyScript (UI_Event *event, UT_String &script)
 
- 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)
 
virtual const char * className () const
 
int getProxyId ()
 
void bumpQueueCount (int dir)
 
void setName (const char *symbolName)
 
const char * getName () const
 
void buildFullPath (UT_String &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 *)
 

Static Public Member Functions

static FILE * createPreferenceFile (const char *filename)
 
static int mapStrToInt (const char *label, const UT_Pair< const char *, int > *map)
 
static const char * mapIntToStr (int index, const UT_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 UT_Pair< const
char *, int
theFileChooserStyleMap []
 Menu items and their mapping for file chooser style preference. More...
 

Protected Member Functions

UI_NamedValueMapgetValueTable (void) const
 
UI_NamedObjectMapgetObjectTable (void) const
 
virtual void getSignalList (int *signals, int max_signals)
 
- Protected Member Functions inherited from UI_Object
UI_ObjectListdependents ()
 
virtual void preTerminateCallback ()
 

Static Protected Member Functions

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

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 35 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.

virtual AP_Interface::~AP_Interface ( )
virtual

Member Function Documentation

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.

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 124 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 132 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).

bool AP_Interface::getFunctionKeyScript ( UI_Event event,
UT_String script 
)
static AP_Interface* AP_Interface::getMainApplication ( )
inlinestaticprotected

Definition at line 207 of file AP_Interface.h.

const UT_String& AP_Interface::getName ( void  ) const
inline

Return the name passed in the constructor.

Definition at line 51 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 ( void  ) const
inlineprotected

Definition at line 214 of file AP_Interface.h.

static bool AP_Interface::getSaveWindowGeoPref ( )
staticprotected
virtual void AP_Interface::getSignalList ( int signals,
int  max_signals 
)
protectedvirtual
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 ( void  ) const
inlineprotected

Definition at line 213 of file AP_Interface.h.

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

Reimplemented from UI_Object.

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, and BM_ParmState.

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 UT_Pair< const char *, int > *  map 
)
static
static int AP_Interface::mapStrToInt ( const char *  label,
const UT_Pair< const char *, int > *  map 
)
static
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. If defines is specified, this allows you to pass CPP style symbols to the parser, in the form "SYMBOL=VALUE". =VALUE may be omitted.

Examples:
ui/cmd_ui.C.
void AP_Interface::removeObjectSymbol ( const char *  symbol)

Delete the entry for the given object 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,
int  playbarui 
)
static void AP_Interface::saveWindowGeoPref ( )
staticprotected
static void AP_Interface::setAppExitCode ( int  exit_code)
static
static void AP_Interface::setAppForeground ( )
staticprotected
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 an value 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 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.

Friends And Related Function Documentation

friend class si_CrashHandler
friend

Definition at line 237 of file AP_Interface.h.

Member Data Documentation

UI_EventMethod const* AP_Interface::myMethods
protected

Definition at line 211 of file AP_Interface.h.

UT_String AP_Interface::myName
protected

Definition at line 209 of file AP_Interface.h.

const char* const* AP_Interface::myValueNames
protected

Definition at line 210 of file AP_Interface.h.

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

Menu items and their mapping for file chooser style preference.

Definition at line 172 of file AP_Interface.h.


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