@@ -235,29 +235,6 @@ - (BOOL)acceptsFirstResponder;
235
235
// - (void)flagsChanged:(NSEvent*)event;
236
236
@end
237
237
238
- @interface ScrollableButton : NSButton
239
- {
240
- SEL scrollWheelUpAction;
241
- SEL scrollWheelDownAction;
242
- }
243
- - (void )setScrollWheelUpAction : (SEL )action ;
244
- - (void )setScrollWheelDownAction : (SEL )action ;
245
- - (void )scrollWheel : (NSEvent *)event ;
246
- @end
247
-
248
- @interface MenuItem : NSMenuItem
249
- { int index ;
250
- }
251
- + (MenuItem*)menuItemWithTitle : (NSString *)title ;
252
- + (MenuItem*)menuItemSelectAll ;
253
- + (MenuItem*)menuItemInvertAll ;
254
- + (MenuItem*)menuItemForAxis : (int )i ;
255
- - (void )toggle : (id )sender ;
256
- - (void )selectAll : (id )sender ;
257
- - (void )invertAll : (id )sender ;
258
- - (int )index ;
259
- @end
260
-
261
238
/* ---------------------------- Python classes ---------------------------- */
262
239
263
240
static bool backend_inited = false ;
@@ -2188,110 +2165,6 @@ - (void)flagsChanged:(NSEvent*)event
2188
2165
*/
2189
2166
@end
2190
2167
2191
- @implementation ScrollableButton
2192
- - (void )setScrollWheelUpAction : (SEL )action
2193
- {
2194
- scrollWheelUpAction = action;
2195
- }
2196
-
2197
- - (void )setScrollWheelDownAction : (SEL )action
2198
- {
2199
- scrollWheelDownAction = action;
2200
- }
2201
-
2202
- - (void )scrollWheel : (NSEvent *)event
2203
- {
2204
- float d = [event deltaY ];
2205
- Window* target = [self target ];
2206
- if (d > 0 )
2207
- [NSApp sendAction: scrollWheelUpAction to: target from: self ];
2208
- else if (d < 0 )
2209
- [NSApp sendAction: scrollWheelDownAction to: target from: self ];
2210
- }
2211
- @end
2212
-
2213
- @implementation MenuItem
2214
- + (MenuItem*)menuItemWithTitle : (NSString *)title
2215
- {
2216
- MenuItem* item = [[MenuItem alloc ] initWithTitle: title
2217
- action: nil
2218
- keyEquivalent: @" " ];
2219
- item->index = -1 ;
2220
- return [item autorelease ];
2221
- }
2222
-
2223
- + (MenuItem*)menuItemForAxis : (int )i
2224
- {
2225
- NSString * title = [NSString stringWithFormat: @" Axis %d " , i+1 ];
2226
- MenuItem* item = [[MenuItem alloc ] initWithTitle: title
2227
- action: @selector (toggle: )
2228
- keyEquivalent: @" " ];
2229
- [item setTarget: item];
2230
- [item setState: NSOnState ];
2231
- item->index = i;
2232
- return [item autorelease ];
2233
- }
2234
-
2235
- + (MenuItem*)menuItemSelectAll
2236
- {
2237
- MenuItem* item = [[MenuItem alloc ] initWithTitle: @" Select All"
2238
- action: @selector (selectAll: )
2239
- keyEquivalent: @" " ];
2240
- [item setTarget: item];
2241
- item->index = -1 ;
2242
- return [item autorelease ];
2243
- }
2244
-
2245
- + (MenuItem*)menuItemInvertAll
2246
- {
2247
- MenuItem* item = [[MenuItem alloc ] initWithTitle: @" Invert All"
2248
- action: @selector (invertAll: )
2249
- keyEquivalent: @" " ];
2250
- [item setTarget: item];
2251
- item->index = -1 ;
2252
- return [item autorelease ];
2253
- }
2254
-
2255
- - (void )toggle : (id )sender
2256
- {
2257
- if ([self state ]) [self setState: NSOffState ];
2258
- else [self setState: NSOnState ];
2259
- }
2260
-
2261
- - (void )selectAll : (id )sender
2262
- {
2263
- NSMenu * menu = [sender menu ];
2264
- if (!menu) return ; /* Weird */
2265
- NSArray * items = [menu itemArray ];
2266
- NSEnumerator * enumerator = [items objectEnumerator ];
2267
- MenuItem* item;
2268
- while ((item = [enumerator nextObject ]))
2269
- {
2270
- if (item->index >= 0 ) [item setState: NSOnState ];
2271
- }
2272
- }
2273
-
2274
- - (void )invertAll : (id )sender
2275
- {
2276
- NSMenu * menu = [sender menu ];
2277
- if (!menu) return ; /* Weird */
2278
- NSArray * items = [menu itemArray ];
2279
- NSEnumerator * enumerator = [items objectEnumerator ];
2280
- MenuItem* item;
2281
- while ((item = [enumerator nextObject ]))
2282
- {
2283
- if (item->index < 0 ) continue ;
2284
- if ([item state ]==NSOffState ) [item setState: NSOnState ];
2285
- else [item setState: NSOffState ];
2286
- }
2287
- }
2288
-
2289
- - (int )index
2290
- {
2291
- return self->index ;
2292
- }
2293
- @end
2294
-
2295
2168
static PyObject*
2296
2169
show (PyObject* self)
2297
2170
{
0 commit comments