summaryrefslogtreecommitdiff
path: root/win32/makedrop/dropsheet.h
blob: 48ec7585705fa5ccd9fa66794f8bec7b89d0d586 (plain)
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
/*
 * AUTHOR
 * N. Nielsen
 *
 * LICENSE
 * This software is in the public domain.
 *
 * The software is provided "as is", without warranty of any kind,
 * express or implied, including but not limited to the warranties
 * of merchantability, fitness for a particular purpose, and
 * noninfringement. In no event shall the author(s) be liable for any
 * claim, damages, or other liability, whether in an action of
 * contract, tort, or otherwise, arising from, out of, or in connection
 * with the software or the use or other dealings in the software.
 *
 * SUPPORT
 * Send bug reports to: <nielsen@memberwebs.com>
 */

#ifndef __DROPSHEET_H__
#define __DROPSHEET_H__

#include "resource.h"
#include "common/droplet.h"

// DropSheet: ------------------------------------------------------
//  The main window property sheet

class DropSheet
	: public CPropertySheet
{
public:
	DropSheet();
	virtual ~DropSheet();

	BEGIN_MSG_MAP(DropSheet)
		MESSAGE_HANDLER(WM_INITDIALOG, onInitDialog)
		COMMAND_ID_HANDLER(ID_FILE_OPEN, onOpen)
		COMMAND_ID_HANDLER(ID_FILE_SAVE, onSave)
		COMMAND_ID_HANDLER(ID_FILE_EXIT, onExit)
		MESSAGE_HANDLER(PSM_CHANGED, onChanged)
		MESSAGE_HANDLER(WM_CLOSE, onClose)
		CHAIN_MSG_MAP(CPropertySheet)
	END_MSG_MAP()

	// Get the current internal droplet
	Droplet& getDroplet()
		{ return m_droplet; }

// Message Handlers
protected:
	LRESULT onInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT onClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT onChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT onOpen(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT onSave(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT onExit(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);

// Helper Functions
protected:
	// Save the droplet, prompt user if not force
	bool saveDroplet(bool force);
	// Open the a droplet
	void openDroplet();

protected:
	Droplet m_droplet;		// The internal loaded droplet
	bool m_dirty;			// Have changes been made?
	string m_fileName;		// The filename to save to
};

#endif // !defined(AFX_DROPSHEET_H__E3237E90_1FD0_4233_98EE_5991F4FB39F8__INCLUDED_)