c4d_gui.h File Reference

Classes

class  C4DGadget
 
class  GadgetPtr
 
class  GeUserArea
 
class  TriState< TYPE >
 
class  UpdateDialogHelper
 
class  GeDialog
 
class  GeModalDialog
 
class  SubDialog
 
class  iCustomGui
 
class  ProgressThread
 
class  ProgressDialog
 
class  AutoWaitPointer
 

Namespaces

 maxon
 

Macros

#define IDC_OK
 
#define IDC_CANCEL
 
#define FIRST_POPUP_ID
 
#define MENU_ALLOWSUBMENUCOMMAND
 
#define IDM_CM_CLOSEWINDOW
 
#define MAXTIME
 
#define COREMSG_CINEMA_GETCOMMANDNAME
 
#define COREMSG_CINEMA_GETCOMMANDENABLED
 
#define COREMSG_CINEMA_GETCOMMANDCHECKED
 
#define COREMSG_CINEMA_EXECUTEEDITORCOMMAND
 
#define COREMSG_CINEMA_EXECUTESUBID
 
#define COREMSG_CINEMA_EXECUTEOPTIONMODE
 
#define COREMSG_CINEMA_GETCOMMANDHELP
 
#define COREMSG_CINEMA_FORCE_AM_UPDATE
 
#define COREMSG_UPDATECOMMANDSMESSAGE
 
#define C4DGUIPTR
 
#define C4DGUINOPTR
 
#define C4DGUISCROLLPARENT
 
#define C4DGUIWINDOWID
 
#define DRAWTEXT_HALIGN_LEFT
 
#define DRAWTEXT_HALIGN_CENTER
 
#define DRAWTEXT_HALIGN_RIGHT
 
#define DRAWTEXT_HALIGN_MASK
 
#define DRAWTEXT_VALIGN_TOP
 
#define DRAWTEXT_VALIGN_CENTER
 
#define DRAWTEXT_VALIGN_BOTTOM
 
#define DRAWTEXT_VALIGN_MASK
 
#define DRAWTEXT_STD_ALIGN
 
#define MOUSEMOVE_DELTA_TABLET
 
#define MOUSEMOVE_DELTA_MOUSE
 
#define GUI_MAXRANGE
 
#define GUI_MINRANGE
 
#define GROUPWEIGHTS_PERCENT_W_CNT
 
#define GROUPWEIGHTS_PERCENT_W_VAL
 
#define GROUPWEIGHTS_PERCENT_H_CNT
 
#define GROUPWEIGHTS_PERCENT_H_VAL
 
#define LAYOUTMODE_NONE
 
#define LAYOUTMODE_MINIMIZED
 
#define LAYOUTMODE_MAXIMIZED
 
#define MOUSEPOS
 
#define INTERFACE_ICON_TYPE_NORMAL
 
#define INTERFACE_ICON_TYPE_DISABLED
 
#define INTERFACE_ICON_TYPE_FOCUS
 

Typedefs

typedef UChar OBSOLETE
 

Enumerations

enum  {
  FORMAT_FLOAT ,
  FORMAT_INT ,
  FORMAT_PERCENT ,
  FORMAT_DEGREE ,
  FORMAT_METER ,
  FORMAT_FRAMES ,
  FORMAT_SECONDS ,
  FORMAT_SMPTE
}
 

Functions

Int32 SizePixChr (Int32 pixels, Int32 chars)
 
Int32 SizePix (Int32 pixels)
 
Int32 SizeChr (Int32 chars)
 
void MessageDialog (const maxon::String &str)
 
void MessageDialog (Int32 id)
 
void MessageDialog (Int32 id, const maxon::String &p1)
 
void MessageDialog (Int32 id, const maxon::String &p1, const maxon::String &p2)
 
Bool QuestionDialog (const maxon::String &str)
 
Bool QuestionDialog (Int32 id)
 
Bool QuestionDialog (Int32 id, const maxon::String &p1)
 
Bool QuestionDialog (Int32 id, const maxon::String &p1, const maxon::String &p2)
 
Bool GetInputEvent (Int32 askdevice, BaseContainer &res)
 
Bool GetInputState (Int32 askdevice, Int32 askchannel, BaseContainer &res)
 
Int32 ShowPopupMenu (CDialog *cd, Int32 screenx, Int32 screeny, const BaseContainer &bc, Int32 flags=POPUP_RIGHT|POPUP_EXECUTECOMMANDS|POPUP_ALLOW_FILTERING, Int32 *res_mainid=nullptr)
 
Bool RemoveLastCursorInfo (LASTCURSORINFOFUNC func)
 
