NCBI C++ ToolKit
min_panel_container.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef GUI_WX_DEMO___MIN_PANEL_CONTAINER__HPP
2 #define GUI_WX_DEMO___MIN_PANEL_CONTAINER__HPP
3 
4 /* $Id: min_panel_container.hpp 22263 2010-10-06 19:00:23Z kuznets $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Andrey Yazhuk
30  *
31  * File Description:
32  *
33  */
34 #include <gui/gui_export.h>
35 
36 #include <corelib/ncbistd.hpp>
37 #include <corelib/ncbiobj.hpp>
38 
39 #include <wx/panel.h>
40 
42 
43 class CDockPanel;
44 class CDockManager;
45 class IWMClient;
46 
47 ///////////////////////////////////////////////////////////////////////////////
48 /// CMinPanelContainer
49 
51  public wxPanel
52 {
54 public:
55  typedef wxPanel TParent;
56 
57 public:
58  CMinPanelContainer(wxWindow* parent, CDockManager& manager);
59  virtual ~CMinPanelContainer();
60 
61  void AddClient(CDockPanel& panel);
62  void RemoveClient(CDockPanel& panel);
63  bool HasClient(CDockPanel& panel) const;
64 
65  virtual bool Layout();
66  virtual wxSize DoGetBestSize() const;
67 
68  void OnPaint(wxPaintEvent& event);
69  void OnSize(wxSizeEvent& event);
70  void OnContextMenu(wxContextMenuEvent& event);
71  void OnLeftClick(wxMouseEvent& event);
72 
73  void OnDockPanelCommand(wxCommandEvent& event);
74  void OnRestoreWindow(wxCommandEvent& event);
75  void OnShowWindowsDlg(wxCommandEvent& event);
76  void OnUpdateWindowCommand(wxUpdateUIEvent& event);
77 
78 protected:
79  struct SItem
80  {
82  wxRect m_Rect;
83  };
84 
85  typedef vector<SItem*> TItems;
86 
87  const SItem* x_FindItemByPanel(CDockPanel* panel) const;
88  SItem* x_FindItemByPos(const wxPoint& pt);
89 
90  wxSize x_MeasureItem(wxDC& dc, const SItem& descr);
91  void x_DrawItem(wxDC& dc, SItem& descr);
92 
93 protected:
95 
97  wxSize m_PrefSize;
98  wxFont m_Font;
99 
100  CDockPanel* m_MenuPanel; /// panel for which context menu is shown
101 
102  /// maps automatically generated cmd ids to Dock Panels
104 };
105 
106 
108 
109 
110 #endif // GUI_WX_DEMO___MIN_PANEL_CONTAINER__HPP
CDockManager CDockManager sends requests to Window Manager, Window Manager makes decisions about dele...
CDockPanel - a container with a title bar (caption) hosting a single client window (IWMClient).
Definition: dock_panel.hpp:73
CMinPanelContainer.
CMinPanelContainer(wxWindow *parent, CDockManager &manager)
CDockManager & m_DockManager
map< int, CDockPanel * > m_CmdToPanel
panel for which context menu is shown
vector< SItem * > TItems
IWClient - abstract Window Manager client.
Definition: wm_client.hpp:50
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUIWIDGETS_WX_EXPORT
Definition: gui_export.h:543
Defines to provide correct exporting from DLLs in Windows.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Modified on Sat Feb 24 07:46:15 2024 by modify_doxy.py rev. 669887