Mercurial > dwindows
comparison mac/dw.m @ 685:314a12dccd20
Cleanups for conflicts with "id" which is a keyword in Objective-C.
Also attempt to make sure the id tag is set for all controls that accept it.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 03 Mar 2011 13:48:07 +0000 |
parents | 014b02436c1f |
children | 218d676baf7f |
comparison
equal
deleted
inserted
replaced
684:014b02436c1f | 685:314a12dccd20 |
---|---|
2127 /* Free the old data */ | 2127 /* Free the old data */ |
2128 if(thisbox->count) | 2128 if(thisbox->count) |
2129 free(thisitem); | 2129 free(thisitem); |
2130 } | 2130 } |
2131 | 2131 |
2132 HWND _button_new(char *text, ULONG id) | 2132 HWND _button_new(char *text, ULONG cid) |
2133 { | 2133 { |
2134 DWButton *button = [[DWButton alloc] init]; | 2134 DWButton *button = [[DWButton alloc] init]; |
2135 if(text && *text) | 2135 if(text && *text) |
2136 { | 2136 { |
2137 [button setTitle:[ NSString stringWithUTF8String:text ]]; | 2137 [button setTitle:[ NSString stringWithUTF8String:text ]]; |
2138 } | 2138 } |
2139 [button setTarget:button]; | 2139 [button setTarget:button]; |
2140 [button setAction:@selector(buttonClicked:)]; | 2140 [button setAction:@selector(buttonClicked:)]; |
2141 [button setTag:id]; | 2141 [button setTag:cid]; |
2142 [button setButtonType:NSMomentaryPushInButton]; | 2142 [button setButtonType:NSMomentaryPushInButton]; |
2143 [button setBezelStyle:NSThickerSquareBezelStyle]; | 2143 [button setBezelStyle:NSThickerSquareBezelStyle]; |
2144 return button; | 2144 return button; |
2145 } | 2145 } |
2146 | 2146 |
2148 * Create a new button window (widget) to be packed. | 2148 * Create a new button window (widget) to be packed. |
2149 * Parameters: | 2149 * Parameters: |
2150 * text: The text to be display by the static text widget. | 2150 * text: The text to be display by the static text widget. |
2151 * id: An ID to be used with dw_window_from_id() or 0L. | 2151 * id: An ID to be used with dw_window_from_id() or 0L. |
2152 */ | 2152 */ |
2153 HWND API dw_button_new(char *text, ULONG id) | 2153 HWND API dw_button_new(char *text, ULONG cid) |
2154 { | 2154 { |
2155 DWButton *button = _button_new(text, id); | 2155 DWButton *button = _button_new(text, cid); |
2156 [button setButtonType:NSMomentaryPushInButton]; | 2156 [button setButtonType:NSMomentaryPushInButton]; |
2157 [button setBezelStyle:NSRoundedBezelStyle]; | 2157 [button setBezelStyle:NSRoundedBezelStyle]; |
2158 [button setImagePosition:NSNoImage]; | 2158 [button setImagePosition:NSNoImage]; |
2159 [button setAlignment:NSCenterTextAlignment]; | 2159 [button setAlignment:NSCenterTextAlignment]; |
2160 [[button cell] setControlTint:NSBlueControlTint]; | 2160 [[button cell] setControlTint:NSBlueControlTint]; |
2165 * Create a new Entryfield window (widget) to be packed. | 2165 * Create a new Entryfield window (widget) to be packed. |
2166 * Parameters: | 2166 * Parameters: |
2167 * text: The default text to be in the entryfield widget. | 2167 * text: The default text to be in the entryfield widget. |
2168 * id: An ID to be used with dw_window_from_id() or 0L. | 2168 * id: An ID to be used with dw_window_from_id() or 0L. |
2169 */ | 2169 */ |
2170 HWND API dw_entryfield_new(char *text, ULONG id) | 2170 HWND API dw_entryfield_new(char *text, ULONG cid) |
2171 { | 2171 { |
2172 DWEntryField *entry = [[DWEntryField alloc] init]; | 2172 DWEntryField *entry = [[DWEntryField alloc] init]; |
2173 [entry setStringValue:[ NSString stringWithUTF8String:text ]]; | 2173 [entry setStringValue:[ NSString stringWithUTF8String:text ]]; |
2174 [entry setTag:id]; | 2174 [entry setTag:cid]; |
2175 return entry; | 2175 return entry; |
2176 } | 2176 } |
2177 | 2177 |
2178 /* | 2178 /* |
2179 * Create a new Entryfield (password) window (widget) to be packed. | 2179 * Create a new Entryfield (password) window (widget) to be packed. |
2180 * Parameters: | 2180 * Parameters: |
2181 * text: The default text to be in the entryfield widget. | 2181 * text: The default text to be in the entryfield widget. |
2182 * id: An ID to be used with dw_window_from_id() or 0L. | 2182 * id: An ID to be used with dw_window_from_id() or 0L. |
2183 */ | 2183 */ |
2184 HWND API dw_entryfield_password_new(char *text, ULONG id) | 2184 HWND API dw_entryfield_password_new(char *text, ULONG cid) |
2185 { | 2185 { |
2186 DWEntryFieldPassword *entry = [[DWEntryFieldPassword alloc] init]; | 2186 DWEntryFieldPassword *entry = [[DWEntryFieldPassword alloc] init]; |
2187 [entry setStringValue:[ NSString stringWithUTF8String:text ]]; | 2187 [entry setStringValue:[ NSString stringWithUTF8String:text ]]; |
2188 [entry setTag:id]; | 2188 [entry setTag:cid]; |
2189 return entry; | 2189 return entry; |
2190 } | 2190 } |
2191 | 2191 |
2192 /* | 2192 /* |
2193 * Sets the entryfield character limit. | 2193 * Sets the entryfield character limit. |
2232 * id: An ID to be used with dw_window_from_id() or 0L. | 2232 * id: An ID to be used with dw_window_from_id() or 0L. |
2233 * filename: Name of the file, omit extention to have | 2233 * filename: Name of the file, omit extention to have |
2234 * DW pick the appropriate file extension. | 2234 * DW pick the appropriate file extension. |
2235 * (BMP on OS/2 or Windows, XPM on Unix) | 2235 * (BMP on OS/2 or Windows, XPM on Unix) |
2236 */ | 2236 */ |
2237 HWND API dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename) | 2237 HWND API dw_bitmapbutton_new_from_file(char *text, unsigned long cid, char *filename) |
2238 { | 2238 { |
2239 NSString *nstr = [ NSString stringWithUTF8String:filename ]; | 2239 NSString *nstr = [ NSString stringWithUTF8String:filename ]; |
2240 NSImage *image = [[NSImage alloc] initWithContentsOfFile:nstr]; | 2240 NSImage *image = [[NSImage alloc] initWithContentsOfFile:nstr]; |
2241 if(!image) | 2241 if(!image) |
2242 { | 2242 { |
2243 nstr = [nstr stringByAppendingString:@".png"]; | 2243 nstr = [nstr stringByAppendingString:@".png"]; |
2244 image = [[NSImage alloc] initWithContentsOfFile:nstr]; | 2244 image = [[NSImage alloc] initWithContentsOfFile:nstr]; |
2245 } | 2245 } |
2246 [nstr release]; | 2246 [nstr release]; |
2247 DWButton *button = _button_new("", id); | 2247 DWButton *button = _button_new("", cid); |
2248 [button setImage:image]; | 2248 [button setImage:image]; |
2249 return button; | 2249 return button; |
2250 } | 2250 } |
2251 | 2251 |
2252 /* | 2252 /* |
2256 * id: An ID to be used with dw_window_from_id() or 0L. | 2256 * id: An ID to be used with dw_window_from_id() or 0L. |
2257 * data: The contents of the image | 2257 * data: The contents of the image |
2258 * (BMP or ICO on OS/2 or Windows, XPM on Unix) | 2258 * (BMP or ICO on OS/2 or Windows, XPM on Unix) |
2259 * len: length of str | 2259 * len: length of str |
2260 */ | 2260 */ |
2261 HWND API dw_bitmapbutton_new_from_data(char *text, unsigned long id, char *data, int len) | 2261 HWND API dw_bitmapbutton_new_from_data(char *text, unsigned long cid, char *data, int len) |
2262 { | 2262 { |
2263 NSData *thisdata = [[NSData alloc] dataWithBytes:data length:len]; | 2263 NSData *thisdata = [[NSData alloc] dataWithBytes:data length:len]; |
2264 NSImage *image = [[NSImage alloc] initWithData:thisdata]; | 2264 NSImage *image = [[NSImage alloc] initWithData:thisdata]; |
2265 DWButton *button = _button_new("", id); | 2265 DWButton *button = _button_new("", cid); |
2266 [button setImage:image]; | 2266 [button setImage:image]; |
2267 return button; | 2267 return button; |
2268 } | 2268 } |
2269 | 2269 |
2270 /* | 2270 /* |
2271 * Create a new spinbutton window (widget) to be packed. | 2271 * Create a new spinbutton window (widget) to be packed. |
2272 * Parameters: | 2272 * Parameters: |
2273 * text: The text to be display by the static text widget. | 2273 * text: The text to be display by the static text widget. |
2274 * id: An ID to be used with dw_window_from_id() or 0L. | 2274 * id: An ID to be used with dw_window_from_id() or 0L. |
2275 */ | 2275 */ |
2276 HWND API dw_spinbutton_new(char *text, ULONG id) | 2276 HWND API dw_spinbutton_new(char *text, ULONG cid) |
2277 { | 2277 { |
2278 DWSpinButton *spinbutton = [[DWSpinButton alloc] init]; | 2278 DWSpinButton *spinbutton = [[DWSpinButton alloc] init]; |
2279 NSStepper *stepper = [spinbutton stepper]; | 2279 NSStepper *stepper = [spinbutton stepper]; |
2280 [stepper setIncrement:1]; | 2280 [stepper setIncrement:1]; |
2281 [stepper setTag:cid]; | |
2281 return spinbutton; | 2282 return spinbutton; |
2282 } | 2283 } |
2283 | 2284 |
2284 /* | 2285 /* |
2285 * Sets the spinbutton value. | 2286 * Sets the spinbutton value. |
2327 * Create a new radiobutton window (widget) to be packed. | 2328 * Create a new radiobutton window (widget) to be packed. |
2328 * Parameters: | 2329 * Parameters: |
2329 * text: The text to be display by the static text widget. | 2330 * text: The text to be display by the static text widget. |
2330 * id: An ID to be used with dw_window_from_id() or 0L. | 2331 * id: An ID to be used with dw_window_from_id() or 0L. |
2331 */ | 2332 */ |
2332 HWND API dw_radiobutton_new(char *text, ULONG id) | 2333 HWND API dw_radiobutton_new(char *text, ULONG cid) |
2333 { | 2334 { |
2334 DWButton *button = _button_new(text, id); | 2335 DWButton *button = _button_new(text, cid); |
2335 [button setButtonType:NSRadioButton]; | 2336 [button setButtonType:NSRadioButton]; |
2336 return button; | 2337 return button; |
2337 } | 2338 } |
2338 | 2339 |
2339 /* | 2340 /* |
2341 * Parameters: | 2342 * Parameters: |
2342 * vertical: TRUE or FALSE if slider is vertical. | 2343 * vertical: TRUE or FALSE if slider is vertical. |
2343 * increments: Number of increments available. | 2344 * increments: Number of increments available. |
2344 * id: An ID to be used with dw_window_from_id() or 0L. | 2345 * id: An ID to be used with dw_window_from_id() or 0L. |
2345 */ | 2346 */ |
2346 HWND API dw_slider_new(int vertical, int increments, ULONG id) | 2347 HWND API dw_slider_new(int vertical, int increments, ULONG cid) |
2347 { | 2348 { |
2348 DWSlider *slider = [[DWSlider alloc] init]; | 2349 DWSlider *slider = [[DWSlider alloc] init]; |
2349 [slider setMaxValue:(double)increments]; | 2350 [slider setMaxValue:(double)increments]; |
2350 [slider setMinValue:0]; | 2351 [slider setMinValue:0]; |
2352 [slider setTag:cid]; | |
2351 return slider; | 2353 return slider; |
2352 } | 2354 } |
2353 | 2355 |
2354 /* | 2356 /* |
2355 * Returns the position of the slider. | 2357 * Returns the position of the slider. |
2380 * Parameters: | 2382 * Parameters: |
2381 * vertical: TRUE or FALSE if scrollbar is vertical. | 2383 * vertical: TRUE or FALSE if scrollbar is vertical. |
2382 * increments: Number of increments available. | 2384 * increments: Number of increments available. |
2383 * id: An ID to be used with dw_window_from_id() or 0L. | 2385 * id: An ID to be used with dw_window_from_id() or 0L. |
2384 */ | 2386 */ |
2385 HWND API dw_scrollbar_new(int vertical, ULONG id) | 2387 HWND API dw_scrollbar_new(int vertical, ULONG cid) |
2386 { | 2388 { |
2387 DWScrollbar *scrollbar = [[DWScrollbar alloc] init]; | 2389 DWScrollbar *scrollbar = [[DWScrollbar alloc] init]; |
2390 [scrollbar setArrowsPosition: NSScrollerArrowsDefaultSetting]; | |
2388 [scrollbar setTarget:scrollbar]; | 2391 [scrollbar setTarget:scrollbar]; |
2389 [scrollbar setAction:@selector(changed:)]; | 2392 [scrollbar setAction:@selector(changed:)]; |
2390 [scrollbar setRange:0.0 andVisible:0.0]; | 2393 [scrollbar setRange:0.0 andVisible:0.0]; |
2391 [scrollbar setKnobProportion:1.0]; | 2394 [scrollbar setKnobProportion:1.0]; |
2395 [scrollbar setTag:cid]; | |
2392 return scrollbar; | 2396 return scrollbar; |
2393 } | 2397 } |
2394 | 2398 |
2395 /* | 2399 /* |
2396 * Returns the position of the scrollbar. | 2400 * Returns the position of the scrollbar. |
2437 /* | 2441 /* |
2438 * Create a new percent bar window (widget) to be packed. | 2442 * Create a new percent bar window (widget) to be packed. |
2439 * Parameters: | 2443 * Parameters: |
2440 * id: An ID to be used with dw_window_from_id() or 0L. | 2444 * id: An ID to be used with dw_window_from_id() or 0L. |
2441 */ | 2445 */ |
2442 HWND API dw_percent_new(ULONG id) | 2446 HWND API dw_percent_new(ULONG cid) |
2443 { | 2447 { |
2444 DWPercent *percent = [[DWPercent alloc] init]; | 2448 DWPercent *percent = [[DWPercent alloc] init]; |
2445 [percent setBezeled:YES]; | 2449 [percent setBezeled:YES]; |
2446 [percent setMaxValue:100]; | 2450 [percent setMaxValue:100]; |
2447 [percent setMinValue:0]; | 2451 [percent setMinValue:0]; |
2448 /*[percent setTag:id]; Why doesn't this work? */ | 2452 /*[percent setTag:cid]; Why doesn't this work? */ |
2449 return percent; | 2453 return percent; |
2450 } | 2454 } |
2451 | 2455 |
2452 /* | 2456 /* |
2453 * Sets the percent bar position. | 2457 * Sets the percent bar position. |
2465 * Create a new checkbox window (widget) to be packed. | 2469 * Create a new checkbox window (widget) to be packed. |
2466 * Parameters: | 2470 * Parameters: |
2467 * text: The text to be display by the static text widget. | 2471 * text: The text to be display by the static text widget. |
2468 * id: An ID to be used with dw_window_from_id() or 0L. | 2472 * id: An ID to be used with dw_window_from_id() or 0L. |
2469 */ | 2473 */ |
2470 HWND API dw_checkbox_new(char *text, ULONG id) | 2474 HWND API dw_checkbox_new(char *text, ULONG cid) |
2471 { | 2475 { |
2472 DWButton *button = _button_new(text, id); | 2476 DWButton *button = _button_new(text, cid); |
2473 [button setButtonType:NSSwitchButton]; | 2477 [button setButtonType:NSSwitchButton]; |
2474 [button setBezelStyle:NSRegularSquareBezelStyle]; | 2478 [button setBezelStyle:NSRegularSquareBezelStyle]; |
2475 return button; | 2479 return button; |
2476 } | 2480 } |
2477 | 2481 |
2509 } | 2513 } |
2510 | 2514 |
2511 } | 2515 } |
2512 | 2516 |
2513 /* Common code for containers and listboxes */ | 2517 /* Common code for containers and listboxes */ |
2514 HWND _cont_new(ULONG id, int multi) | 2518 HWND _cont_new(ULONG cid, int multi) |
2515 { | 2519 { |
2516 NSScrollView *scrollview = [[NSScrollView alloc] init]; | 2520 NSScrollView *scrollview = [[NSScrollView alloc] init]; |
2517 DWContainer *cont = [[DWContainer alloc] init]; | 2521 DWContainer *cont = [[DWContainer alloc] init]; |
2518 | 2522 |
2519 [cont setScrollview:scrollview]; | 2523 [cont setScrollview:scrollview]; |
2529 { | 2533 { |
2530 [cont setAllowsMultipleSelection:NO]; | 2534 [cont setAllowsMultipleSelection:NO]; |
2531 } | 2535 } |
2532 [cont setDataSource:cont]; | 2536 [cont setDataSource:cont]; |
2533 [scrollview setDocumentView:cont]; | 2537 [scrollview setDocumentView:cont]; |
2538 [cont setTag:cid]; | |
2534 return cont; | 2539 return cont; |
2535 } | 2540 } |
2536 | 2541 |
2537 /* | 2542 /* |
2538 * Create a new listbox window (widget) to be packed. | 2543 * Create a new listbox window (widget) to be packed. |
2539 * Parameters: | 2544 * Parameters: |
2540 * id: An ID to be used with dw_window_from_id() or 0L. | 2545 * id: An ID to be used with dw_window_from_id() or 0L. |
2541 * multi: Multiple select TRUE or FALSE. | 2546 * multi: Multiple select TRUE or FALSE. |
2542 */ | 2547 */ |
2543 HWND API dw_listbox_new(ULONG id, int multi) | 2548 HWND API dw_listbox_new(ULONG cid, int multi) |
2544 { | 2549 { |
2545 DWContainer *cont = _cont_new(id, multi); | 2550 DWContainer *cont = _cont_new(cid, multi); |
2546 [cont setHeaderView:nil]; | 2551 [cont setHeaderView:nil]; |
2547 int type = DW_CFA_STRING; | 2552 int type = DW_CFA_STRING; |
2548 [cont setup]; | 2553 [cont setup]; |
2549 NSTableColumn *column = [[NSTableColumn alloc] init]; | 2554 NSTableColumn *column = [[NSTableColumn alloc] init]; |
2550 [cont addTableColumn:column]; | 2555 [cont addTableColumn:column]; |
2878 * Create a new Combobox window (widget) to be packed. | 2883 * Create a new Combobox window (widget) to be packed. |
2879 * Parameters: | 2884 * Parameters: |
2880 * text: The default text to be in the combpbox widget. | 2885 * text: The default text to be in the combpbox widget. |
2881 * id: An ID to be used with dw_window_from_id() or 0L. | 2886 * id: An ID to be used with dw_window_from_id() or 0L. |
2882 */ | 2887 */ |
2883 HWND API dw_combobox_new(char *text, ULONG id) | 2888 HWND API dw_combobox_new(char *text, ULONG cid) |
2884 { | 2889 { |
2885 DWComboBox *combo = [[DWComboBox alloc] init]; | 2890 DWComboBox *combo = [[DWComboBox alloc] init]; |
2891 [combo setTag:cid]; | |
2886 return combo; | 2892 return combo; |
2887 } | 2893 } |
2888 | 2894 |
2889 /* | 2895 /* |
2890 * Create a new Multiline Editbox window (widget) to be packed. | 2896 * Create a new Multiline Editbox window (widget) to be packed. |
2891 * Parameters: | 2897 * Parameters: |
2892 * id: An ID to be used with dw_window_from_id() or 0L. | 2898 * id: An ID to be used with dw_window_from_id() or 0L. |
2893 */ | 2899 */ |
2894 HWND API dw_mle_new(ULONG id) | 2900 HWND API dw_mle_new(ULONG cid) |
2895 { | 2901 { |
2896 DWMLE *mle = [[DWMLE alloc] init]; | 2902 DWMLE *mle = [[DWMLE alloc] init]; |
2897 NSScrollView *scrollview = [[NSScrollView alloc] init]; | 2903 NSScrollView *scrollview = [[NSScrollView alloc] init]; |
2898 | 2904 |
2899 //[mle setScrollview:scrollview]; | 2905 //[mle setScrollview:scrollview]; |
2901 [scrollview setHasVerticalScroller:YES]; | 2907 [scrollview setHasVerticalScroller:YES]; |
2902 [scrollview setAutohidesScrollers:YES]; | 2908 [scrollview setAutohidesScrollers:YES]; |
2903 [scrollview setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; | 2909 [scrollview setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable]; |
2904 [scrollview setDocumentView:mle]; | 2910 [scrollview setDocumentView:mle]; |
2905 [mle setAutoresizingMask:NSViewWidthSizable]; | 2911 [mle setAutoresizingMask:NSViewWidthSizable]; |
2912 /* [mle setTag:cid]; Why doesn't this work? */ | |
2906 return scrollview; | 2913 return scrollview; |
2907 } | 2914 } |
2908 | 2915 |
2909 /* | 2916 /* |
2910 * Adds text to an MLE box and returns the current point. | 2917 * Adds text to an MLE box and returns the current point. |
3090 * Create a new status text window (widget) to be packed. | 3097 * Create a new status text window (widget) to be packed. |
3091 * Parameters: | 3098 * Parameters: |
3092 * text: The text to be display by the static text widget. | 3099 * text: The text to be display by the static text widget. |
3093 * id: An ID to be used with dw_window_from_id() or 0L. | 3100 * id: An ID to be used with dw_window_from_id() or 0L. |
3094 */ | 3101 */ |
3095 HWND API dw_status_text_new(char *text, ULONG id) | 3102 HWND API dw_status_text_new(char *text, ULONG cid) |
3096 { | 3103 { |
3097 NSTextField *textfield = dw_text_new(text, id); | 3104 NSTextField *textfield = dw_text_new(text, cid); |
3098 [textfield setBordered:YES]; | 3105 [textfield setBordered:YES]; |
3099 [textfield setBezeled:YES]; | 3106 [textfield setBezeled:YES]; |
3100 [textfield setBezelStyle:NSTextFieldSquareBezel]; | 3107 [textfield setBezelStyle:NSTextFieldSquareBezel]; |
3101 [textfield setBackgroundColor:[NSColor colorWithDeviceRed:1 green:1 blue:1 alpha: 0]]; | 3108 [textfield setBackgroundColor:[NSColor colorWithDeviceRed:1 green:1 blue:1 alpha: 0]]; |
3102 [textfield setDrawsBackground:NO]; | 3109 [textfield setDrawsBackground:NO]; |
3107 * Create a new static text window (widget) to be packed. | 3114 * Create a new static text window (widget) to be packed. |
3108 * Parameters: | 3115 * Parameters: |
3109 * text: The text to be display by the static text widget. | 3116 * text: The text to be display by the static text widget. |
3110 * id: An ID to be used with dw_window_from_id() or 0L. | 3117 * id: An ID to be used with dw_window_from_id() or 0L. |
3111 */ | 3118 */ |
3112 HWND API dw_text_new(char *text, ULONG id) | 3119 HWND API dw_text_new(char *text, ULONG cid) |
3113 { | 3120 { |
3114 NSTextField *textfield = [[NSTextField alloc] init]; | 3121 NSTextField *textfield = [[NSTextField alloc] init]; |
3115 [textfield setEditable:NO]; | 3122 [textfield setEditable:NO]; |
3116 [textfield setSelectable:NO]; | 3123 [textfield setSelectable:NO]; |
3117 [textfield setBordered:NO]; | 3124 [textfield setBordered:NO]; |
3118 [textfield setDrawsBackground:NO]; | 3125 [textfield setDrawsBackground:NO]; |
3119 [textfield setStringValue:[ NSString stringWithUTF8String:text ]]; | 3126 [textfield setStringValue:[ NSString stringWithUTF8String:text ]]; |
3127 [textfield setTag:cid]; | |
3120 return textfield; | 3128 return textfield; |
3121 } | 3129 } |
3122 | 3130 |
3123 /* | 3131 /* |
3124 * Creates a rendering context widget (window) to be packed. | 3132 * Creates a rendering context widget (window) to be packed. |
3125 * Parameters: | 3133 * Parameters: |
3126 * id: An id to be used with dw_window_from_id. | 3134 * id: An id to be used with dw_window_from_id. |
3127 * Returns: | 3135 * Returns: |
3128 * A handle to the widget or NULL on failure. | 3136 * A handle to the widget or NULL on failure. |
3129 */ | 3137 */ |
3130 HWND API dw_render_new(unsigned long id) | 3138 HWND API dw_render_new(unsigned long cid) |
3131 { | 3139 { |
3132 DWRender *render = [[DWRender alloc] init]; | 3140 DWRender *render = [[DWRender alloc] init]; |
3141 /* [render setTag:cid]; Why doesn't this work? */ | |
3133 return render; | 3142 return render; |
3134 } | 3143 } |
3135 | 3144 |
3136 /* Sets the current foreground drawing color. | 3145 /* Sets the current foreground drawing color. |
3137 * Parameters: | 3146 * Parameters: |
3416 * Create a tree object to be packed. | 3425 * Create a tree object to be packed. |
3417 * Parameters: | 3426 * Parameters: |
3418 * id: An ID to be used for getting the resource from the | 3427 * id: An ID to be used for getting the resource from the |
3419 * resource file. | 3428 * resource file. |
3420 */ | 3429 */ |
3421 HWND API dw_tree_new(ULONG id) | 3430 HWND API dw_tree_new(ULONG cid) |
3422 { | 3431 { |
3423 NSScrollView *scrollview = [[NSScrollView alloc] init]; | 3432 NSScrollView *scrollview = [[NSScrollView alloc] init]; |
3424 DWTree *tree = [[DWTree alloc] init]; | 3433 DWTree *tree = [[DWTree alloc] init]; |
3425 | 3434 |
3426 [tree setScrollview:scrollview]; | 3435 [tree setScrollview:scrollview]; |
3430 | 3439 |
3431 [tree setAllowsMultipleSelection:NO]; | 3440 [tree setAllowsMultipleSelection:NO]; |
3432 [tree setDataSource:tree]; | 3441 [tree setDataSource:tree]; |
3433 [scrollview setDocumentView:tree]; | 3442 [scrollview setDocumentView:tree]; |
3434 [tree setHeaderView:nil]; | 3443 [tree setHeaderView:nil]; |
3444 [tree setTag:cid]; | |
3435 return tree; | 3445 return tree; |
3436 } | 3446 } |
3437 | 3447 |
3438 /* | 3448 /* |
3439 * Inserts an item into a tree window (widget) after another item. | 3449 * Inserts an item into a tree window (widget) after another item. |
3615 * Create a container object to be packed. | 3625 * Create a container object to be packed. |
3616 * Parameters: | 3626 * Parameters: |
3617 * id: An ID to be used for getting the resource from the | 3627 * id: An ID to be used for getting the resource from the |
3618 * resource file. | 3628 * resource file. |
3619 */ | 3629 */ |
3620 HWND API dw_container_new(ULONG id, int multi) | 3630 HWND API dw_container_new(ULONG cid, int multi) |
3621 { | 3631 { |
3622 DWContainer *cont = _cont_new(id, multi); | 3632 DWContainer *cont = _cont_new(cid, multi); |
3623 NSScrollView *scrollview = [cont scrollview]; | 3633 NSScrollView *scrollview = [cont scrollview]; |
3624 [scrollview setHasHorizontalScroller:YES]; | 3634 [scrollview setHasHorizontalScroller:YES]; |
3625 NSTableHeaderView *header = [[NSTableHeaderView alloc] init]; | 3635 NSTableHeaderView *header = [[NSTableHeaderView alloc] init]; |
3626 [cont setHeaderView:header]; | 3636 [cont setHeaderView:header]; |
3627 return cont; | 3637 return cont; |
4163 /* | 4173 /* |
4164 * Create a new MDI Frame to be packed. | 4174 * Create a new MDI Frame to be packed. |
4165 * Parameters: | 4175 * Parameters: |
4166 * id: An ID to be used with dw_window_from_id or 0L. | 4176 * id: An ID to be used with dw_window_from_id or 0L. |
4167 */ | 4177 */ |
4168 HWND API dw_mdi_new(unsigned long id) | 4178 HWND API dw_mdi_new(unsigned long cid) |
4169 { | 4179 { |
4170 /* There isn't anything like quite like MDI on MacOS... | 4180 /* There isn't anything like quite like MDI on MacOS... |
4171 * However we will make floating windows that hide | 4181 * However we will make floating windows that hide |
4172 * when the application is deactivated to simulate | 4182 * when the application is deactivated to simulate |
4173 * similar behavior. | 4183 * similar behavior. |
4174 */ | 4184 */ |
4175 DWMDI *mdi = [[DWMDI alloc] init]; | 4185 DWMDI *mdi = [[DWMDI alloc] init]; |
4186 /* [mdi setTag:cid]; Why doesn't this work? */ | |
4176 return mdi; | 4187 return mdi; |
4177 } | 4188 } |
4178 | 4189 |
4179 /* | 4190 /* |
4180 * Creates a splitbar window (widget) with given parameters. | 4191 * Creates a splitbar window (widget) with given parameters. |
4183 * topleft: Handle to the window to be top or left. | 4194 * topleft: Handle to the window to be top or left. |
4184 * bottomright: Handle to the window to be bottom or right. | 4195 * bottomright: Handle to the window to be bottom or right. |
4185 * Returns: | 4196 * Returns: |
4186 * A handle to a splitbar window or NULL on failure. | 4197 * A handle to a splitbar window or NULL on failure. |
4187 */ | 4198 */ |
4188 HWND API dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long id) | 4199 HWND API dw_splitbar_new(int type, HWND topleft, HWND bottomright, unsigned long cid) |
4189 { | 4200 { |
4190 DWSplitBar *split = [[DWSplitBar alloc] init]; | 4201 DWSplitBar *split = [[DWSplitBar alloc] init]; |
4191 HWND tmpbox = dw_box_new(DW_VERT, 0); | 4202 HWND tmpbox = dw_box_new(DW_VERT, 0); |
4192 [split setDelegate:split]; | 4203 [split setDelegate:split]; |
4193 dw_box_pack_start(tmpbox, topleft, 0, 0, TRUE, TRUE, 0); | 4204 dw_box_pack_start(tmpbox, topleft, 0, 0, TRUE, TRUE, 0); |
4201 } | 4212 } |
4202 else | 4213 else |
4203 { | 4214 { |
4204 [split setVertical:YES]; | 4215 [split setVertical:YES]; |
4205 } | 4216 } |
4217 /* [split setTag:cid]; Why doesn't this work? */ | |
4206 return split; | 4218 return split; |
4207 } | 4219 } |
4208 | 4220 |
4209 /* | 4221 /* |
4210 * Sets the position of a splitbar (pecentage). | 4222 * Sets the position of a splitbar (pecentage). |
4272 /* | 4284 /* |
4273 * Create a bitmap object to be packed. | 4285 * Create a bitmap object to be packed. |
4274 * Parameters: | 4286 * Parameters: |
4275 * id: An ID to be used with dw_window_from_id() or 0L. | 4287 * id: An ID to be used with dw_window_from_id() or 0L. |
4276 */ | 4288 */ |
4277 HWND API dw_bitmap_new(ULONG id) | 4289 HWND API dw_bitmap_new(ULONG cid) |
4278 { | 4290 { |
4279 NSImageView *bitmap = [[NSImageView alloc] init]; | 4291 NSImageView *bitmap = [[NSImageView alloc] init]; |
4280 [bitmap setImageFrameStyle:NSImageFrameNone]; | 4292 [bitmap setImageFrameStyle:NSImageFrameNone]; |
4281 [bitmap setEditable:NO]; | 4293 [bitmap setEditable:NO]; |
4294 [bitmap setTag:cid]; | |
4282 return bitmap; | 4295 return bitmap; |
4283 } | 4296 } |
4284 | 4297 |
4285 /* | 4298 /* |
4286 * Creates a pixmap with given parameters. | 4299 * Creates a pixmap with given parameters. |
4456 * Not available under OS/2, eCS | 4469 * Not available under OS/2, eCS |
4457 * Parameters: | 4470 * Parameters: |
4458 * text: The text to be display by the static text widget. | 4471 * text: The text to be display by the static text widget. |
4459 * id: An ID to be used with dw_window_from_id() or 0L. | 4472 * id: An ID to be used with dw_window_from_id() or 0L. |
4460 */ | 4473 */ |
4461 HWND API dw_calendar_new(ULONG id) | 4474 HWND API dw_calendar_new(ULONG cid) |
4462 { | 4475 { |
4463 DWCalendar *calendar = [[DWCalendar alloc] init]; | 4476 DWCalendar *calendar = [[DWCalendar alloc] init]; |
4464 /*[calendar setDatePickerMode:UIDatePickerModeDate];*/ | 4477 /*[calendar setDatePickerMode:UIDatePickerModeDate];*/ |
4478 [calendar setTag:cid]; | |
4465 return calendar; | 4479 return calendar; |
4466 } | 4480 } |
4467 | 4481 |
4468 /* | 4482 /* |
4469 * Sets the current date of a calendar | 4483 * Sets the current date of a calendar |
4566 * Not available under OS/2, eCS | 4580 * Not available under OS/2, eCS |
4567 * Parameters: | 4581 * Parameters: |
4568 * text: The default text to be in the entryfield widget. | 4582 * text: The default text to be in the entryfield widget. |
4569 * id: An ID to be used with dw_window_from_id() or 0L. | 4583 * id: An ID to be used with dw_window_from_id() or 0L. |
4570 */ | 4584 */ |
4571 HWND API dw_html_new(unsigned long id) | 4585 HWND API dw_html_new(unsigned long cid) |
4572 { | 4586 { |
4573 WebView *web = [[WebView alloc] init]; | 4587 WebView *web = [[WebView alloc] init]; |
4588 /* [web setTag:cid]; Why doesn't this work? */ | |
4574 return web; | 4589 return web; |
4575 } | 4590 } |
4576 | 4591 |
4577 /* | 4592 /* |
4578 * Returns the current X and Y coordinates of the mouse pointer. | 4593 * Returns the current X and Y coordinates of the mouse pointer. |
4609 * Create a menu object to be popped up. | 4624 * Create a menu object to be popped up. |
4610 * Parameters: | 4625 * Parameters: |
4611 * id: An ID to be used for getting the resource from the | 4626 * id: An ID to be used for getting the resource from the |
4612 * resource file. | 4627 * resource file. |
4613 */ | 4628 */ |
4614 HMENUI API dw_menu_new(ULONG id) | 4629 HMENUI API dw_menu_new(ULONG cid) |
4615 { | 4630 { |
4616 NSMenu *menu = [[[NSMenu alloc] init] autorelease]; | 4631 NSMenu *menu = [[[NSMenu alloc] init] autorelease]; |
4617 [menu setAutoenablesItems:NO]; | 4632 [menu setAutoenablesItems:NO]; |
4633 /* [menu setTag:cid]; Why doesn't this work? */ | |
4618 return menu; | 4634 return menu; |
4619 } | 4635 } |
4620 | 4636 |
4621 /* | 4637 /* |
4622 * Create a menubar on a window. | 4638 * Create a menubar on a window. |
4822 * Create a notebook object to be packed. | 4838 * Create a notebook object to be packed. |
4823 * Parameters: | 4839 * Parameters: |
4824 * id: An ID to be used for getting the resource from the | 4840 * id: An ID to be used for getting the resource from the |
4825 * resource file. | 4841 * resource file. |
4826 */ | 4842 */ |
4827 HWND API dw_notebook_new(ULONG id, int top) | 4843 HWND API dw_notebook_new(ULONG cid, int top) |
4828 { | 4844 { |
4829 DWNotebook *notebook = [[DWNotebook alloc] init]; | 4845 DWNotebook *notebook = [[DWNotebook alloc] init]; |
4830 [notebook setDelegate:notebook]; | 4846 [notebook setDelegate:notebook]; |
4847 /* [notebook setTag:cid]; Why doesn't this work? */ | |
4831 return notebook; | 4848 return notebook; |
4832 } | 4849 } |
4833 | 4850 |
4834 /* | 4851 /* |
4835 * Adds a new page to specified notebook. | 4852 * Adds a new page to specified notebook. |
5347 * (pass 0 if you use the filename param) | 5364 * (pass 0 if you use the filename param) |
5348 * filename: a path to a file (Bitmap on OS/2 or | 5365 * filename: a path to a file (Bitmap on OS/2 or |
5349 * Windows and a pixmap on Unix, pass | 5366 * Windows and a pixmap on Unix, pass |
5350 * NULL if you use the id param) | 5367 * NULL if you use the id param) |
5351 */ | 5368 */ |
5352 void API dw_window_set_bitmap_from_data(HWND handle, unsigned long id, char *data, int len) | 5369 void API dw_window_set_bitmap_from_data(HWND handle, unsigned long cid, char *data, int len) |
5353 { | 5370 { |
5354 NSObject *object = handle; | 5371 NSObject *object = handle; |
5355 if([ object isKindOfClass:[ NSImageView class ] ]) | 5372 if([ object isKindOfClass:[ NSImageView class ] ]) |
5356 { | 5373 { |
5357 NSImageView *iv = handle; | 5374 NSImageView *iv = handle; |
5414 * Gets the child window handle with specified ID. | 5431 * Gets the child window handle with specified ID. |
5415 * Parameters: | 5432 * Parameters: |
5416 * handle: Handle to the parent window. | 5433 * handle: Handle to the parent window. |
5417 * id: Integer ID of the child. | 5434 * id: Integer ID of the child. |
5418 */ | 5435 */ |
5419 HWND API dw_window_from_id(HWND handle, int id) | 5436 HWND API dw_window_from_id(HWND handle, int cid) |
5420 { | 5437 { |
5421 NSObject *object = handle; | 5438 NSObject *object = handle; |
5422 NSView *view = handle; | 5439 NSView *view = handle; |
5423 if([ object isKindOfClass:[ NSWindow class ] ]) | 5440 if([ object isKindOfClass:[ NSWindow class ] ]) |
5424 { | 5441 { |
5425 NSWindow *window = handle; | 5442 NSWindow *window = handle; |
5426 view = [window contentView]; | 5443 view = [window contentView]; |
5427 } | 5444 } |
5428 return [view viewWithTag:id]; | 5445 return [view viewWithTag:cid]; |
5429 } | 5446 } |
5430 | 5447 |
5431 /* | 5448 /* |
5432 * Minimizes or Iconifies a top-level window. | 5449 * Minimizes or Iconifies a top-level window. |
5433 * Parameters: | 5450 * Parameters: |