Changeset 49 for trunk/src/IMainView.h
- Timestamp:
- 04/13/06 05:47:01 (3 years ago)
- Files:
-
- 1 modified
-
trunk/src/IMainView.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/IMainView.h
r36 r49 26 26 class DocumentPage; 27 27 28 /// 29 /// @class IMainView 30 /// @brief Interface class for the main view. 31 /// 32 /// This is the base class for all toolkit dependent implementations 33 /// of the main view. This is the class responsible to get all user 34 /// events and pass them to the presenter. 35 /// 28 36 class IMainView 29 37 { 30 38 public: 31 virtual ~IMainView () {} 32 33 virtual gchar *openFileDialog () = 0; 34 virtual gchar *promptPasswordDialog () = 0; 39 /// 40 /// @brief Destroys the main window's dynamically allocated memory. 41 /// 42 virtual ~IMainView (void) {} 43 44 /// 45 /// @brief Shows the open file dialog. 46 /// 47 /// The view must ask the user which file to open by using 48 /// the toolkit's specific open dialog. 49 /// 50 /// @return A copy of the file name that the user will try to open 51 /// or NULL if the user cancelled the operation. 52 /// This string will be freed by the presenter. 53 /// 54 virtual gchar *openFileDialog (void) = 0; 55 56 /// 57 /// @brief Shows the password dialog. 58 /// 59 /// This is used when the user wants to open an encrypted file. 60 /// The view must ask the password to the user. It will be called 61 /// up to three times by the presenter. 62 /// 63 /// @return A copy of the password entered by the user or NULL 64 /// if the user cancelled the operation. 65 /// This string will be freed by the presenter. 66 /// 67 virtual gchar *promptPasswordDialog (void) = 0; 68 69 /// 70 /// @brief Changes the sensitivity of the "Go To First Page" action. 71 /// 72 /// The view must change the sensitivity (it's called enabled or 73 /// disabled on some toolkits) of the "Go To First Page" action 74 /// (both on the menu and the toolbar or any other place). 75 /// 76 /// @param sensitive Set to TRUE if need to make sensitive (enable) 77 /// the action (enable) or FALSE to 78 /// insensitive (disable) it. 79 /// 35 80 virtual void sensitiveGoToFirstPage (gboolean sensitive) = 0; 81 82 /// 83 /// @brief Changes the sensitivity of the "Go To Last Page" action. 84 /// 85 /// The view must change the sensitivity (it's called enabled or 86 /// disabled on some toolkits) of the "Go To Last Page" action 87 /// (both on the menu and the toolbar or any other place). 88 /// 89 /// @param sensitive Set to TRUE if need to make sensitive (enable) 90 /// the action (enable) or FALSE to 91 /// insensitive (disable) it. 92 /// 36 93 virtual void sensitiveGoToLastPage (gboolean sensitive) = 0; 94 95 /// 96 /// @brief Changes the sensitivity of the "Go To Next Page" action. 97 /// 98 /// The view must change the sensitivity (it's called enabled or 99 /// disabled on some toolkits) of the "Go To Next Page" action 100 /// (both on the menu and the toolbar or any other place). 101 /// 102 /// @param sensitive Set to TRUE if need to make sensitive (enable) 103 /// the action (enable) or FALSE to 104 /// insensitive (disable) it. 105 /// 37 106 virtual void sensitiveGoToNextPage (gboolean sensitive) = 0; 107 108 /// 109 /// @brief Changes the sensitivity of the "Go To Page" action. 110 /// 111 /// The view must change the sensitivity (it's called enabled or 112 /// disabled on some toolkits) of the "Go To Page" action 113 /// (both on the menu and the toolbar or any other place). 114 /// 115 /// @param sensitive Set to TRUE if need to make sensitive (enable) 116 /// the action (enable) or FALSE to 117 /// insensitive (disable) it. 118 /// 38 119 virtual void sensitiveGoToPage (gboolean sensitive) = 0; 120 121 /// 122 /// @brief Changes the sensitivity of the "Go To Prev. Page" action. 123 /// 124 /// The view must change the sensitivity (it's called enabled or 125 /// disabled on some toolkits) of the "Go To Previous Page" action 126 /// (both on the menu and the toolbar or any other place). 127 /// 128 /// @param sensitive Set to TRUE if need to make sensitive (enable) 129 /// the action (enable) or FALSE to 130 /// insensitive (disable) it. 131 /// 39 132 virtual void sensitiveGoToPreviousPage (gboolean sensitive) = 0; 133 134 /// 135 /// @brief Changes the sensitivity of the "Rotate Left" action. 136 /// 137 /// The view must change the sensitivity (it's called enabled or 138 /// disabled on some toolkits) of the "Rotate Left" action 139 /// (both on the menu and the toolbar or any other place). 140 /// 141 /// @param sensitive Set to TRUE if need to make sensitive (enable) 142 /// the action (enable) or FALSE to 143 /// insensitive (disable) it. 144 /// 40 145 virtual void sensitiveRotateLeft (gboolean sensitive) = 0; 146 147 /// 148 /// @brief Changes the sensitivity of the "Rotate Right" action. 149 /// 150 /// The view must change the sensitivity (it's called enabled or 151 /// disabled on some toolkits) of the "Rotate Right" action 152 /// (both on the menu and the toolbar or any other place). 153 /// 154 /// @param sensitive Set to TRUE if need to make sensitive (enable) 155 /// the action (enable) or FALSE to 156 /// insensitive (disable) it. 157 /// 41 158 virtual void sensitiveRotateRight (gboolean sensitive) = 0; 159 160 /// 161 /// @brief Changes the sensitivity of the "Zoom In" action. 162 /// 163 /// The view must change the sensitivity (it's called enabled or 164 /// disabled on some toolkits) of the "Zoom In" action 165 /// (both on the menu and the toolbar or any other place). 166 /// 167 /// @param sensitive Set to TRUE if need to make sensitive (enable) 168 /// the action (enable) or FALSE to 169 /// insensitive (disable) it. 170 /// 42 171 virtual void sensitiveZoomIn (gboolean sensitive) = 0; 172 173 /// 174 /// @brief Changes the sensitivity of the "Zoom Out" action. 175 /// 176 /// The view must change the sensitivity (it's called enabled or 177 /// disabled on some toolkits) of the "Zoom Out" action 178 /// (both on the menu and the toolbar or any other place). 179 /// 180 /// @param sensitive Set to TRUE if need to make sensitive (enable) 181 /// the action (enable) or FALSE to 182 /// insensitive (disable) it. 183 /// 43 184 virtual void sensitiveZoomOut (gboolean sensitive) = 0; 185 186 /// 187 /// @brief Changes the sensitivity of the "Zoom to Fit" action. 188 /// 189 /// The view must change the sensitivity (it's called enabled or 190 /// disabled on some toolkits) of the "Zoom to Fit" action 191 /// (both on the menu and the toolbar or any other place). 192 /// 193 /// @param sensitive Set to TRUE if need to make sensitive (enable) 194 /// the action (enable) or FALSE to 195 /// insensitive (disable) it. 196 /// 44 197 virtual void sensitiveZoomFit (gboolean sensitive) = 0; 198 199 /// 200 /// @brief Changes the sensitivity of the "Zoom to Width" action. 201 /// 202 /// The view must change the sensitivity (it's called enabled or 203 /// disabled on some toolkits) of the "Zoom to Width" action 204 /// (both on the menu and the toolbar or any other place). 205 /// 206 /// @param sensitive Set to TRUE if need to make sensitive (enable) 207 /// the action (enable) or FALSE to 208 /// insensitive (disable) it. 209 /// 45 210 virtual void sensitiveZoomWidth (gboolean sensitive) = 0; 211 212 /// 213 /// @brief Makes the main view to show itself. 214 /// 215 /// From the main view's creation until the presenter calls 216 /// this function, the main view must remain hidden. 217 /// 46 218 virtual void show (void) = 0; 219 220 /// 221 /// @brief Shows an error message dialog. 222 /// 223 /// Shows to the user a dialog with an error message. Use 224 /// the toolkit's dialog feature to show it. 225 /// 226 /// Some environments uses the @a title and @a body as the 227 /// dialog's primary and secondary texts respectively. The 228 /// presenter doesn't care. 229 /// 230 /// @param title The error dialog's title. 231 /// @param body The error dialog's body (the error message.) 232 /// 47 233 virtual void showErrorMessage (const gchar *title, 48 234 const gchar *body) = 0; 235 236 /// 237 /// @brief Shows a document's page. 238 /// 239 /// The view must show the @a page the the presenter gives to it. 240 /// Of course the view can use scroll bars if the page doesn't fit 241 /// the current view's size, but MUST NOT change the page's size. 242 /// 243 /// The presenter makes sure that the @a page reference is valid 244 /// up until after the next call to this function. 245 /// 246 /// @param page The document's page to show. The presenter will 247 /// free it at the next call to this function or at 248 /// the end of the application. 249 /// 49 250 virtual void showPage (DocumentPage *page) = 0; 251 252 /// 253 /// @brief Gives the number of pages that the document has. 254 /// 255 /// The view should keep a the number of total pages and show it 256 /// to the user. 257 /// 258 /// @param pages The total number of pages the document has. 259 /// 50 260 virtual void setTotalPages (gint pages) = 0; 261 262 /// 263 /// @brief Sets the "Go To Page" text. 264 /// 265 /// The view must keep a text entry (edit control) that has the 266 /// current shown page number. The presenter will update this 267 /// text every time the page changes by calling this function. 268 /// 269 /// @param text The text to set to the "Go To Page" entry. 270 /// 51 271 virtual void setGoToPageText (const gchar *text) = 0; 272 273 /// 274 /// @brief Gets the text at "Go To Page". 275 /// 276 /// Gets the text that is displayed on the "Go To Page" entry. 277 /// This is normally used when the user activated it (pressed 278 /// the Enter key) and the presenter must try to go to the page 279 /// the user entered. 280 /// 281 /// @return The text at "Go To Page". The presenter won't free 282 /// this pointer. 283 /// 52 284 virtual const gchar *getGoToPageText (void) = 0; 285 286 /// 287 /// @brief Gets the size of the document's view. 288 /// 289 /// The view must provide to the presenter the current size 290 /// the part destined to show the page has. 291 /// 292 /// This is used when the user requests "Zoom to Fit" or 293 /// "Zoom to Width", so don't user the current's page size. Give 294 /// the allocated space for viewing the page (for example the 295 /// Scrolled Window's size in a GTK application). 296 /// 297 /// @param width The location to save the page view's width. 298 /// @param height The location to save the page view's height. 53 299 virtual void getPageViewSize (gint *width, gint *height) = 0; 300 301 /// 302 /// @brief Sets the main view's title. 303 /// 304 /// This is called by the presenter when a new document has been 305 /// loaded. Normally it will put the document's file name or the 306 /// document's title (if it has). 307 /// 308 /// The view just has to set the window's title to @a title. 309 /// 310 /// @param title The title to set to the main window. 311 /// 54 312 virtual void setTitle (const gchar *title) = 0; 55 313 56 protected: 314 protected: 315 /// 316 /// @brief Constructs a new main view. 317 /// 318 /// This constructor is keep protected because this class is an 319 /// interface (abstract class) that can't be instantiated. 320 /// 321 /// @param pter The main presenter that will drive the view. 322 /// 57 323 IMainView (MainPter *pter) 58 324 { … … 61 327 } 62 328 329 /// The view's presenter. 63 330 MainPter *m_Pter; 64 331 };