String Shortcut2String (Int32 shortqual, Int32 shortkey)
 
String Shortcut2String (const BaseContainer &sc)
 
Vector GetGuiWorldColor (Int32 cid)
 
Bool GetIconCoordInfo (Int32 &id, const Char *ident)
 
Bool GetInterfaceIcon (Int32 type, Int32 id_x, Int32 id_y, Int32 id_w, Int32 id_h, IconData &d)
 
Bool GeIsTabletMode ()
 
Float GetMouseMoveDelta ()
 
void SetBakeStatus (Bool state)
 
Bool GetBakeStatus ()
 
Filename GetDnDFilename (const BaseContainer &msg, Int32 dragType, const void *dragObj, Bool texturesOnly, Bool updateUsage, Bool loadUrl)
 

TriState Set

#define FLAG_CENTER_HORIZ
 
#define FLAG_CENTER_VERT
 
#define FLAG_ALIGN_RIGHT
 

Macro Definition Documentation

◆ IDC_OK

#define IDC_OK

◆ IDC_CANCEL

#define IDC_CANCEL

◆ FIRST_POPUP_ID

#define FIRST_POPUP_ID

The first valid sub-menu item ID.

See also
ShowPopupMenu

◆ MENU_ALLOWSUBMENUCOMMAND

#define MENU_ALLOWSUBMENUCOMMAND

◆ IDM_CM_CLOSEWINDOW

#define IDM_CM_CLOSEWINDOW

The menu ID for a close menu item. Can be used in dialog menus.

◆ MAXTIME

#define MAXTIME

The default maximum time value. Equal to 1.0 hours at 30 fps i.e. about 2.77 hours.

◆ C4DGUIPTR

#define C4DGUIPTR

ID used for GadgetPtr when initialized with a gadget pointer.

◆ C4DGUINOPTR

#define C4DGUINOPTR

ID used for GadgetPtr when not initialized with a gadget pointer.

◆ C4DGUISCROLLPARENT

#define C4DGUISCROLLPARENT

ID used for parent GadgetPtr when retrieving the dimensions of the Dialog within a scrollgroup.

◆ C4DGUIWINDOWID

#define C4DGUIWINDOWID

ID used for GadgetPtr when querying the size of the window with GetItemDim().

◆ MOUSEPOS

#define MOUSEPOS

Mouse position constant for ShowPopupMenu().

Typedef Documentation

◆ OBSOLETE

typedef UChar OBSOLETE

Function Documentation

◆ SizePixChr()

Int32 SizePixChr ( Int32  pixels,
Int32  chars 
)

Combines SizePix() and SizeChr() functions. The returned value is interpreted as a number of characters/lines plus a number of pixels.

Note
The number of characters for chars has to be multiplied by 10.
For example if a size of 3 characters is needed, pass 3 * 10, or 30 for chars.
Parameters
[in]pixelsThe pixel dimension.
[in]charsThe number of characters.
Returns
The size.

◆ SizePix()

Int32 SizePix ( Int32  pixels)

Bakes a pixel size so that it can be used to specify dialog control dimension.

Parameters
[in]pixelsThe pixel dimension.
Returns
The size.

◆ SizeChr()

Int32 SizeChr ( Int32  chars)

Bakes a character count so that it can be used to specify dialog control dimension.
Calculates how many characters will fit in a control for widths, and how many standard lines will fit for heights.

Note
The number of characters for chars has to be multiplied by 10.
For example if a size of 3 characters is needed, pass 3 * 10, or 30 for chars.
Parameters
[in]charsThe number of characters.
Returns
The size.

◆ MessageDialog() [1/4]

void MessageDialog ( const maxon::String str)

Opens a standard message dialog with an exclamation point icon and an OK button.

Parameters
[in]strThe message to show.

◆ MessageDialog() [2/4]

void MessageDialog ( Int32  id)

Opens a standard dialog with an exclamation point icon and an OK button.

Parameters
[in]idThe message to show, specified as a string ID in the global ::resource object.

◆ MessageDialog() [3/4]

void MessageDialog ( Int32  id,
const maxon::String p1 
)

Opens a standard dialog with an exclamation point icon and an OK button.

Parameters
[in]idThe message to show, specified as a string ID in the global ::resource object, including one phrase that is inserted at #'s in the string.
[in]p1The phrase to insert.

◆ MessageDialog() [4/4]

void MessageDialog ( Int32  id,
const maxon::String p1,
const maxon::String p2 
)

Opens a standard dialog with an exclamation point icon and an OK button.

