UTApp.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _UT_APP_H_
00026 #define _UT_APP_H_
00027
00030
00031
00032
00033
00034
00035 #include "UTgui.h"
00036 #include "UTMessageLoop.h"
00037 #include "UTResource.h"
00038 #include "UTMenuChangedTask.h"
00039 #include "UTWindowsMenuTask.h"
00040
00041
00042
00043
00044
00045 class InitializeMessage_t;
00046 class AppPlatformInfo_t;
00047
00048
00049
00050 class UTGUI_EXPORT App_t
00051
00070 : public MessageLoop_t
00071 {
00072
00073 public:
00074
00075 App_t(int app_name_string_resource_id);
00083
00084 virtual ~App_t();
00086
00087 virtual void Start(int32 stack_size = 0);
00092
00093 virtual void SetTimeout(int32 timeout_ms);
00096
00097 void MessageMightHaveTakenALongTime();
00110
00111 static inline App_t* App();
00113
00114 static inline Resource_t* AppResources();
00116
00117 static void GetAppName(out String_t* name);
00121
00122 void SetMDIMode( bool enable_mdi,
00123 window_show_mode_t mode = eWINSHOWMODE_maximized,
00124 const Rect_t& normal_mode_mdi_frame =
00125 Rect_t( 0, 0, 0, 0) );
00134
00135 bool MDIMode();
00138
00139 Rect_t NormalModeMDIFrame();
00144
00145 window_show_mode_t MDIWindowMode();
00149
00150 void SetAppMenu(takes Menu_t* menu);
00154
00155 inline Menu_t* AppMenu();
00157
00158 MessageDestination_t<Message_t>
00159 QuitRequestReceiver();
00162
00163 virtual void QuitRequested();
00180
00181 virtual void CloseAllWindowsRequested(bool app_quit_requested);
00187
00188 inline bool RunningInMain();
00191
00192 virtual bool IsQuitInProgress();
00200
00201 virtual void CancelQuit();
00204
00205
00206 protected:
00207
00208 virtual void Main();
00213
00214 virtual void SetMessageAvailEvent();
00216
00217
00218 private:
00219
00220 void MenuChanged();
00221 void HandleMenuChanged();
00222 inline void UpdateWindowsMenu();
00223 void WindowBecameFocus( Window_t* new_focus, bool newly_shown );
00224 void ContinueQuitOrCloseAllWindowsAsync();
00225 void ContinueQuitOrCloseAllWindows();
00226
00227
00228 private:
00229
00230 Resource_t m_resource;
00231 int m_app_name_string_resource_id;
00232 bool m_running_in_main;
00233 Menu_t* m_app_menu;
00234 bool m_menu_change_pending;
00235 MenuChangedTask_t m_menu_changed_task;
00236 WindowsMenuTask_t m_window_menu_task;
00237 LinkedList_t<Window_t> m_windows;
00238 bool m_close_all_windows_in_progress;
00239 bool m_close_all_windows_for_quit;
00240
00241 static App_t* ms_app;
00242 static AppPlatformInfo_t* ms_platform_info;
00243
00244 friend class AppPlatformInfo_t;
00245 friend class WndProcBase_t;
00246 friend class Window_t;
00247 friend class WindowController_t;
00248 friend class WindowPlatformInfo_t;
00249 friend class Menu_t;
00250 friend class MenuItem_t;
00251 friend class MenuChangedTask_t;
00252 friend class WindowsMenuTask_t;
00253 friend class ViewPlatformInfo_t;
00254 friend class MouseCaptureManager_t;
00255 };
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267 inline App_t*
00268 App_t::App()
00269 {
00270 return ms_app;
00271 }
00272
00273
00274 inline Resource_t*
00275 App_t::AppResources()
00276 {
00277 return &ms_app->m_resource;
00278 }
00279
00280
00281 inline Menu_t*
00282 App_t::AppMenu()
00283 {
00284 return m_app_menu;
00285 }
00286
00287
00288 inline bool
00289 App_t::RunningInMain()
00290 {
00291 return m_running_in_main;
00292 }
00293
00294
00295 inline void
00296 App_t::UpdateWindowsMenu()
00297 {
00298 m_window_menu_task.UpdateWindowsMenu();
00299 }
00300
00301
00302 #endif // _UT_APP_H_