Functions providing a way to integrate the Add-On into the menu structure of Archicad.
More...
|
enum | APIMenuCodeID {
MenuCode_UserDef = 0
, MenuCode_File = 1
, MenuCode_Edit1 = 2
, MenuCode_Edit2 = 3
,
MenuCode_Edit3 = 4
, MenuCode_Tools = 5
, MenuCode_Options1 = 6
, MenuCode_Options2 = 7
,
MenuCode_Image = 8
, MenuCode_Calculate = 9
, MenuCode_TeamWork = 10
, MenuCode_Display = 11
,
MenuCode_Palettes = 12
, MenuCode_Extras = 13
, MenuCode_Hotlink = 14
, MenuCode_GDLObjects = 15
,
MenuCode_3DView = 16
, MenuCode_DocExtras = 17
, MenuCode_Interoperability = 18
, MenuCode_ModelCheck = 19
} |
| Defines the menu where the add-on's menu command will appear. More...
|
|
|
GSErrCode | ACAPI_MenuItem_GetMenuItemFlags (const API_MenuItemRef *menuItemRef, GSFlags *itemFlags, GS::UniString *menuItemText=nullptr) |
| Returns the flag values of the specified menu item mounted by API tool add-on.
|
|
GSErrCode | ACAPI_MenuItem_SetMenuItemFlags (const API_MenuItemRef *menuItemRef, GSFlags *itemFlags, GS::UniString *menuItemText=nullptr) |
| Sets the flag values of the specified menu item.
|
|
GSErrCode | ACAPI_MenuItem_GetMenuItemText (const API_MenuItemRef *menuItemRef, char *itemText, GS::UniString *itemUniText=nullptr) |
| Returns the text of the specified menu item.
|
|
GSErrCode | ACAPI_MenuItem_SetMenuItemText (const API_MenuItemRef *menuItemRef, char *itemText, GS::UniString *itemUniText=nullptr) |
| Sets the text of the specified menu item.
|
|
GSErrCode | ACAPI_MenuItem_AddMenuItemText (const API_MenuItemRef *menuItemRef, char *weText, GS::UniString *weUniText=nullptr) |
| Sets the text of a specified menu item that will appear in the Work Environment dialog.
|
|
GSErrCode | ACAPI_MenuItem_RegisterMenu (short menuStrResID, short promptStrResID, APIMenuCodeID menuPosCode, GSFlags menuFlags) |
| Registers the menu items of the add-on.
|
|
GSErrCode | ACAPI_MenuItem_InstallMenuHandler (short menuStrResID, APIMenuCommandProc *handlerProc) |
| Installs a callback procedure for handling the add-on's menu commands.
|
|
Functions providing a way to integrate the Add-On into the menu structure of Archicad.
◆ APIMenuCodeID
Defines the menu where the add-on's menu command will appear.
- Since
- Archicad 26
◆ ACAPI_MenuItem_AddMenuItemText()
GSErrCode ACAPI_MenuItem_AddMenuItemText |
( |
const API_MenuItemRef * |
menuItemRef, |
|
|
char * |
weText, |
|
|
GS::UniString * |
weUniText = nullptr |
|
) |
| |
Sets the text of a specified menu item that will appear in the Work Environment dialog.
- Parameters
-
menuItemRef | [in] The referenced menu item. |
weText | [in] The text (if you don't pass weUniText) that will appear as the name of the menu item in the menu customization part of the work environment dialog. |
weUniText | [in] The Unicode text that will appear as the name of the menu item in the menu customization part of the work environment dialog. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - menuItemRef or both itemText and itemUniText are nullptr
◆ ACAPI_MenuItem_GetMenuItemFlags()
GSErrCode ACAPI_MenuItem_GetMenuItemFlags |
( |
const API_MenuItemRef * |
menuItemRef, |
|
|
GSFlags * |
itemFlags, |
|
|
GS::UniString * |
menuItemText = nullptr |
|
) |
| |
Returns the flag values of the specified menu item mounted by API tool add-on.
- Parameters
-
menuItemRef | [in] Identifies the menu item. |
itemFlags | [out] Menu item flags.
Flag Value | Meaning |
API_MenuItemDisabled | The menu item is currently disabled |
API_MenuItemChecked | The menu item is currently checked |
|
menuItemText | [out] Optional Unicode menu item text to get. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - any of the parameters are nullptr
- APIERR_BADINDEX - the specified menu item does not belong to the caller add-on
- Example
void EnableACMenuItem (short itemInd, bool enable)
{
GSFlags itemFlags;
itemFlags = 0;
ACAPI_Interface (APIIo_GetMenuItemFlagsID, &itemRef, &itemFlags);
if (enable)
itemFlags &= ~API_MenuItemDisabled;
else
itemFlags |= API_MenuItemDisabled;
ACAPI_Interface (APIIo_SetMenuItemFlagsID, &itemRef, &itemFlags);
return;
}
◆ ACAPI_MenuItem_GetMenuItemText()
GSErrCode ACAPI_MenuItem_GetMenuItemText |
( |
const API_MenuItemRef * |
menuItemRef, |
|
|
char * |
itemText, |
|
|
GS::UniString * |
itemUniText = nullptr |
|
) |
| |
Returns the text of the specified menu item.
- Parameters
-
menuItemRef | [in] Identifies the menu item. |
itemText | [out] Menu item text (if you don't pass itemUniText). |
itemUniText | [out] Optional Unicode menu item text to set. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - menuItemRef or both itemText and itemUniText are nullptr
- APIERR_BADINDEX - the specified menu item does not belong to the caller add-on
- Example
void ReportChosenCommand (short menuResID, short itemInd)
{
char itemStr [256], message [256];
if (ACAPI_Interface (APIIo_GetMenuItemTextID, &itemRef, itemStr) == NoError) {
sprintf (message, "You have chosen the %s command", itemStr);
}
return;
}
void ACAPI_WriteReport(const GS::UniString &format, bool withDial,...)
Writes a report string into the Report Windowot into a custom alert window.
◆ ACAPI_MenuItem_InstallMenuHandler()
GSErrCode ACAPI_MenuItem_InstallMenuHandler |
( |
short |
menuStrResID, |
|
|
APIMenuCommandProc * |
handlerProc |
|
) |
| |
Installs a callback procedure for handling the add-on's menu commands.
- Parameters
-
menuStrResID | [in] An identifier of the menu to install the callback procedure for. This should be the same what you used in the ACAPI_MenuItem_RegisterMenu as a menu string resource number in the RegisterInterface function. |
handlerProc | [in] The callback function to handle the menu commands. |
- Returns
- NoError - The function has completed with success.
- Example
{
GSErrCode err = NoError;
return err;
}
GSErrCode APIMenuCommandProc(const API_MenuParams *menuParams)
User supplied callback procedure for handling menu commands.
Definition: APIdefs_Callback.h:558
GSErrCode Initialize(void)
The main entry point of the add-on.
◆ ACAPI_MenuItem_RegisterMenu()
GSErrCode ACAPI_MenuItem_RegisterMenu |
( |
short |
menuStrResID, |
|
|
short |
promptStrResID, |
|
|
APIMenuCodeID |
menuPosCode, |
|
|
GSFlags |
menuFlags |
|
) |
| |
Registers the menu items of the add-on.
- Parameters
-
menuStrResID | [in] The resource ID of the menu resource, which should be in the resource fork of the add-on. |
promptStrResID | [in] The resource ID of the propmt string resource, which should be in the resource fork of the add-on. These strings appear in the status bar. |
menuPosCode | [in] Defines the server application's menu to insert the command into. |
menuFlags | [in] Flags describing whether you would like to see any separator item in the menu before or after the registered menu item. Its possible values are: MenuFlag_Default, MenuFlag_SeparatorBefore, and MenuFlag_SeparatorAfter |
- Returns
- NoError - The function has completed with success.
- Example
-
◆ ACAPI_MenuItem_SetMenuItemFlags()
GSErrCode ACAPI_MenuItem_SetMenuItemFlags |
( |
const API_MenuItemRef * |
menuItemRef, |
|
|
GSFlags * |
itemFlags, |
|
|
GS::UniString * |
menuItemText = nullptr |
|
) |
| |
Sets the flag values of the specified menu item.
- Parameters
-
menuItemRef | [in] Identifies the menu item. |
itemFlags | [in] Menu item flags.
Flag Value | Meaning |
API_MenuItemDisabled | Disable the menu item |
API_MenuItemChecked | Check the menu item |
|
menuItemText | [in] Optional Unicode menu item text to set. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - any of the parameters are nullptr
- APIERR_BADINDEX - the specified menu item does not belong to the caller add-on
- Example
static void CheckACMenuItem (short itemInd, bool checked)
{
GSFlags itemFlags;
itemFlags = 0;
ACAPI_Interface (APIIo_GetMenuItemFlagsID, &itemRef, &itemFlags);
if (checked)
itemFlags |= API_MenuItemChecked;
else
itemFlags &= ~API_MenuItemChecked;
ACAPI_Interface (APIIo_SetMenuItemFlagsID, &itemRef, &itemFlags);
return;
}
◆ ACAPI_MenuItem_SetMenuItemText()
GSErrCode ACAPI_MenuItem_SetMenuItemText |
( |
const API_MenuItemRef * |
menuItemRef, |
|
|
char * |
itemText, |
|
|
GS::UniString * |
itemUniText = nullptr |
|
) |
| |
Sets the text of the specified menu item.
- Parameters
-
menuItemRef | [in] Identifies the menu item. |
itemText | [in] Menu item text to set (if you don't pass itemUniText). |
itemUniText | [in] Optional Unicode menu item text to set. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - menuItemRef or both itemText and itemUniText are nullptr
- APIERR_BADINDEX - the specified menu item does not belong to the caller add-on
- Example
void SetPaletteMenuText (short paletteItemInd, bool paletteIsVisible)
{
GS::UniString itemStr;
if (paletteIsVisible)
itemStr.Append ("Hide Palette");
else
itemStr.Append ("Show Palette");
ACAPI_Interface (APIIo_SetMenuItemTextID, &itemRef, nullptr, itemStr);
return;
}