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

Go to the SVN repository for this file.

1 #ifndef GUI_WX_DEMO___DOCK_FRAMES__HPP
2 #define GUI_WX_DEMO___DOCK_FRAMES__HPP
3 
4 /* $Id: dock_frames.hpp 43814 2019-09-05 16:11:53Z katargir $
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  * Dock Marker Window and Floating Frame used by Dock Manager.
33  */
34 
35 #include <corelib/ncbistd.hpp>
36 
38 
39 
40 #include <wx/platform.h>
41 #include <wx/frame.h>
42 
43 #if defined( __WXMSW__ ) || defined( __WXMAC__ ) || defined( __WXGTK__ )
44  #include "wx/minifram.h"
45 #endif
46 
48 
49 class CDockManager;
50 class CDockContainer;
51 
52 ///////////////////////////////////////////////////////////////////////////////
53 /// CDockMarkerWindow - top level window with docking markers displayed
54 /// on top of the application window. This window consists of 5 regions
55 /// (4 rectangles and 1 cross-like). Rectangular regions represent marker for
56 /// docking a window into the Root container (left, right, top, bottom).
57 /// The central region contains 5 markers for docking a window inside the
58 /// Target Window (a container inside a Dock Container).
59 
61  : public wxTopLevelWindow
62 {
63  typedef wxTopLevelWindow TParent;
64 public:
65  CDockMarkerWindow(CDockContainer& doc_cont, wxWindow* parent);
67 
68  // Sets the rectangle for the Target Window (in screen coordinates)
69  void SetTargetRect(const wxRect& root_rc, const wxRect& target_rc);
70 
71  void OnPaint(wxPaintEvent& event);
72 
73  /// determines whether a given position is inside one of the 9 markers
74  /// and returns the corresponding dock effect
75  virtual EDockEffect HitTest(const wxPoint& screen_pt);
76 protected:
77  void x_InitBitmaps();
78  bool x_UpdateLayout(const wxRect& root_rc, const wxRect& target_rc);
79  void x_DrawButton(wxDC& dc, const wxRect& btn_rc, int index);
80  void x_SetShape();
81 
83 
84 protected:
86  wxBitmap m_Bitmaps[5];
87  wxColour m_BtnFrameColor;
88  wxColour m_BtnFillColor;
89  bool m_SetShape;
90  wxRegion m_ClipRegion;
91 
92 public:
93  wxRect m_RootRect;
94  wxRect m_TargetRect;
95 
96  // Rectangles for the 9 Markers
97 
98  wxRect m_LeftRect;
99  wxRect m_RightRect;
100  wxRect m_TopRect;
101  wxRect m_BottomRect;
102  wxRect m_CenterRect;
103 
109 };
110 
111 
112 ///////////////////////////////////////////////////////////////////////////////
113 /// CFloatingFrame - a top level floating frame that can host a Dock Container.
114 
115 #if defined( __WXMSW__ )
116  #define CFloatingFrameBaseClass wxFrame
117 #elif defined( __WXMAC__ )
118  #define CFloatingFrameBaseClass wxMiniFrame
119 #elif defined( __WXGTK__ )
120  #define CFloatingFrameBaseClass wxMiniFrame
121 #else
122  #define CFloatingFrameBaseClass wxFrame
123 #endif
124 
125 
127  : public CFloatingFrameBaseClass,
128  public IDockableWindow
129 {
130 public:
131  CFloatingFrame(CDockManager& manager,
132  wxWindow* parent,
133  const wxPoint& pos = wxDefaultPosition,
134  const wxSize& size = wxDefaultSize);
135  virtual ~CFloatingFrame();
136 
137  virtual CDockContainer* GetDockContainer();
138  virtual void SetDockContainer(CDockContainer* dock_cont);
139 
140  virtual bool Destroy();
141 
142 #ifdef __WXMSW__
143  virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
144 #endif
145 
146 protected:
147  virtual void OnMoveStart();
148  virtual void OnMoving();
149 
150  virtual void OnMoveFinished(bool drop);
151 
152  void OnClose(wxCloseEvent& event);
153  void OnMovingEvent(wxMoveEvent& event);
154  void OnIdle(wxIdleEvent& event);
155  void OnActivate(wxActivateEvent& event);
156  void OnMotion(wxMouseEvent& evt);
157  void OnKeyDown(wxKeyEvent& event);
158  void OnKeyUp(wxKeyEvent& event);
159 
160  static bool isMouseDown();
161 
162 private:
165 
166  // mouse shift relative to the frame position at the time of the first wmMoveEvent
168 
169  bool m_solid_drag; // true if system uses solid window drag
170  bool m_moving;
171 
172  wxRect m_last_rect;
173  wxRect m_last2_rect;
174  wxRect m_last3_rect;
175  wxSize m_last_size;
176 #ifdef __WXOSX_COCOA__
177  wxPoint m_move_start_mouse_pos;
178  wxPoint m_prev_mouse_pos;
179  bool m_titlebar_move;
180 #endif
181 
182  DECLARE_EVENT_TABLE()
183  DECLARE_CLASS(CFloatingFrame)
184 };
185 
186 
188 
189 
190 #endif // GUI_WX_DEMO___DOCK_FRAMES__HPP
CDockContainer is a window that hosts docked windows.
CDockManager CDockManager sends requests to Window Manager, Window Manager makes decisions about dele...
CDockMarkerWindow - top level window with docking markers displayed on top of the application window.
Definition: dock_frames.hpp:62
wxColour m_BtnFillColor
Definition: dock_frames.hpp:88
wxRegion m_ClipRegion
Definition: dock_frames.hpp:90
CDockContainer & m_DockContainer
Definition: dock_frames.hpp:85
wxTopLevelWindow TParent
Definition: dock_frames.hpp:63
wxColour m_BtnFrameColor
Definition: dock_frames.hpp:87
CDockManager * m_DockManager
wxPoint m_OrigMouseShift
CDockContainer * m_DockContainer
IDockableWindow - repersents a window that can be docked in Dock Manager.
Definition: dock_window.hpp:53
Include a standard set of the NCBI C++ Toolkit most basic headers.
static uch flags
#define CFloatingFrameBaseClass
CFloatingFrame - a top level floating frame that can host a Dock Container.
EDockEffect
EDockEffect.
Definition: dock_window.hpp:65
#define NULL
Definition: ncbistd.hpp:225
#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
const struct ncbi::grid::netcache::search::fields::SIZE size
Modified on Fri Sep 20 14:57:28 2024 by modify_doxy.py rev. 669887