bakery
2.6
Main Page
Namespaces
Classes
Files
File List
File Members
bakery
App
App_WithDoc.h
Go to the documentation of this file.
1
/*
2
* Copyright 2000 Murray Cumming
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Library General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
8
*
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Library General Public License for more details.
13
*
14
* You should have received a copy of the GNU Library General Public
15
* License along with this library; if not, write to the Free
16
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
*/
18
19
#ifndef BAKERY_APP_WITHDOC_H
20
#define BAKERY_APP_WITHDOC_H
21
22
#include <
bakery/App/App.h
>
23
#include <
bakery/Document/Document.h
>
24
25
namespace
Bakery
26
{
27
55
class
App_WithDoc
:
virtual
public
App
//virtual because App_WithDoc_Gtk will inherit it via App_With_Doc and via App_Gtk.
56
{
57
public
:
59
App_WithDoc
(
const
Glib::ustring& appname =
""
);
//TODO: appname when using get_derived_widget()
60
61
virtual
~App_WithDoc
();
62
63
virtual
void
init
();
//overridden to create document.
64
65
enum
enumSaveChanges
66
{
67
SAVECHANGES_Save
,
68
SAVECHANGES_Cancel
,
69
SAVECHANGES_Discard
70
};
71
72
static
bool
file_exists
(
const
Glib::ustring& uri);
73
74
protected
:
75
virtual
void
init_create_document
();
//override this to new() the specific document type.
76
81
static
void
add_mime_type
(
const
Glib::ustring& mime_type);
82
84
virtual
Document
*
get_document
();
85
87
virtual
const
Document
*
get_document
()
const
;
88
89
virtual
void
set_document_modified
(
bool
bModified =
true
);
90
95
virtual
bool
open_document
(
const
Glib::ustring& file_uri);
96
97
//This cannot be virtual, because that would break our ABI.
98
//Hopefully that is not necessary.
105
bool
open_document_from_data
(
const
guchar* data, std::size_t length);
106
107
virtual
void
document_history_add
(
const
Glib::ustring& file_uri);
108
virtual
void
document_history_remove
(
const
Glib::ustring& file_uri);
109
110
public
:
111
// We can not take function pointers of these methods in
112
// a derived class if they are protected - for instance, with sigc::mem_fun()
113
//Signal handlers:
114
115
//Menu items:
116
virtual
void
on_menu_file_open
();
117
virtual
void
on_menu_file_saveas
();
//signal handler.
118
virtual
void
offer_saveas
();
//For direct use.
119
virtual
void
on_menu_file_save
();
//signal handler.
120
virtual
void
on_menu_file_close
();
121
122
virtual
void
on_menu_edit_copy
();
123
virtual
void
on_menu_edit_paste
();
124
virtual
void
on_menu_edit_clear
();
125
126
protected
:
127
//Document:
128
130
virtual
void
on_document_modified
(
bool
modified);
131
133
virtual
bool
on_document_load
();
134
135
virtual
void
offer_to_save_changes
();
136
138
virtual
void
cancel_close_or_exit
();
139
141
virtual
void
close_mark_or_destroy
();
142
143
virtual
void
update_window_title
();
144
145
virtual
void
after_successful_save
();
//e.g. disable File|Save.
146
147
virtual
void
ui_warning
(
const
Glib::ustring& text,
const
Glib::ustring& secondary_text) = 0;
148
virtual
Glib::ustring
ui_file_select_open
(
const
Glib::ustring&
ui_file_select_open
= Glib::ustring()) = 0;
149
154
virtual
Glib::ustring
ui_file_select_save
(
const
Glib::ustring& old_file_uri) = 0;
155
156
virtual
void
ui_show_modification_status
() = 0;
157
158
virtual
enumSaveChanges
ui_offer_to_save_changes
() = 0;
159
160
static
Glib::ustring
get_conf_fullkey
(
const
Glib::ustring& key);
161
162
//Document:
163
Document
*
m_pDocument
;
//An instance of a derived type.
164
bool
m_bCloseAfterSave
;
165
166
//Mime types which this application can load and save:
167
typedef
std::list<Glib::ustring>
type_list_strings
;
168
static
type_list_strings
m_mime_types
;
169
};
170
171
}
//namespace
172
173
#endif //BAKERY_APP_WITHDOC_H
Generated by
1.8.3.1