The Desktop provides the services for creating and accessing UI objects in Softimage.
using namespace XSI; Application app; Desktop theDesktop = app.GetDesktop(); app.LogMessage( L"Desktop name: " + theDesktop.GetName() ); Layout activeLayout = theDesktop.GetActiveLayout(); app.LogMessage( L"Active layout name: " + activeLayout.GetName() ); app.LogMessage( L"Listing all loaded layouts" ); CRefArray layoutArray = theDesktop.GetLayouts(); for (LONG i=0; i<layoutArray.GetCount(); i++) { Layout layout = layoutArray[i]; app.LogMessage( L"Layout name: " + layout.GetName() ); }
#include <xsi_desktop.h>
Public Member Functions | |
Desktop () | |
~Desktop () | |
Desktop (const CRef &in_ref) | |
Desktop (const Desktop &in_obj) | |
bool | IsA (siClassID in_ClassID) const |
siClassID | GetClassID () const |
Desktop & | operator= (const Desktop &in_obj) |
Desktop & | operator= (const CRef &in_ref) |
Layout | GetActiveLayout () const |
CStatus | PutActiveLayout (const Layout &in_layout) |
CRefArray | GetLayouts () const |
void | RedrawUI () |
void | SuspendWin32ControlsHook () |
void | RestoreWin32ControlsHook () |
void * | GetApplicationWindowHandle () |
void | SetDefaultOpenGLContext () |
void | DirtyAllViewports () |
Desktop | ( | ) |
Default constructor.
~Desktop | ( | ) |
Default destructor.
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
in_ClassID | class type. |
Reimplemented from SIObject.
siClassID GetClassID | ( | ) | const [virtual] |
Creates an object from another object. The newly created object is set to empty if the input object is not compatible.
in_obj | constant class object. |
Layout GetActiveLayout | ( | ) | const |
Sets the Layout object as active.
in_layout | The new active layout object |
CRefArray GetLayouts | ( | ) | const |
void RedrawUI | ( | ) |
Redraws the user interface. It does this by pausing the execution of the plug-in until all pending window messages have been processed. See also the Refresh and SceneRefresh commands.
void SuspendWin32ControlsHook | ( | ) |
Disables the Win32 hook used by Softimage on Windows controls.
On Windows, this Win32 hook can interfere with the appearance and behavior of controls in the custom display host and other custom user interfaces. The hook does not interfere with property pages and views.
Disable the hook just before you create a custom UI. After you finish creating the custom UI, call Desktop::RestoreWin32ControlsHook to restore the hook.
You do not need to disable the hook for property pages and views, or on Linux.
Do not disable the controls hook at any other time.
void ShowFontDlg() { Application app ; LOGFONT lf; CHOOSEFONT cf ; DWORD rgbCurrent = 0 ; ZeroMemory(&cf, sizeof(cf)); cf.lStructSize = sizeof (cf); // Use the Softimage main window so that the Font // dialog is properly parented cf.hwndOwner = (HWND)app.GetDesktop().GetApplicationWindowHandle(); cf.lpLogFont = &lf; cf.rgbColors = rgbCurrent; cf.Flags = CF_SCREENFONTS | CF_EFFECTS; // Disable the Win32 hook so the // Font dialog is displayed properly app.GetDesktop().SuspendWin32ControlsHook() ; ::ChooseFont(&cf) ; // This function is part of the Win32 API app.GetDesktop().RestoreWin32ControlsHook() ; }
void RestoreWin32ControlsHook | ( | ) |
Restores the Win32 controls hook disabled by a previous call to Desktop::SuspendWin32ControlsHook.
void* GetApplicationWindowHandle | ( | ) |
Returns the platform-specific top Softimage window handle. On Windows, you must cast the return value to an HWND
. On Linux, you get an X
window.
void SetDefaultOpenGLContext | ( | ) |
Sets the default OpenGL context as current. Use this call if you need to initialize OpenGL resources which need to be shared with Softimage.
void DirtyAllViewports | ( | ) |
Explicitly dirties all active viewports and causes a refresh.