-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAppController.h
More file actions
130 lines (112 loc) · 5.2 KB
/
Copy pathAppController.h
File metadata and controls
130 lines (112 loc) · 5.2 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
////////////////////////////////////////////////////////////////////////////////
/// @file AppController.h
/// @author Michael Wisely
/// @brief Header for AppController class
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @class AppController
/// @brief The central class for the application. It houses the window, menus,
/// and buttons, as well as an instance of the PuzzleBoard
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @fn applicationWillFinishLaunching: (NSNotification *) notification
/// @brief sets up the UI elements of the window and any other pre-launch prep
/// @pre none
/// @post a Window is created and menus are created and set up
/// @param notification, an NSNotification
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @fn applicationDidFinishLaunching: (NSNotification *) notification
/// @brief sets the window as the key item
/// @pre appWillFinish was called and items are set up
/// @post the created window is made key and ordered front
/// @param notification, an NSNotification
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @fn open: (NSString *) fileName
/// @brief reads in a sudoku file and fills in the board
/// @pre none
/// @post the AppController's board object is filled in according to the file
/// @param fileName, the entire path of the file, including the name.
/// for example, /home/bob/UnfinishedPuzzles/hard.sudoku
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @fn setEasy: (id)sender
/// @brief sets the current difficulty to easy
/// @pre none
/// @post the AppController's current difficulty is set to easy/novice
/// @param sender
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @fn setMedium: (id)sender
/// @brief sets the current difficulty to medium
/// @pre none
/// @post the AppController's current difficulty is set to medium/intermediate
/// @param sender
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @fn setHard: (id)sender
/// @brief sets the current difficulty to hard
/// @pre none
/// @post the AppController's current difficulty is set to hard/expert
/// @param sender
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @fn loadNewGame: (id)sender
/// @brief opens an arbitrary game from a directory of premade games
/// @pre none
/// @post the AppController's board object is filled in according to a randomly
/// chosen game file of the specified difficulty
/// @paran sender
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @fn presentOpenMenu: (id)sender
/// @brief opens the game specified by the user
/// @pre the user has saved some past game which they can open
/// @post the AppController's board object is filled in according to the file
/// @paran sender
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @fn presentSaveMenu: (id)sender
/// @brief saves the game to a location specified by the user
/// @pre none
/// @post the AppController's board object is saved to disk
/// @paran sender
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @fn solve: (id)sender
/// @brief solves the sudoku puzzle entered in the matrix
/// @pre none
/// @post the AppController's puzzle is solved
/// @param sender
////////////////////////////////////////////////////////////////////////////////
#ifndef _AppController_H_
#define _AppController_H_
#include "puzzleBoard.h"
#include <stdlib.h>
#include <time.h>
#include <Foundation/NSObject.h>
#include <AppKit/AppKit.h>
@class NSWindow;
@class NSTextField;
@class NSNotification;
@interface AppController : NSObject
{
NSWindow *window;
PuzzleBoard *board; //! An NSMatrix subclass
NSButton *easy;
NSButton *medium;
NSButton *hard;
NSString *current_diff; //! Current difficulty
}
-(void) applicationWillFinishLaunching: (NSNotification *) notification;
-(void) applicationDidFinishLaunching: (NSNotification *) notification;
-(void) open: (NSString*) fileName;
-(void) loadNewGame: (id)sender;
-(void) setEasy: (id)sender;
-(void) setMedium: (id)sender;
-(void) setHard: (id)sender;
-(void) presentOpenMenu:(id)sender;
-(void) solve: (id)sender;
@end
#endif