Parameters
[in]idThe message to show, specified as a string ID in the global ::resource object, including two phrases that are inserted at #'s in the string.
[in]p1The first phrase to insert.
[in]p2The second phrase to insert.

◆ QuestionDialog() [1/4]

Bool QuestionDialog ( const maxon::String str)

Opens a standard question dialog with a question mark icon and Yes/No buttons.

Parameters
[in]strThe message to show.
Returns
true if the user answered Yes, otherwise false.

◆ QuestionDialog() [2/4]

Bool QuestionDialog ( Int32  id)

Opens a standard question dialog with a question mark icon and Yes/No buttons.

Parameters
[in]idThe message to show, specified as a string ID in the global ::resource object.
Returns
true if the user answered Yes, otherwise false.

◆ QuestionDialog() [3/4]

Bool QuestionDialog ( Int32  id,
const maxon::String p1 
)

Opens a standard question dialog with a question mark icon and Yes/No buttons.

Parameters
[in]idThe message to show, specified as a string ID in the global ::resource object, including one phrase that is inserted at #'s in the string.
[in]p1The phrase to insert.
Returns
true if the user answered Yes, otherwise false.

◆ QuestionDialog() [4/4]

Bool QuestionDialog ( Int32  id,
const maxon::String p1,
const maxon::String p2 
)

Opens a standard question dialog with a question mark icon and Yes/No buttons.

Parameters
[in]idThe message to show, specified as a string ID in the global ::resource object, including two phrases that are inserted at #'s in the string.
[in]p1The first phrase to insert.
[in]p2The second phrase to insert.
Returns
true if the user answered Yes, otherwise false.

◆ GetInputEvent()

Bool GetInputEvent ( Int32  askdevice,
BaseContainer res 
)

Gets the next input event for a certain device from the event queue.
If the return value is true, the container stored in res is like an input event message, otherwise no state was available.
For a list of valid devices and channels, see Input Events.

Parameters
[in]askdeviceThe device to poll.
[in]resThe result container.
Returns
true if an input event could be retrieved, otherwise false.

◆ GetInputState()

Bool GetInputState ( Int32  askdevice,
Int32  askchannel,
BaseContainer res 
)

Polls a certain channel of a device for the current input state.
If the return value is true, the container stored in res is like an input event message, otherwise no state was available.
For a list of valid devices and channels, see Input Events.

Parameters
[in]askdeviceThe device to poll.
[in]askchannelThe channel of the device.
[in]resThe result container.
Returns
true if an input state could be retrieved, otherwise false.

◆ ShowPopupMenu()

Int32 ShowPopupMenu ( CDialog *  cd,
Int32  screenx,
Int32  screeny,
const BaseContainer bc,
Int32  flags = POPUP_RIGHT|POPUP_EXECUTECOMMANDS|POPUP_ALLOW_FILTERING,
Int32 res_mainid = nullptr 
)

Displays a popup menu.
The menu is defined by adding string items sequentially to a base container. (The order the items are set in the container determines their order in the menu.)
The ID of the string item determines its function:

  • A string with ID=0 gives a separator
    bc.InsData(0, String(""));
    Definition: c4d_string.h:41
  • A string with ID=1 sets the name of the menu (used for sub-menus)
    bc.SetString(1, "Menu name");
  • IDs in the range 1000 to 899999 inserts a Cinema 4D command
    bc.SetString(id, "CMD");
    For a list of IDs, see the c4d_symbols.coh file. A special case is the IDM_CM_CLOSEWINDOW ID that will close the current dialog.
  • The same applies to plugin IDs of plugins that have a menu entry (everything above 1000000)
    bc.SetString(pluginid, "CMD");
  • The IDs that are left, between 900000 (FIRST_POPUP_ID) and 999999, can be used for custom menu items
    enum
    {
    FIRST_ITEM = FIRST_POPUP_ID,
    SECOND_ITEM,
    THIRD_ITEM
    };
    bc.SetString(FIRST_ITEM, "First item");
    bc.SetString(SECOND_ITEM, "Second item");
    bc.SetString(THIRD_ITEM, "Third item");
    #define FIRST_POPUP_ID
    Definition: c4d_gui.h:69
    Sub-menus are simply inserted as sub-containers
    enum
    {
    NEW_ENTRY = FIRST_POPUP_ID,
    INSERT_NEW,
    INSERT_DOC,
    INSERT_OBJ
    };
    BaseContainer mainmenu;
    mainmenu.SetString(NEW_ENTRY, "New");
    BaseContainer submenu;
    submenu.SetString(1, "Insert new");
    submenu.SetString(INSERT_DOC, "Document");
    submenu.SetString(INSERT_OBJ, "Object");
    mainmenu.SetContainer(INSERT_NEW, submenu);
    Definition: c4d_basecontainer.h:48
    void SetContainer(Int32 id, const BaseContainer &s)
    Definition: c4d_basecontainer.h:679
    void SetString(Int32 id, const maxon::String &s)
    Definition: c4d_basecontainer.h:651
  • Disabled and checked items are marked with flags at the end of the name
    bc.SetString(..., "Disabled&d&");
    bc.SetString(..., "Checked&c&");
    Parameters
    [in]cdThe internal parent dialog, or nullptr.
    [in]screenxThe popup X position in screen pixels, or MOUSEPOS to popup where the cursor is.
    [in]screenyThe popup Y position in screen pixels, or MOUSEPOS to popup where the cursor is.
    [in]bcThe base container with the menu items.
    [in]flagsThe popup menu flags: POPUP
    [in,out]res_mainidThe main id or nullptr if the id is returned normally by the function.
    Returns
    The ID of the selected item, or 0 if nothing was selected.
    Sometimes this is a a sub-id of a command, for instance if a command plugin returns a container with sub-items. In this case the main id is passed to res_mainid.

