1/*
2 * Copyright 1999-2009 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Jeremy Friesner
7 */
8#ifndef ShortcutsWindow_h
9#define ShortcutsWindow_h
10
11
12#include <Entry.h>
13#include <Window.h>
14
15#include "ColumnListView.h"
16
17class BButton;
18class BFilePanel;
19class BMessage;
20
21// This class defines our preferences/configuration window.
22class ShortcutsWindow : public BWindow {
23public:
24							ShortcutsWindow();
25							~ShortcutsWindow();
26
27	virtual void 			DispatchMessage(BMessage* msg, BHandler* handler);
28	virtual void 			Quit();
29	virtual void 			MessageReceived(BMessage* msg);
30	virtual bool 			QuitRequested();
31
32	// BMessage 'what' codes, representing commands understood by this Window.
33	enum {
34		ADD_HOTKEY_ITEM = 'SpKy',	// Add a new hotkey entry to the GUI list.
35		REMOVE_HOTKEY_ITEM,			// Remove a hotkey entry from the GUI list.
36		HOTKEY_ITEM_SELECTED,		// Give the "focus bar" to the specified
37									// entry.
38		HOTKEY_ITEM_MODIFIED,		// Update the state of an entry to reflect
39									// user's changes.
40		OPEN_KEYSET,				// Bring up a File requester to load new
41									// settings.
42		APPEND_KEYSET,				// Bring up a File requester to append
43									// settings.
44		REVERT_KEYSET,				// Dump the current state and re-read
45									// settings from disk.
46		SAVE_KEYSET,				// Save the current settings to disk
47		SAVE_KEYSET_AS,				// Bring up a File requester to save
48									// current settings.
49		SELECT_APPLICATION,			// Set the current entry to point to the
50									// given file.
51	};
52private:
53			BMenuItem* 			_CreateActuatorPresetMenuItem(const char* label)
54									const;
55			void 				_AddNewSpec(const char* defaultCommand);
56			void 				_MarkKeySetModified();
57			bool 				_LoadKeySet(const BMessage& loadMsg);
58			bool 				_SaveKeySet(BEntry& saveEntry);
59			bool				_GetSettingsFile(entry_ref* ref);
60			void 				_LoadWindowSettings(const BMessage& loadMsg);
61			void 				_SaveWindowSettings(BEntry& saveEntry);
62			bool				_GetWindowSettingsFile(entry_ref* ref);
63
64			BButton*	        fAddButton;
65			BButton* 	        fRemoveButton;
66			BButton* 	        fSaveButton;
67			ColumnListView* 	fColumnListView;
68			BFilePanel* 		fSavePanel;		// for saving settings
69			BFilePanel* 		fOpenPanel;		// for loading settings
70			BFilePanel* 		fSelectPanel;	// for selecting apps to launch
71
72			// Points to the settings file to save to
73			BEntry 				fLastSaved;
74
75			// true iff changes were made since last load or save
76			bool				fKeySetModified;
77
78			// true iff the file-requester's ref should be appended to current
79			bool 				fLastOpenWasAppend;
80};
81
82
83#endif
84
85