<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>bakery: App_WithDoc.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.6 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <h1>App_WithDoc.h</h1><a href="App__WithDoc_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> * Copyright 2000 Murray Cumming</span> <a name="l00003"></a>00003 <span class="comment"> *</span> <a name="l00004"></a>00004 <span class="comment"> * This library is free software; you can redistribute it and/or</span> <a name="l00005"></a>00005 <span class="comment"> * modify it under the terms of the GNU Library General Public</span> <a name="l00006"></a>00006 <span class="comment"> * License as published by the Free Software Foundation; either</span> <a name="l00007"></a>00007 <span class="comment"> * version 2 of the License, or (at your option) any later version.</span> <a name="l00008"></a>00008 <span class="comment"> *</span> <a name="l00009"></a>00009 <span class="comment"> * This library is distributed in the hope that it will be useful,</span> <a name="l00010"></a>00010 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00011"></a>00011 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00012"></a>00012 <span class="comment"> * Library General Public License for more details.</span> <a name="l00013"></a>00013 <span class="comment"> *</span> <a name="l00014"></a>00014 <span class="comment"> * You should have received a copy of the GNU Library General Public</span> <a name="l00015"></a>00015 <span class="comment"> * License along with this library; if not, write to the Free</span> <a name="l00016"></a>00016 <span class="comment"> * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span> <a name="l00017"></a>00017 <span class="comment"> */</span> <a name="l00018"></a>00018 <a name="l00019"></a>00019 <span class="preprocessor">#ifndef BAKERY_APP_WITHDOC_H</span> <a name="l00020"></a>00020 <span class="preprocessor"></span><span class="preprocessor">#define BAKERY_APP_WITHDOC_H</span> <a name="l00021"></a>00021 <span class="preprocessor"></span> <a name="l00022"></a>00022 <span class="preprocessor">#include <<a class="code" href="App_8h.html">bakery/App/App.h</a>></span> <a name="l00023"></a>00023 <span class="preprocessor">#include <<a class="code" href="Document_8h.html">bakery/Document/Document.h</a>></span> <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="keyword">namespace </span>Bakery <a name="l00026"></a>00026 { <a name="l00027"></a>00027 <a name="l00055"></a><a class="code" href="classBakery_1_1App__WithDoc.html">00055</a> <span class="keyword">class </span><a class="code" href="classBakery_1_1App__WithDoc.html" title="Main Window which supports documents.">App_WithDoc</a> : <span class="keyword">virtual</span> <span class="keyword">public</span> <a class="code" href="classBakery_1_1App.html" title="Bakery&#39;s Main Window.">App</a> <span class="comment">//virtual because App_WithDoc_Gtk will inherit it via App_With_Doc and via App_Gtk.</span> <a name="l00056"></a>00056 { <a name="l00057"></a>00057 <span class="keyword">public</span>: <a name="l00059"></a>00059 <a class="code" href="classBakery_1_1App__WithDoc.html#69248ba2e8081b3ac1cf55a9af2636d2" title="Don&#39;t forget to call init() too.">App_WithDoc</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a>& appname = <span class="stringliteral">""</span>); <span class="comment">//TODO: appname when using get_derived_widget()</span> <a name="l00060"></a>00060 <a name="l00061"></a>00061 <span class="keyword">virtual</span> <a class="code" href="classBakery_1_1App__WithDoc.html#d627d00edc8191b6c3bc1a5c6fd58252">~App_WithDoc</a>(); <a name="l00062"></a>00062 <a name="l00063"></a>00063 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#6aa4472a8d745579daa9dcd083c21cfe">init</a>(); <span class="comment">//overridden to create document.</span> <a name="l00064"></a>00064 <a name="l00065"></a><a class="code" href="classBakery_1_1App__WithDoc.html#d1139fe015398aee53fa4dae13aa8b70">00065</a> <span class="keyword">enum</span> <a class="code" href="classBakery_1_1App__WithDoc.html#d1139fe015398aee53fa4dae13aa8b70">enumSaveChanges</a> <a name="l00066"></a>00066 { <a name="l00067"></a><a class="code" href="classBakery_1_1App__WithDoc.html#d1139fe015398aee53fa4dae13aa8b70578d3ad7f4cfb55b372c3244c2a3f317">00067</a> <a class="code" href="classBakery_1_1App__WithDoc.html#d1139fe015398aee53fa4dae13aa8b70578d3ad7f4cfb55b372c3244c2a3f317">SAVECHANGES_Save</a>, <a name="l00068"></a><a class="code" href="classBakery_1_1App__WithDoc.html#d1139fe015398aee53fa4dae13aa8b701a6957218187bb7408b7b7faa6ec6031">00068</a> <a class="code" href="classBakery_1_1App__WithDoc.html#d1139fe015398aee53fa4dae13aa8b701a6957218187bb7408b7b7faa6ec6031">SAVECHANGES_Cancel</a>, <a name="l00069"></a><a class="code" href="classBakery_1_1App__WithDoc.html#d1139fe015398aee53fa4dae13aa8b703402b60613974f304ed3f4d37fd7b22c">00069</a> <a class="code" href="classBakery_1_1App__WithDoc.html#d1139fe015398aee53fa4dae13aa8b703402b60613974f304ed3f4d37fd7b22c">SAVECHANGES_Discard</a> <a name="l00070"></a>00070 }; <a name="l00071"></a>00071 <a name="l00072"></a>00072 <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1App__WithDoc.html#941eb2a6bcba0b98208af6594c8c5183">file_exists</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a>& uri); <a name="l00073"></a>00073 <a name="l00074"></a>00074 <span class="keyword">protected</span>: <a name="l00075"></a>00075 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#7e23b7d71efae7b09563b6f97a1fa9e3">init_create_document</a>(); <span class="comment">//override this to new() the specific document type.</span> <a name="l00076"></a>00076 <a name="l00081"></a>00081 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#f8a4061293fa41eaa1f1c594733cbc44" title="Add a MIME-type that this application can support.">add_mime_type</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a>& mime_type); <a name="l00082"></a>00082 <a name="l00084"></a>00084 <span class="keyword">virtual</span> <a class="code" href="classBakery_1_1Document.html" title="The Document is like the &#39;Model&#39; in the Model-View-Controller framework.">Document</a>* <a class="code" href="classBakery_1_1App__WithDoc.html#9e5ee857e65ad7900decbda4ffca5a21" title="static_cast&lt;&gt; or dynamic_cast&lt;&gt; this pointer to the correct type.">get_document</a>(); <a name="l00085"></a>00085 <a name="l00087"></a>00087 <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="classBakery_1_1Document.html" title="The Document is like the &#39;Model&#39; in the Model-View-Controller framework.">Document</a>* <a class="code" href="classBakery_1_1App__WithDoc.html#9e5ee857e65ad7900decbda4ffca5a21" title="static_cast&lt;&gt; or dynamic_cast&lt;&gt; this pointer to the correct type.">get_document</a>() <span class="keyword">const</span> ; <a name="l00088"></a>00088 <a name="l00089"></a>00089 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#603630b803c1cad5fd7d7dfa21f83bab">set_document_modified</a>(<span class="keywordtype">bool</span> bModified = <span class="keyword">true</span>); <a name="l00090"></a>00090 <a name="l00095"></a>00095 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1App__WithDoc.html#384c241eff005f208bb575bdc4bfdae6" title="Open the document from a file at a URI.">open_document</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a>& file_uri); <a name="l00096"></a>00096 <a name="l00097"></a>00097 <span class="comment">//This cannot be virtual, because that would break our ABI.</span> <a name="l00098"></a>00098 <span class="comment">//Hopefully that is not necessary.</span> <a name="l00105"></a>00105 <span class="comment"></span> <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1App__WithDoc.html#7de8f1eb902dfaadce7829b6aa5e7a70" title="Open the document using the supplied document contents.">open_document_from_data</a>(<span class="keyword">const</span> guchar* data, std::size_t length); <a name="l00106"></a>00106 <a name="l00107"></a>00107 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#21f1b4c8cf4a31be2f24cfa03f7b7bee">document_history_add</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a>& file_uri); <a name="l00108"></a>00108 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#429695d665905852938dd5878d2343a1">document_history_remove</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a>& file_uri); <a name="l00109"></a>00109 <a name="l00110"></a>00110 <span class="keyword">public</span>: <a name="l00111"></a>00111 <span class="comment">// We can not take function pointers of these methods in </span> <a name="l00112"></a>00112 <span class="comment">// a derived class if they are protected - for instance, with sigc::mem_fun()</span> <a name="l00113"></a>00113 <span class="comment">//Signal handlers:</span> <a name="l00114"></a>00114 <a name="l00115"></a>00115 <span class="comment">//Menu items:</span> <a name="l00116"></a>00116 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#e2c8fcd39321b7f50916b3e3acc79b0c">on_menu_file_open</a>(); <a name="l00117"></a>00117 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#d91a46849d929832d13bd2a33194ab9b">on_menu_file_saveas</a>(); <span class="comment">//signal handler.</span> <a name="l00118"></a>00118 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#e9d5fd93995d83ec72ee6106a7624471">offer_saveas</a>(); <span class="comment">//For direct use.</span> <a name="l00119"></a>00119 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#6371f44318f346f97fa31386759f5d8a">on_menu_file_save</a>(); <span class="comment">//signal handler.</span> <a name="l00120"></a>00120 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#d441ec02327bfdffd9f7da6a6d9ba620">on_menu_file_close</a>(); <a name="l00121"></a>00121 <a name="l00122"></a>00122 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#e7a3b3d7a88ff6fb7e36aa758f0821dd">on_menu_edit_copy</a>(); <a name="l00123"></a>00123 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#b1f9cc438db2906be25103e42f665594">on_menu_edit_paste</a>(); <a name="l00124"></a>00124 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#5337b9839b020535212087735649f1c2">on_menu_edit_clear</a>(); <a name="l00125"></a>00125 <a name="l00126"></a>00126 <span class="keyword">protected</span>: <a name="l00127"></a>00127 <span class="comment">//Document:</span> <a name="l00128"></a>00128 <a name="l00130"></a>00130 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#c1866692a24f8b8707e06ec4cce9df48" title="Update visual status.">on_document_modified</a>(<span class="keywordtype">bool</span> modified); <a name="l00131"></a>00131 <a name="l00133"></a>00133 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1App__WithDoc.html#d728d9add2bc3f5fae656fdd190282f9" title="override this to show document contents.">on_document_load</a>(); <a name="l00134"></a>00134 <a name="l00135"></a>00135 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#c0c6040a9a18644a3a20a80042de4cae">offer_to_save_changes</a>(); <a name="l00136"></a>00136 <a name="l00138"></a>00138 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#ecc8a1c74a64295b155dd642744409b3" title="Stop the File|Close or the File|Exit.">cancel_close_or_exit</a>(); <a name="l00139"></a>00139 <a name="l00141"></a>00141 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#018ec06b4bc374cc0f79b15fca93593f" title="destroy it or mark it for destruction.">close_mark_or_destroy</a>(); <a name="l00142"></a>00142 <a name="l00143"></a>00143 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#c467abb5cd0200320d792c097794dc48">update_window_title</a>(); <a name="l00144"></a>00144 <a name="l00145"></a>00145 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#9b12bc97d74e0b952b201bb8015d6715">after_successful_save</a>(); <span class="comment">//e.g. disable File|Save.</span> <a name="l00146"></a>00146 <a name="l00147"></a>00147 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#bee059da2d91028948813d6d1557b6d9">ui_warning</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a>& text, <span class="keyword">const</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a>& secondary_text) = 0; <a name="l00148"></a>00148 <span class="keyword">virtual</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a> <a class="code" href="classBakery_1_1App__WithDoc.html#e65002706e900647cc09db7abe8867ae">ui_file_select_open</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a>& <a class="code" href="classBakery_1_1App__WithDoc.html#e65002706e900647cc09db7abe8867ae">ui_file_select_open</a> = <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a>()) = 0; <a name="l00149"></a>00149 <a name="l00154"></a>00154 <span class="keyword">virtual</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a> <a class="code" href="classBakery_1_1App__WithDoc.html#68c831f99c05366e78d65220ecca8b1e" title="Present a user interface that allows the user to select a location to save the file...">ui_file_select_save</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a>& old_file_uri) = 0; <a name="l00155"></a>00155 <a name="l00156"></a>00156 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBakery_1_1App__WithDoc.html#bc8b1ebeb4e4da58bf5c76018858a633">ui_show_modification_status</a>() = 0; <a name="l00157"></a>00157 <a name="l00158"></a>00158 <span class="keyword">virtual</span> <a class="code" href="classBakery_1_1App__WithDoc.html#d1139fe015398aee53fa4dae13aa8b70">enumSaveChanges</a> <a class="code" href="classBakery_1_1App__WithDoc.html#de3e9d61e0132f3d20fb712014c91669">ui_offer_to_save_changes</a>() = 0; <a name="l00159"></a>00159 <a name="l00160"></a>00160 <span class="keyword">static</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a> <a class="code" href="classBakery_1_1App__WithDoc.html#35d9d67492957378938e12b2142fefaf">get_conf_fullkey</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="glibmm_doxygen_tags:" href="classGlib_1_1ustring.html">Glib::ustring</a>& key); <a name="l00161"></a>00161 <a name="l00162"></a>00162 <span class="comment">//Document:</span> <a name="l00163"></a><a class="code" href="classBakery_1_1App__WithDoc.html#ab35979811be0c81db2ce119ea5c745e">00163</a> <a class="code" href="classBakery_1_1Document.html" title="The Document is like the &#39;Model&#39; in the Model-View-Controller framework.">Document</a>* <a class="code" href="classBakery_1_1App__WithDoc.html#ab35979811be0c81db2ce119ea5c745e">m_pDocument</a>; <span class="comment">//An instance of a derived type.</span> <a name="l00164"></a><a class="code" href="classBakery_1_1App__WithDoc.html#66e7fd39568190167d63725e6f34bca8">00164</a> <span class="keywordtype">bool</span> <a class="code" href="classBakery_1_1App__WithDoc.html#66e7fd39568190167d63725e6f34bca8">m_bCloseAfterSave</a>; <a name="l00165"></a>00165 <a name="l00166"></a>00166 <span class="comment">//Mime types which this application can load and save:</span> <a name="l00167"></a><a class="code" href="classBakery_1_1App__WithDoc.html#ed77a511b3a2e05b7c413eb9718ee850">00167</a> <span class="keyword">typedef</span> std::list<Glib::ustring> <a class="code" href="classBakery_1_1App__WithDoc.html#ed77a511b3a2e05b7c413eb9718ee850">type_list_strings</a>; <a name="l00168"></a><a class="code" href="classBakery_1_1App__WithDoc.html#8ed22f79024c388da7df3a94cddb0ea6">00168</a> <span class="keyword">static</span> <a class="code" href="classBakery_1_1App__WithDoc.html#ed77a511b3a2e05b7c413eb9718ee850">type_list_strings</a> <a class="code" href="classBakery_1_1App__WithDoc.html#8ed22f79024c388da7df3a94cddb0ea6">m_mime_types</a>; <a name="l00169"></a>00169 }; <a name="l00170"></a>00170 <a name="l00171"></a>00171 } <span class="comment">//namespace</span> <a name="l00172"></a>00172 <a name="l00173"></a>00173 <span class="preprocessor">#endif //BAKERY_APP_WITHDOC_H</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Mon Dec 8 18:42:35 2008 for bakery by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> </body> </html>