◆ RemoveLastCursorInfo()

Bool RemoveLastCursorInfo ( LASTCURSORINFOFUNC  func)

Sets the callback invoked when mouse cursor leaves a user area.

Note
Useful to remove any highlighted element on mouse over.
Parameters
[in]funcThe last mouse cursor info callback. It should simply send BFM_CURSORINFO_REMOVE to the user area for the mouse leave event.

◆ Shortcut2String() [1/2]

String Shortcut2String ( Int32  shortqual,
Int32  shortkey 
)

Converts a shortcut to a readable string.

Parameters
[in]shortqualThe shortcut qualifier.
[in]shortkeyThe shortcut key.
Returns
The shortcut string.

◆ Shortcut2String() [2/2]

String Shortcut2String ( const BaseContainer sc)

Converts a shortcut to a readable string.

Parameters
[in]scThe shortcut container.
Returns
The shortcut string.

◆ GetGuiWorldColor()

Vector GetGuiWorldColor ( Int32  cid)

Gets a GUI color from its constant ID.

Parameters
[in]cidThe color ID. See COLOR constants.
Returns
The GUI color.

◆ GetIconCoordInfo()

Bool GetIconCoordInfo ( Int32 id,
const Char ident 
)

Converts an icon resource identity string into an ID.

Parameters
[in]idThe ID of the icon resource string.
[in]identThe icon resource identity string. Look them up in the resource file for schemes.
Returns
true if the icon resource identity string was found, otherwise false.

◆ GetInterfaceIcon()

Bool GetInterfaceIcon ( Int32  type,
Int32  id_x,
Int32  id_y,
Int32  id_w,
Int32  id_h,
IconData d 
)

Retrieves the icon for an interface element.

Parameters
[in]typeThe icon type: INTERFACE_ICON_TYPE
[in]id_xThe X position ID of the icon.
[in]id_yThe Y position ID of the icon.
[in]id_wThe width ID of the icon.
[in]id_hThe height ID of the icon.
[out]dAssigned the retrieved icon resource data.
Returns
The icon could be retrieved.

◆ GeIsTabletMode()

Bool GeIsTabletMode ( )

Returns true when the current/preferred input device is a graphic tablet.

Since
R20
Returns
True for tablet input.

◆ GetMouseMoveDelta()

Float GetMouseMoveDelta ( )

Retrieves the mouse move delta (threshold) depending on the input device.

Since
R19
Returns
The mouse move delta.

◆ SetBakeStatus()

void SetBakeStatus ( Bool  state)

Private.

Since
R16

◆ GetBakeStatus()

Bool GetBakeStatus ( )

Private.

Since
R16

◆ GetDnDFilename()

Filename GetDnDFilename ( const BaseContainer msg,
Int32  dragType,
const void *  dragObj,
Bool  texturesOnly,
Bool  updateUsage,
Bool  loadUrl 
)

GetDnDFilename extracts the Filename from the given drag and drop data returned by GetDragObject()

Parameters
[in]msgDrag and Drop message.
[in]dragTypeDrag type returned by GetDragObject().
[in]dragObjDrag object returned by GetDragObject().
[in]texturesOnlyTrue to check for textures only.
[in]updateUsageTrue to update the usage stats of the asset.
[in]loadUrlTrue to show a modal progress dialog when files need to be downloaded.
Returns
Filename on success. Filename IsEmpty() if no data was found.