comparison mac/dw.m @ 2037:a00e73284c97

Mac: Continuing const changes. Hopefully last Mac commit.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 17 Nov 2019 05:21:01 +0000
parents ea303d356419
children 19fb7f72051b
comparison
equal deleted inserted replaced
2036:48b91f535f82 2037:a00e73284c97
4998 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) 4998 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
4999 { 4999 {
5000 _dw_box_pack(box, item, 0, width, height, hsize, vsize, pad, "dw_box_pack_end()"); 5000 _dw_box_pack(box, item, 0, width, height, hsize, vsize, pad, "dw_box_pack_end()");
5001 } 5001 }
5002 5002
5003 HWND _button_new(char *text, ULONG cid) 5003 HWND _button_new(const char *text, ULONG cid)
5004 { 5004 {
5005 DWButton *button = [[DWButton alloc] init]; 5005 DWButton *button = [[DWButton alloc] init];
5006 if(text) 5006 if(text)
5007 { 5007 {
5008 [button setTitle:[ NSString stringWithUTF8String:text ]]; 5008 [button setTitle:[ NSString stringWithUTF8String:text ]];
5025 * Create a new button window (widget) to be packed. 5025 * Create a new button window (widget) to be packed.
5026 * Parameters: 5026 * Parameters:
5027 * text: The text to be display by the static text widget. 5027 * text: The text to be display by the static text widget.
5028 * id: An ID to be used with dw_window_from_id() or 0L. 5028 * id: An ID to be used with dw_window_from_id() or 0L.
5029 */ 5029 */
5030 HWND API dw_button_new(char *text, ULONG cid) 5030 HWND API dw_button_new(const char *text, ULONG cid)
5031 { 5031 {
5032 DWButton *button = _button_new(text, cid); 5032 DWButton *button = _button_new(text, cid);
5033 [button setButtonType:DWButtonTypeMomentaryPushIn]; 5033 [button setButtonType:DWButtonTypeMomentaryPushIn];
5034 [button setBezelStyle:DWBezelStyleRounded]; 5034 [button setBezelStyle:DWBezelStyleRounded];
5035 [button setImagePosition:NSNoImage]; 5035 [button setImagePosition:NSNoImage];
5042 * Create a new Entryfield window (widget) to be packed. 5042 * Create a new Entryfield window (widget) to be packed.
5043 * Parameters: 5043 * Parameters:
5044 * text: The default text to be in the entryfield widget. 5044 * text: The default text to be in the entryfield widget.
5045 * id: An ID to be used with dw_window_from_id() or 0L. 5045 * id: An ID to be used with dw_window_from_id() or 0L.
5046 */ 5046 */
5047 HWND API dw_entryfield_new(char *text, ULONG cid) 5047 HWND API dw_entryfield_new(const char *text, ULONG cid)
5048 { 5048 {
5049 DWEntryField *entry = [[DWEntryField alloc] init]; 5049 DWEntryField *entry = [[DWEntryField alloc] init];
5050 [entry setStringValue:[ NSString stringWithUTF8String:text ]]; 5050 [entry setStringValue:[ NSString stringWithUTF8String:text ]];
5051 [entry setTag:cid]; 5051 [entry setTag:cid];
5052 [[entry cell] setScrollable:YES]; 5052 [[entry cell] setScrollable:YES];
5230 * Create a new radiobutton window (widget) to be packed. 5230 * Create a new radiobutton window (widget) to be packed.
5231 * Parameters: 5231 * Parameters:
5232 * text: The text to be display by the static text widget. 5232 * text: The text to be display by the static text widget.
5233 * id: An ID to be used with dw_window_from_id() or 0L. 5233 * id: An ID to be used with dw_window_from_id() or 0L.
5234 */ 5234 */
5235 HWND API dw_radiobutton_new(char *text, ULONG cid) 5235 HWND API dw_radiobutton_new(const char *text, ULONG cid)
5236 { 5236 {
5237 DWButton *button = _button_new(text, cid); 5237 DWButton *button = _button_new(text, cid);
5238 [button setButtonType:DWButtonTypeRadio]; 5238 [button setButtonType:DWButtonTypeRadio];
5239 return button; 5239 return button;
5240 } 5240 }
5412 * Create a new checkbox window (widget) to be packed. 5412 * Create a new checkbox window (widget) to be packed.
5413 * Parameters: 5413 * Parameters:
5414 * text: The text to be display by the static text widget. 5414 * text: The text to be display by the static text widget.
5415 * id: An ID to be used with dw_window_from_id() or 0L. 5415 * id: An ID to be used with dw_window_from_id() or 0L.
5416 */ 5416 */
5417 HWND API dw_checkbox_new(char *text, ULONG cid) 5417 HWND API dw_checkbox_new(const char *text, ULONG cid)
5418 { 5418 {
5419 DWButton *button = _button_new(text, cid); 5419 DWButton *button = _button_new(text, cid);
5420 [button setButtonType:DWButtonTypeSwitch]; 5420 [button setButtonType:DWButtonTypeSwitch];
5421 [button setBezelStyle:DWBezelStyleRegularSquare]; 5421 [button setBezelStyle:DWBezelStyleRegularSquare];
5422 return button; 5422 return button;
5547 * Parameters: 5547 * Parameters:
5548 * handle: Handle to the listbox to be inserted into. 5548 * handle: Handle to the listbox to be inserted into.
5549 * text: Text to insert into listbox. 5549 * text: Text to insert into listbox.
5550 * pos: 0-based position to insert text 5550 * pos: 0-based position to insert text
5551 */ 5551 */
5552 DW_FUNCTION_DEFINITION(dw_listbox_insert, void, HWND handle, char *text, int pos) 5552 DW_FUNCTION_DEFINITION(dw_listbox_insert, void, HWND handle, const char *text, int pos)
5553 DW_FUNCTION_ADD_PARAM3(handle, text, pos) 5553 DW_FUNCTION_ADD_PARAM3(handle, text, pos)
5554 DW_FUNCTION_NO_RETURN(dw_listbox_insert) 5554 DW_FUNCTION_NO_RETURN(dw_listbox_insert)
5555 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, text, char *, pos, int) 5555 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, text, const char *, pos, int)
5556 { 5556 {
5557 DW_FUNCTION_INIT; 5557 DW_FUNCTION_INIT;
5558 id object = handle; 5558 id object = handle;
5559 5559
5560 if([object isMemberOfClass:[DWComboBox class]]) 5560 if([object isMemberOfClass:[DWComboBox class]])
5931 * Create a new Combobox window (widget) to be packed. 5931 * Create a new Combobox window (widget) to be packed.
5932 * Parameters: 5932 * Parameters:
5933 * text: The default text to be in the combpbox widget. 5933 * text: The default text to be in the combpbox widget.
5934 * id: An ID to be used with dw_window_from_id() or 0L. 5934 * id: An ID to be used with dw_window_from_id() or 0L.
5935 */ 5935 */
5936 DW_FUNCTION_DEFINITION(dw_combobox_new, HWND, char *text, ULONG cid) 5936 DW_FUNCTION_DEFINITION(dw_combobox_new, HWND, const char *text, ULONG cid)
5937 DW_FUNCTION_ADD_PARAM2(text, cid) 5937 DW_FUNCTION_ADD_PARAM2(text, cid)
5938 DW_FUNCTION_RETURN(dw_combobox_new, HWND) 5938 DW_FUNCTION_RETURN(dw_combobox_new, HWND)
5939 DW_FUNCTION_RESTORE_PARAM2(text, char *, cid, ULONG) 5939 DW_FUNCTION_RESTORE_PARAM2(text, const char *, cid, ULONG)
5940 { 5940 {
5941 DW_FUNCTION_INIT; 5941 DW_FUNCTION_INIT;
5942 DWComboBox *combo = [[DWComboBox alloc] init]; 5942 DWComboBox *combo = [[DWComboBox alloc] init];
5943 [combo setStringValue:[NSString stringWithUTF8String:text]]; 5943 [combo setStringValue:[NSString stringWithUTF8String:text]];
5944 [combo setDelegate:combo]; 5944 [combo setDelegate:combo];
5980 * Parameters: 5980 * Parameters:
5981 * handle: Handle to the MLE to be queried. 5981 * handle: Handle to the MLE to be queried.
5982 * buffer: Text buffer to be imported. 5982 * buffer: Text buffer to be imported.
5983 * startpoint: Point to start entering text. 5983 * startpoint: Point to start entering text.
5984 */ 5984 */
5985 DW_FUNCTION_DEFINITION(dw_mle_import, unsigned int, HWND handle, char *buffer, int startpoint) 5985 DW_FUNCTION_DEFINITION(dw_mle_import, unsigned int, HWND handle, const char *buffer, int startpoint)
5986 DW_FUNCTION_ADD_PARAM3(handle, buffer, startpoint) 5986 DW_FUNCTION_ADD_PARAM3(handle, buffer, startpoint)
5987 DW_FUNCTION_RETURN(dw_mle_import, unsigned int) 5987 DW_FUNCTION_RETURN(dw_mle_import, unsigned int)
5988 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, buffer, char *, startpoint, int) 5988 DW_FUNCTION_RESTORE_PARAM3(handle, HWND, buffer, const char *, startpoint, int)
5989 { 5989 {
5990 DW_FUNCTION_INIT; 5990 DW_FUNCTION_INIT;
5991 DWMLE *mle = handle; 5991 DWMLE *mle = handle;
5992 unsigned int retval; 5992 unsigned int retval;
5993 NSTextStorage *ts = [mle textStorage]; 5993 NSTextStorage *ts = [mle textStorage];
6219 * handle: Handle to the MLE to be cleared. 6219 * handle: Handle to the MLE to be cleared.
6220 * text: Text to search for. 6220 * text: Text to search for.
6221 * point: Start point of search. 6221 * point: Start point of search.
6222 * flags: Search specific flags. 6222 * flags: Search specific flags.
6223 */ 6223 */
6224 DW_FUNCTION_DEFINITION(dw_mle_search, int, HWND handle, char *text, int point, unsigned long flags) 6224 DW_FUNCTION_DEFINITION(dw_mle_search, int, HWND handle, const char *text, int point, unsigned long flags)
6225 DW_FUNCTION_ADD_PARAM4(handle, text, point, flags) 6225 DW_FUNCTION_ADD_PARAM4(handle, text, point, flags)
6226 DW_FUNCTION_RETURN(dw_mle_search, int) 6226 DW_FUNCTION_RETURN(dw_mle_search, int)
6227 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, text, char *, point, int, flags, unsigned long) 6227 DW_FUNCTION_RESTORE_PARAM4(handle, HWND, text, const char *, point, int, flags, unsigned long)
6228 { 6228 {
6229 DW_FUNCTION_INIT; 6229 DW_FUNCTION_INIT;
6230 DWMLE *mle = handle; 6230 DWMLE *mle = handle;
6231 NSTextStorage *ts = [mle textStorage]; 6231 NSTextStorage *ts = [mle textStorage];
6232 NSMutableString *ms = [ts mutableString]; 6232 NSMutableString *ms = [ts mutableString];
8991 clickCount:1 8991 clickCount:1
8992 pressure:0.0]; 8992 pressure:0.0];
8993 [NSMenu popUpContextMenu:thismenu withEvent:fake forView:view]; 8993 [NSMenu popUpContextMenu:thismenu withEvent:fake forView:view];
8994 } 8994 }
8995 8995
8996 char _removetilde(char *dest, char *src) 8996 char _removetilde(char *dest, const char *src)
8997 { 8997 {
8998 int z, cur=0; 8998 int z, cur=0;
8999 char accel = '\0'; 8999 char accel = '\0';
9000 9000
9001 for(z=0;z<strlen(src);z++) 9001 for(z=0;z<strlen(src);z++)
9024 * end: If TRUE memu is positioned at the end of the menu. 9024 * end: If TRUE memu is positioned at the end of the menu.
9025 * check: If TRUE menu is "check"able. 9025 * check: If TRUE menu is "check"able.
9026 * flags: Extended attributes to set on the menu. 9026 * flags: Extended attributes to set on the menu.
9027 * submenu: Handle to an existing menu to be a submenu or NULL. 9027 * submenu: Handle to an existing menu to be a submenu or NULL.
9028 */ 9028 */
9029 HWND API dw_menu_append_item(HMENUI menux, char *title, ULONG itemid, ULONG flags, int end, int check, HMENUI submenux) 9029 HWND API dw_menu_append_item(HMENUI menux, const char *title, ULONG itemid, ULONG flags, int end, int check, HMENUI submenux)
9030 { 9030 {
9031 NSMenu *menu = menux; 9031 NSMenu *menu = menux;
9032 NSMenu *submenu = submenux; 9032 NSMenu *submenu = submenux;
9033 DWMenuItem *item = NULL; 9033 DWMenuItem *item = NULL;
9034 if(strlen(title) == 0) 9034 if(strlen(title) == 0)
11164 * Parameters: 11164 * Parameters:
11165 * name: Base name of the shared library. 11165 * name: Base name of the shared library.
11166 * handle: Pointer to a module handle, 11166 * handle: Pointer to a module handle,
11167 * will be filled in with the handle. 11167 * will be filled in with the handle.
11168 */ 11168 */
11169 int dw_module_load(char *name, HMOD *handle) 11169 int dw_module_load(const char *name, HMOD *handle)
11170 { 11170 {
11171 int len; 11171 int len;
11172 char *newname; 11172 char *newname;
11173 char errorbuf[1025]; 11173 char errorbuf[1025];
11174 11174
12183 /* 12183 /*
12184 * Loads a web browser pointed at the given URL. 12184 * Loads a web browser pointed at the given URL.
12185 * Parameters: 12185 * Parameters:
12186 * url: Uniform resource locator. 12186 * url: Uniform resource locator.
12187 */ 12187 */
12188 int dw_browse(char *url) 12188 int dw_browse(const char *url)
12189 { 12189 {
12190 NSURL *myurl = [NSURL URLWithString:[NSString stringWithUTF8String:url]]; 12190 NSURL *myurl = [NSURL URLWithString:[NSString stringWithUTF8String:url]];
12191 [[NSWorkspace sharedWorkspace] openURL:myurl]; 12191 [[NSWorkspace sharedWorkspace] openURL:myurl];
12192 return DW_ERROR_NONE; 12192 return DW_ERROR_NONE;
12193 } 12193 }
12209 * drawfunc: The pointer to the function to be used as the callback. 12209 * drawfunc: The pointer to the function to be used as the callback.
12210 * drawdata: User data to be passed to the handler function. 12210 * drawdata: User data to be passed to the handler function.
12211 * Returns: 12211 * Returns:
12212 * A handle to the print object or NULL on failure. 12212 * A handle to the print object or NULL on failure.
12213 */ 12213 */
12214 HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata) 12214 HPRINT API dw_print_new(const char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata)
12215 { 12215 {
12216 DWPrint *print; 12216 DWPrint *print;
12217 NSPrintPanel *panel; 12217 NSPrintPanel *panel;
12218 PMPrintSettings settings; 12218 PMPrintSettings settings;
12219 NSPrintInfo *pi; 12219 NSPrintInfo *pi;