# Desktop Class Reference

Related Scripting Object: Desktop

The Desktop provides the services for creating and accessing UI objects in Softimage. More...

`#include <xsi_desktop.h>`

Inheritance diagram for Desktop:

List of all members.

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

## Detailed Description

The Desktop provides the services for creating and accessing UI objects in Softimage.

Since:
  4.0

Example:

              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() );
              }

## Constructor & Destructor Documentation

Desktop | ( |  | ) |

Default constructor.

~Desktop | ( |  | ) |

Default destructor.

Desktop | ( | const CRef & | in_ref | ) |

Constructor.

Parameters:

  | in_ref | constant reference object.

Desktop | ( | const Desktop & | in_obj | ) |

Copy constructor.

Parameters:

  | in_obj | constant class object.

## Member Function Documentation

bool IsA | ( | siClassID | in_ClassID | ) | const`[virtual]`

Returns true if a given class type is compatible with this API class.

Parameters:

  | in_ClassID | class type.

Returns:
  true if the class is compatible, false otherwise.

Reimplemented from SIObject.

siClassID GetClassID | ( |  | ) | const`[virtual]`

Returns the type of the API class.

Returns:
  The class type.

Reimplemented from SIObject.

Desktop& operator= | ( | const Desktop & | in_obj | ) |

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:

  | in_obj | constant class object.

Returns:
  The new Desktop object.

Desktop& operator= | ( | const CRef & | in_ref | ) |

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:

  | in_ref | constant class object.

Returns:
  The new Desktop object.

Reimplemented from SIObject.

Layout GetActiveLayout | ( |  | ) | const

Returns the current active Layout object.

Returns:
  The active Layout,

CStatus PutActiveLayout | ( | const Layout & | in_layout | ) |

Sets the Layout object as active.

Parameters:

  | in_layout | The new active layout object

Returns:
  CStatus::OK success

  CStatus::Fail failure

CRefArray GetLayouts | ( |  | ) | const

Returns an array of Layout objects currently loaded in Softimage.

Returns:
  Array of Layout objects,

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.

Warning:
  Use this function with caution. Calling it frequently can significantly slow down the execution of a plug-in. Redrawing the UI can have implications beyond just the pixels on the screen; for example, render regions may be recalculated and parts of the scene may be re-evaluated.

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.

Warning:
  Softimage will not function properly if you do not restore the controls hook.

Since:
  5.0

Example:
  Demonstrates suspending and restoring the Windows controls hook

Warning:
  This example uses the Win32 API and therefore does not run on Linux.

            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.

Since:
  5.0

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.

Returns:
  Window handle.

See also:
  ViewContext::GetParentWindowHandle

Since:
  5.0

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

- xsi_desktop.h