|
1
|
1 #import "stdafx.h"
|
|
|
2 #import "fooSampleMacPreferences.h"
|
|
|
3
|
|
|
4 namespace foo_sample {
|
|
|
5 extern cfg_uint cfg_bogoSetting1, cfg_bogoSetting2;
|
|
|
6 }
|
|
|
7
|
|
|
8 @interface fooSampleMacPreferences ()
|
|
|
9 @property (nonatomic) NSNumber* bogo1;
|
|
|
10 @property (nonatomic) NSNumber* bogo2;
|
|
|
11 @end
|
|
|
12
|
|
|
13 @implementation fooSampleMacPreferences
|
|
|
14
|
|
|
15 - (void)viewDidLoad {
|
|
|
16 [super viewDidLoad];
|
|
|
17 // Do view setup here.
|
|
|
18 }
|
|
|
19 - (instancetype)init {
|
|
|
20 // IMPORTANT: feed OUR NSBundle, bundleForClass works well for this
|
|
|
21 self = [self initWithNibName: @"fooSampleMacPreferences" bundle:[NSBundle bundleForClass: [self class]]];
|
|
|
22 [self loadSettings];
|
|
|
23 return self;
|
|
|
24 }
|
|
|
25 - (void) loadSettings {
|
|
|
26 self.bogo1 = [NSNumber numberWithUnsignedLong: foo_sample::cfg_bogoSetting1];
|
|
|
27 self.bogo2 = [NSNumber numberWithUnsignedLong: foo_sample::cfg_bogoSetting2];
|
|
|
28 }
|
|
|
29 - (IBAction)onBogo1:(id)sender {
|
|
|
30 foo_sample::cfg_bogoSetting1 = self.bogo1.unsignedLongValue;
|
|
|
31 }
|
|
|
32 - (IBAction)onBogo2:(id)sender {
|
|
|
33 foo_sample::cfg_bogoSetting2 = self.bogo2.unsignedLongValue;
|
|
|
34 }
|
|
|
35
|
|
|
36
|
|
|
37 @end
|
|
|
38
|
|
|
39
|
|
|
40
|
|
|
41
|
|
|
42
|
|
|
43 namespace {
|
|
|
44 class preferences_page_sample : public preferences_page {
|
|
|
45 public:
|
|
|
46 service_ptr instantiate() override {
|
|
|
47 return fb2k::wrapNSObject( [ fooSampleMacPreferences new ] );
|
|
|
48 }
|
|
|
49 const char * get_name() override {return "Sample Component";}
|
|
|
50 GUID get_guid() override {
|
|
|
51 // This is our GUID. Replace with your own when reusing the code.
|
|
|
52 return GUID { 0x7702c93e, 0x24dc, 0x48ed, { 0x8d, 0xb1, 0x3f, 0x27, 0xb3, 0x8c, 0x7c, 0xc9 } };
|
|
|
53 }
|
|
|
54 GUID get_parent_guid() override {return guid_tools;}
|
|
|
55 };
|
|
|
56
|
|
|
57 FB2K_SERVICE_FACTORY(preferences_page_sample);
|
|
|
58 }
|