Chameleon Applications

Chameleon Applications Svn Source Tree

Root/trunk/ChameleonPrefPane/Sources/PreferencesControllerBase.h

1//
2// PreferencesControllerBase.h
3// ChameleonPrefPane
4//
5// Created by Rekursor on 1/22/10.
6//
7
8#import <Cocoa/Cocoa.h>
9#import <ChameleonPrefPane.h>
10#import "string_util.h"
11#import "BootPropertyList.h"
12#import <ShellProcess.h>
13
14
15//--------------------------------------------------------------------------
16const char * const kKernelFlags = "Kernel Flags";
17
18//--------------------------------------------------------------------------
19typedef enum GroupAction
20{
21SetDefaultValues,
22RefreshLockStates,
23LoadPreferencesOptions,
24LoadBootConfigOptions,
25AddOptionsDesc,
26SaveBootConfigOptions
27};
28
29
30
31// ENHANCE ME: remove this globals and integrate them in ChameleonPrefPane or at least
32// add function accessor entry points
33extern PartitionExtractor * partExtractor;
34extern BootPropertyList * prop;
35
36// Defintion of the required protocol for any derived classes of PreferencesControllerBase
37@protocol PreferenceController
38
39@required
40 // must be implemented in all derived classes
41
42// Called by all buttons of each group in therface
43- (IBAction) onCheckButtonChange: (NSButton*) sender;
44
45// Called by all text fields of each group in therface
46- (IBAction) onTextFiedChange: (NSTextField*) sender;
47
48// Add the boot config options descriptors to the consolidated dictionary
49- (void) addOptionsDesc;
50
51// Set refresh all group states {enabled | disabled} depending on the authorizations state
52- (void) refreshLockStates;
53
54// load the corresponding pref filer options from the interface
55- (void) loadOptionsFromPreferencesFile: (NSMutableDictionary*) dict;
56
57@end
58
59// Define common expected behavior for all derived controllers
60@interface PreferencesControllerBase : NSObject
61{
62}
63
64// from the id to desc map in prop, set all default values for dict
65+ (void) setDefaultValues: (NSMutableDictionary*) dict;
66
67// Register the Group panel for further automatic iteration matters
68+ (void) registerPreferencesGroup:(id) myGroup;
69
70// Iterate and execute action for each register group
71+ (void) doForEachGroup: (GroupAction) action withOption:(id) option;
72
73// Set refresh state {enabled | disabled} depending on the authorizations state
74+ (void) refreshLockState: (id) item;
75
76// Unitary Method for Load One option of any type
77+ (void) loadOptionsFromBootFile;
78
79// Method for loading all registred options components in the interface
80+ (void) loadOptionFromBootFile:(id) optionID;
81
82- (void) loadPreferences;
83- (bool) savePreferences;
84
85- (bool) handleSender: (id) sender;
86
87-(NSMutableDictionary*) preferencesFile;
88-(NSMutableDictionary*) preferencesParts;
89
90-(ChameleonPrefPane*) chameleon;
91
92@end
93

Archive Download this file

Revision: 50