]>
git.saurik.com Git - wxWidgets.git/blob - utils/configtool/src/configtooldoc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: configtooldoc.h
3 // Purpose: Document class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _CT_CONFIGTOOLDOC_H_
13 #define _CT_CONFIGTOOLDOC_H_
16 #pragma interface "configtooldoc.cpp"
19 #include "wx/docview.h"
20 #include "wx/cmdproc.h"
22 #include "configitem.h"
24 class wxSimpleHtmlTag
;
30 class ctConfigToolDoc
: public wxDocument
32 DECLARE_DYNAMIC_CLASS(ctConfigToolDoc
)
38 virtual bool OnCreate(const wxString
& path
, long flags
);
39 virtual bool OnOpenDocument(const wxString
& filename
);
40 virtual bool OnSaveDocument(const wxString
& filename
);
41 virtual bool OnNewDocument() { return TRUE
; }
42 virtual bool OnCloseDocument() ;
43 virtual bool Save(); // Overridden only to correct bug in wxWindows, docview.cpp
47 /// Returns the top item.
48 ctConfigItem
* GetTopItem() const { return m_topItem
; }
50 /// Sets the top item.
51 void SetTopItem(ctConfigItem
* item
) { m_topItem
= item
; }
53 /// Returns the clipboard item.
54 ctConfigItem
* GetClipboardItem() const { return m_clipboardItem
; }
56 /// Sets the clipboard item.
57 void SetClipboardItem(ctConfigItem
* item
) ;
59 /// Clears the clipboard item.
60 void ClearClipboard() ;
62 /// Gets the current framework directory
63 wxString
GetFrameworkDir(bool makeUnix
);
73 /// Save the settings file
74 bool DoSave(const wxString
& filename
);
76 /// Recursive helper function for file saving
77 bool DoSave(ctConfigItem
* item
, wxOutputStream
& stream
, int indent
);
79 /// Open the settings file
80 bool DoOpen(const wxString
& filename
);
82 /// Helper for file opening.
83 bool DoOpen(wxSimpleHtmlTag
* tag
, ctConfigItem
* parent
);
85 /// Refresh dependencies
86 void RefreshDependencies();
87 void RefreshDependencies(ctConfigItem
* item
);
89 /// Clear dependencies
90 void ClearDependencies(ctConfigItem
* item
);
92 /// Generate the text of a setup.h
93 wxString
GenerateSetup();
96 void GenerateSetup(ctConfigItem
* item
, wxString
& str
);
98 /// Generate a configure command
99 wxString
GenerateConfigureCommand();
102 void GenerateConfigureCommand(ctConfigItem
* item
, wxString
& str
);
105 ctConfigItem
* m_topItem
;
106 ctConfigItem
* m_clipboardItem
;
111 * Implements a document editing command.
112 * We only need to store one state at a time,
113 * since we don't have (or need) multiple selection.
116 #define ctCMD_NEW_ELEMENT 1
117 #define ctCMD_PASTE 2
119 #define ctCMD_APPLY_PROPERTY 4
121 class ctConfigCommand
: public wxCommand
124 ctConfigCommand(const wxString
& name
, int cmdId
,
125 ctConfigItem
* activeState
, ctConfigItem
* savedState
,
126 ctConfigItem
* parent
= NULL
, ctConfigItem
* insertBefore
= NULL
,
127 bool ignoreFirstTime
= FALSE
);
128 ctConfigCommand(const wxString
& name
, int cmdId
,
129 ctConfigItem
* activeState
, ctProperties
* properties
,
130 bool ignoreFirstTime
= FALSE
);
135 bool DoAndUndo(bool doCmd
); // Combine Do and Undo into one
138 ctConfigItem
* m_activeState
;
139 ctConfigItem
* m_savedState
;
140 ctProperties
* m_properties
;
141 bool m_ignoreThis
; // Ignore 1st Do because we already did it
143 ctConfigItem
* m_parent
;
144 ctConfigItem
* m_insertBefore
;
149 // _CT_CONFIGTOOLDOC_H_