Functions

xap_CocoaDialog_Utilities.cpp File Reference

#import <Cocoa/Cocoa.h>
#include "xap_CocoaDialog_Utilities.h"

Functions

void _SetNSControlLabel (id control, const char *label)
void SetNSControlLabel (id control, const UT_UTF8String &label)
 set the label of a NSControl
void SetNSControlLabel (id control, const std::string &label)
void LocalizeControl (id control, const XAP_StringSet *pSS, XAP_String_Id stringId)
NSString * LocalizedString (const XAP_StringSet *pSS, XAP_String_Id stringId)
void AppendLocalizedMenuItem (NSPopUpButton *menu, const XAP_StringSet *pSS, XAP_String_Id stringId, int tag)
void _convertLabelToMac (char *buf, size_t bufSize, const char *label)

Function Documentation

void _convertLabelToMac ( char *  buf,
size_t  bufSize,
const char *  label 
)

Strip the '&' from the label

Parameters:
buf the result buffer
bufSize the allocated size for buf
label the label to convert as an UT_String

References UT_ASSERT.

Referenced by _SetNSControlLabel(), and EV_CocoaMenu::convertToString.

void _SetNSControlLabel ( id  control,
const char *  label 
)

References _convertLabelToMac().

Referenced by SetNSControlLabel().

void AppendLocalizedMenuItem ( NSPopUpButton *  menu,
const XAP_StringSet pSS,
XAP_String_Id  stringId,
int  tag 
)

Append a menu item to the popup button

Parameters:
menu the popup button
pSS the string set
stringId the string id

References LocalizedString().

Referenced by AP_CocoaDialog_Lists::_fillFontMenu, and AP_CocoaDialog_ListsController::windowDidLoad.

void LocalizeControl ( id  control,
const XAP_StringSet pSS,
XAP_String_Id  stringId 
)

Localize a control with a string from a string set

Parameters:
control the control AppKit object
pSS the string set
stringID the string ID from the string set SetNSControlLabel

References XAP_StringSet::getValueUTF8(), label, and SetNSControlLabel().

Referenced by XAP_CocoaDlg_Insert_SymbolController::windowDidLoad, AP_CocoaDialog_OptionsController::windowDidLoad, AP_CocoaDialog_ListsController::windowDidLoad, and AP_CocoaDialog_BreakController::windowDidLoad.

NSString* LocalizedString ( const XAP_StringSet pSS,
XAP_String_Id  stringId 
)
void SetNSControlLabel ( id  control,
const std::string &  label 
)

References _SetNSControlLabel().

void SetNSControlLabel ( id  control,
const UT_UTF8String label 
)

set the label of a NSControl

Parameters:
control the control AppKit object
label UT_UTF8String to set. It is a well formed XP label that will be converted.
Note:
if the control object you pass is of an unknown type, the function will NSLog something on the console. Feel g_free to update the function if you want to handle that kind of object.

References _SetNSControlLabel(), and UT_UTF8String::utf8_str().

Referenced by LocalizeControl(), XAP_OpenSavePanel_AccessoryController::setFileTypeLabel:, and XAP_CocoaWidget::setLabel().