tbx  0.7.3
docwindow.h
1 /*
2  * tbx RISC OS toolbox library
3  *
4  * Copyright (C) 2010 Alan Buckley All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 /*
25  * DocWindow.h
26  *
27  * Created on: 8 Oct 2010
28  * Author: alanb
29  */
30 
31 #ifndef TBX_DOCWINDOW_H_
32 #define TBX_DOCWINDOW_H_
33 
34 #include "../window.h"
35 #include "../closewindowlistener.h"
36 #include "../dcs.h"
37 
38 #include "document.h"
39 
40 namespace tbx
41 {
42 namespace doc
43 {
44 
60 class DocWindow :
64  public tbx::DCSSaveListener,
66 {
67 protected:
70 
71 public:
72  DocWindow(Document *doc, std::string template_name);
73  virtual ~DocWindow();
74 
75  virtual void close_window(const tbx::EventInfo &close_event);
76  void dcs_discard(const tbx::EventInfo &info);
77  void dcs_save(const tbx::EventInfo &info);
78  void dcs_cancel(const tbx::EventInfo &info);
79 
84 
89 
90  virtual void document_modified_changed(Document *doc);
91  static Document *document(tbx::Window window);
92 };
93 
94 }
95 }
96 
97 #endif /* TBX_DOCWINDOW_H_ */
Listener for when a cancel is selected from the DCS dialog.
Definition: dcs.h:222
void dcs_save(const tbx::EventInfo &info)
Save selected from the DCS prompt so show save window.
Definition: docwindow.cc:96
virtual void document_modified_changed(Document *doc)
Document modified flag has changed.
Definition: docwindow.cc:128
void dcs_cancel(const tbx::EventInfo &info)
Cancel selected from the DCS prompt so just delete dcs object.
Definition: docwindow.cc:111
Document * document_interface()
Return pointer to the document interface.
Definition: docwindow.h:83
Base class for a document.
Definition: document.h:52
tbx::Window _window
Window showing document.
Definition: docwindow.h:68
Listener for document modified state changed.
Definition: document.h:143
static Document * document(tbx::Window window)
Get the document showed by a window.
Definition: docwindow.cc:120
DocWindow(Document *doc, std::string template_name)
Create the main window for a given document using a resource template.
Definition: docwindow.cc:45
The Window object represents a toolbox window.
Definition: window.h:69
Base class for the document window.
Definition: docwindow.h:60
Class to provide information on a toolbox event.
Definition: eventinfo.h:48
Document * _document
Document that is being shown.
Definition: docwindow.h:69
virtual void close_window(const tbx::EventInfo &close_event)
Close window request from window.
Definition: docwindow.cc:67
Listener for when a save is selected from the DCS dialog.
Definition: dcs.h:210
Listener for when a discard is selected from the DCS dialog.
Definition: dcs.h:198
void dcs_discard(const tbx::EventInfo &info)
Discard selected from DCS prompt so just delete the window.
Definition: docwindow.cc:86
Listener for the close window request message.
Definition: closewindowlistener.h:45
Document * document_interface() const
Return pointer to the document interface.
Definition: docwindow.h:88