-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathGroupBox.m
More file actions
37 lines (31 loc) · 1.04 KB
/
GroupBox.m
File metadata and controls
37 lines (31 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <Cocoa/Cocoa.h>
@interface Window : NSWindow {
NSBox* groupBox1;
NSBox* groupBox2;
}
- (instancetype)init;
- (BOOL)windowShouldClose:(id)sender;
@end
@implementation Window
- (instancetype)init {
groupBox1 = [[NSBox alloc] initWithFrame:NSMakeRect(10, 10, 305, 460)];
[groupBox1 setTitle:@"GroupBox 1"];
groupBox2 = [[NSBox alloc] initWithFrame:NSMakeRect(325, 10, 305, 460)];
[groupBox2 setTitle:@""];
[super initWithContentRect:NSMakeRect(100, 100, 640, 480) styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO];
[self setTitle:@"GroupBox example"];
[[self contentView] addSubview:groupBox1];
[[self contentView] addSubview:groupBox2];
[self setIsVisible:YES];
return self;
}
- (BOOL)windowShouldClose:(id)sender {
[NSApp terminate:sender];
return YES;
}
@end
int main(int argc, char* argv[]) {
[NSApplication sharedApplication];
[[[[Window alloc] init] autorelease] makeMainWindow];
[NSApp run];
}