summaryrefslogtreecommitdiff
path: root/frontends/cocoa/FormSelectMenu.m
diff options
context:
space:
mode:
authorSven Weidauer <sven@5sw.de>2017-06-05 11:20:56 +0200
committerSven Weidauer <sven@5sw.de>2017-06-05 11:20:56 +0200
commit2ba97ae0dbd01a4f46c543ae025249e5349e0585 (patch)
tree5028ee570078f80f98049bd5a68b209ecfdaca59 /frontends/cocoa/FormSelectMenu.m
parent3ee40a10b123c36be3e29602767840a7a71aaafa (diff)
downloadnetsurf-2ba97ae0dbd01a4f46c543ae025249e5349e0585.tar.gz
netsurf-2ba97ae0dbd01a4f46c543ae025249e5349e0585.tar.bz2
Reformat code using clang-format.
Diffstat (limited to 'frontends/cocoa/FormSelectMenu.m')
-rw-r--r--frontends/cocoa/FormSelectMenu.m57
1 files changed, 28 insertions, 29 deletions
diff --git a/frontends/cocoa/FormSelectMenu.m b/frontends/cocoa/FormSelectMenu.m
index a29d00811..e089b0f59 100644
--- a/frontends/cocoa/FormSelectMenu.m
+++ b/frontends/cocoa/FormSelectMenu.m
@@ -23,81 +23,80 @@
#import "netsurf/browser_window.h"
#import "netsurf/form.h"
-static inline NSRect cocoa_rect_for_control( struct browser_window *bw, struct form_control *control)
+static inline NSRect cocoa_rect_for_control(struct browser_window *bw, struct form_control *control)
{
struct rect r;
form_control_bounding_rect(control, &r);
return cocoa_scaled_rect(browser_window_get_scale(bw),
- r.x0,
- r.y0,
- r.x1,
- r.y1);
+ r.x0,
+ r.y0,
+ r.x1,
+ r.y1);
}
@interface FormSelectMenu () <NSMenuDelegate>
-- (void) itemSelected: (id) sender;
+- (void)itemSelected:(id)sender;
@end
-
@implementation FormSelectMenu
-- (id) initWithControl: (struct form_control *) c forWindow: (struct browser_window *) w
+- (id)initWithControl:(struct form_control *)c forWindow:(struct browser_window *)w
{
- if ((self = [super init]) == nil) return nil;
+ if ((self = [super init]) == nil)
+ return nil;
control = c;
browser = w;
- menu = [[NSMenu alloc] initWithTitle: @"Select"];
+ menu = [[NSMenu alloc] initWithTitle:@"Select"];
if (menu == nil) {
return nil;
}
- [menu addItemWithTitle: @"" action: NULL keyEquivalent: @""];
+ [menu addItemWithTitle:@"" action:NULL keyEquivalent:@""];
NSInteger currentItemIndex = 0;
struct form_option *opt;
for (opt = form_select_get_option(control, 0);
opt != NULL;
opt = opt->next) {
- NSMenuItem *item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithUTF8String: opt->text]
- action: @selector( itemSelected: )
- keyEquivalent: @""];
+ NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithUTF8String:opt->text]
+ action:@selector(itemSelected:)
+ keyEquivalent:@""];
if (opt->selected) {
- [item setState: NSOnState];
+ [item setState:NSOnState];
}
- [item setTarget: self];
- [item setTag: currentItemIndex++];
- [menu addItem: item];
+ [item setTarget:self];
+ [item setTag:currentItemIndex++];
+ [menu addItem:item];
}
- [menu setDelegate: self];
+ [menu setDelegate:self];
return self;
}
-
-- (void) runInView: (NSView *) view
+- (void)runInView:(NSView *)view
{
- (void)(__bridge_retained void *)self;
+ (void)(__bridge_retained void *) self;
- cell = [[NSPopUpButtonCell alloc] initTextCell: @"" pullsDown: YES];
- [cell setMenu: menu];
+ cell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:YES];
+ [cell setMenu:menu];
const NSRect rect = cocoa_rect_for_control(browser, control);
- [cell attachPopUpWithFrame: rect inView: view];
- [cell performClickWithFrame: rect inView: view];
+ [cell attachPopUpWithFrame:rect inView:view];
+ [cell performClickWithFrame:rect inView:view];
}
-- (void) itemSelected: (id) sender
+- (void)itemSelected:(id)sender
{
- form_select_process_selection( control, (int)[sender tag] );
+ form_select_process_selection(control, (int)[sender tag]);
}
-- (void) menuDidClose: (NSMenu *) sender
+- (void)menuDidClose:(NSMenu *)sender
{
(void)(__bridge_transfer id)((__bridge void *)self);
}