UTWindow.h

Go to the documentation of this file.
00001 //==================================================================================================
00002 // Copyright (C) 2010  Brian Tietz    sdbtietz at yahoo dot com
00003 //
00004 // This program is free software; you can redistribute it and/or modify it under the terms of the
00005 // GNU General Public License as published by the Free Software Foundation, version 2.0 of the
00006 // License.
00007 //
00008 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
00009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00010 // General Public License for more details.
00011 //
00012 // You should have received a copy of the GNU General Public License along with this program; if
00013 // not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00014 // 02110-1301, USA.
00015 //
00016 // For commercial software, the copyright holder (Brian Tietz, email sdbtietz at yahoo dot com)
00017 // reserves the right and is willing to waive the proprietary source code disclosure aspects of that
00018 // license as applied to the UT library in exchange for either substantial contributions to the
00019 // development of the UT library or other forms of compensation.  Any such waiver must be
00020 // established in writing between the copyright holder and the commercial entity obtaining such a
00021 // waiver.
00022 //==================================================================================================
00023 
00024 
00025 #ifndef _UT_WINDOW_H_
00026 #define _UT_WINDOW_H_
00027 
00030 
00031 
00032 //==================================================================================================
00033 //=== Project headers
00034 //==================================================================================================
00035 #include "UTgui.h"
00036 #include "UTString.h"
00037 #include "UTGeometry.h"
00038 #include "UTTask.h"
00039 
00040 
00041 //==================================================================================================
00042 //=== Constants
00043 //==================================================================================================
00044 enum window_show_mode_t
00045 {
00046     eWINSHOWMODE_normal,
00047     eWINSHOWMODE_minimized,
00048     eWINSHOWMODE_maximized
00049 };
00050 
00051 
00052 //==================================================================================================
00053 //=== Forward name declarations
00054 //==================================================================================================
00055 class WindowController_t;
00056 class Resource_t;
00057 class WindowPlatformInfo_t;
00058 class Menu_t;
00059 class View_t;
00060 
00061 
00062 //==================================================================================================
00063 class UTGUI_EXPORT Window_t
00064 //==================================================================================================
00114 : private LinkedListNode_t<Window_t>    // for App_t::m_windows
00115 {
00116     //----------------------------------------------------------------------------------------------
00117     public:
00118     //----------------------------------------------------------------------------------------------
00119                                 Window_t(   WindowController_t* controller,
00120                                             const String_t& title,
00121                                             const Rect_t& normal_mode_content_area_pframe,
00122                                             Window_t* subordinate_to );
00162 
00163     virtual                     ~Window_t();
00169 
00170     inline WindowController_t*  Controller() const;
00172 
00173     virtual void                Show(window_show_mode_t mode = eWINSHOWMODE_normal);
00177 
00178     void                        Activate();
00181 
00182     void                        SetTitle(const String_t& title);
00184 
00185     inline const String_t&      Title() const;
00187 
00188     inline window_show_mode_t   Mode() const;
00192 
00193     void                        SetMenu(takes Menu_t* menu);
00197 
00198     inline Menu_t*              Menu() const;
00200 
00201     void                        SetRootView(takes View_t* root_view);
00217 
00218     gives View_t*               RemoveRootView();
00222 
00223     inline View_t*              RootView();
00225 
00226     virtual void                RootViewCannotFitOnscreen();
00234 
00235     inline const Rect_t&        NormalModeContentAreaPFrame() const;
00247 
00248     inline const Rect_t&        CurrentContentAreaLBounds() const;
00256 
00257     //----------------------------------------------------------------------------------------------
00258     private:
00259     //----------------------------------------------------------------------------------------------
00260     static void                 VisibilityAudit( Rect_t* proposed_frame, const Rect_t& max_frame );
00261     void                        CreateOrRecreate();
00262     void                        RootViewMinMaxSizeChanged();
00263 
00264     //----------------------------------------------------------------------------------------------
00265     private:
00266     //----------------------------------------------------------------------------------------------
00267     static int                                          ms_next_token;
00268 
00269     int                                                 m_token;
00270     WindowController_t*                                 m_controller;
00271     WindowPlatformInfo_t*                               m_platform_info;
00272     String_t                                            m_title;
00273     window_show_mode_t                                  m_mode;
00274     Rect_t                                              m_normal_mode_content_area_pframe;
00275     Rect_t                                              m_current_content_area_lbounds;
00276     Window_t*                                           m_subordinate_to;
00277     List_t<Window_t>                                    m_subordinate_windows;
00278     Menu_t*                                             m_menu;
00279     View_t*                                             m_root_view_app_perspective;
00280     View_t*                                             m_root_view_or_viewport;
00281     bool                                                m_creating;
00282     bool                                                m_show_in_windows_list;
00283     bool                                                m_waiting_for_deferred_close;
00284 
00285     friend class WindowPlatformInfo_t;
00286     friend class WindowController_t;
00287     friend class App_t;
00288     friend class AppPlatformInfo_t;
00289     friend class LinkedList_t<Window_t>;
00290     friend class LinkedListNode_t<Window_t>;
00291     friend class WindowsMenuTask_t;
00292     friend class WindowListEntry_t;
00293     friend class View_t;
00294     friend class ViewPlatformInfo_t;
00295     friend class MouseCaptureManager_t;
00296     friend class ButtonPlatformInfo_t;
00297 };
00298 
00299 
00300 //==================================================================================================
00301 class UTGUI_EXPORT WindowController_t
00302 //==================================================================================================
00303 : public Task_t
00311 {
00312     //----------------------------------------------------------------------------------------------
00313     public:
00314     //----------------------------------------------------------------------------------------------
00315                             WindowController_t();
00317 
00318     virtual                 ~WindowController_t();
00320 
00321     virtual quit_response_t WindowCloseRequested( Window_t* window, bool app_quit_requested ) = 0;
00326 
00327     void                    DeferredCloseDenied(Window_t* window_which_was_not_closed);
00332 
00333     //----------------------------------------------------------------------------------------------
00334     private:
00335     //----------------------------------------------------------------------------------------------
00336     quit_response_t         WindowCloseRequestedInternal(Window_t* window);
00337 
00338     friend class WindowPlatformInfo_t;
00339     friend class App_t;
00340 };
00341 
00342 
00343 
00344 
00345 //==================================================================================================
00346 //==================================================================================================
00347 //===
00348 //=== Inline function implementations: class Window_t
00349 //===
00350 //==================================================================================================
00351 //==================================================================================================
00352 inline WindowController_t*
00353 Window_t::Controller() const
00354 {
00355     return m_controller;
00356 }
00357 
00358 
00359 inline const String_t&
00360 Window_t::Title() const
00361 {
00362     return m_title;
00363 }
00364 
00365 
00366 inline window_show_mode_t
00367 Window_t::Mode() const
00368 {
00369     return m_mode;
00370 }
00371 
00372 
00373 inline Menu_t*
00374 Window_t::Menu() const
00375 {
00376     return m_menu;
00377 }
00378 
00379 
00380 inline View_t*
00381 Window_t::RootView()
00382 {
00383     return m_root_view_app_perspective;
00384 }
00385 
00386 
00387 inline const Rect_t&
00388 Window_t::NormalModeContentAreaPFrame() const
00389 {
00390     return m_normal_mode_content_area_pframe;
00391 }
00392 
00393 
00394 inline const Rect_t&
00395 Window_t::CurrentContentAreaLBounds() const
00396 {
00397     return m_current_content_area_lbounds;
00398 }
00399 
00400 
00401 #endif // _UT_WINDOW_H_

Generated on Tue Dec 14 22:35:05 2010 for UT library by  doxygen 1.6.1