NCBI C++ ToolKit
tooltip_wnd.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: tooltip_wnd.cpp 43716 2019-08-21 16:14:49Z katargir $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors:
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 
32 ////@begin includes
33 ////@end includes
34 
35 #include <wx/panel.h>
36 #include <wx/sizer.h>
37 #include <wx/stattext.h>
38 #include <wx/statbox.h>
39 #include <wx/bitmap.h>
40 #include <wx/icon.h>
41 
44 
46 
47 /*!
48  * CTooltipWnd type definition
49  */
50 
51 IMPLEMENT_DYNAMIC_CLASS( CTooltipWnd, wxFrame )
52 
53 
54 /*!
55  * CTooltipWnd event table definition
56  */
57 
58 BEGIN_EVENT_TABLE( CTooltipWnd, wxFrame )
59 #ifndef __WXOSX_COCOA__
60  EVT_MOUSE_EVENTS( CTooltipWnd::OnMouse )
61 #endif
63 
64 
65 /*!
66  * CTooltipWnd constructors
67  */
68 
69  CTooltipWnd::CTooltipWnd() : m_Tooltip()
70 {
71  Init();
72 }
73 
74 CTooltipWnd::CTooltipWnd(CTooltip* tooltip) : m_Tooltip(tooltip)
75 {
76  Init();
77 }
78 
79 /*!
80  * CTooltipWnd creator
81  */
82 
83 bool CTooltipWnd::Create(wxWindow* parent,
84  wxWindowID id,
85  const wxString& title,
86  const wxPoint& pos,
87  const wxSize& size,
88  long style)
89 {
90  wxFrame::Create( parent, id, title, pos, size, style );
91 
92  this->SetBackgroundColour(wxColour(255, 0, 0));
94  if (GetSizer())
95  {
96  GetSizer()->SetSizeHints(this);
97  }
98  Fit();
99  return true;
100 }
101 
102 
103 /*!
104  * CTooltipWnd destructor
105  */
106 
108 {
109 ////@begin CTooltipWnd destruction
110 ////@end CTooltipWnd destruction
111 }
112 
113 
114 /*!
115  * Member initialisation
116  */
117 
119 {
120 ////@begin CTooltipWnd member initialisation
122 ////@end CTooltipWnd member initialisation
123 }
124 
125 
126 /*!
127  * Control creation for CTooltipWnd
128  */
129 
131 {
132 ////@begin CTooltipWnd content construction
133  CTooltipWnd* itemWin1 = this;
134 
135  this->SetBackgroundColour(wxColour(255, 255, 225));
136  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
137  itemWin1->SetSizer(itemBoxSizer2);
138 
139  wxPanel* itemPanel3 = new wxPanel( itemWin1, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
140  itemPanel3->SetBackgroundColour(wxColour(255, 255, 225));
141  itemBoxSizer2->Add(itemPanel3, 1, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
142 
143  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
144  itemPanel3->SetSizer(itemBoxSizer4);
145 
146  m_TooltipCtrl = new wxStaticText( itemPanel3, wxID_STATIC, m_TooltipText, wxDefaultPosition, wxDefaultSize, 0 );
147  itemBoxSizer4->Add(m_TooltipCtrl, 1, wxGROW|wxALL, 5);
148 
149 ////@end CTooltipWnd content construction
150 }
151 
152 
153 /*!
154  * Should we show tooltips?
155  */
156 
158 {
159  return true;
160 }
161 
162 /*!
163  * Get bitmap resources
164  */
165 
166 wxBitmap CTooltipWnd::GetBitmapResource( const wxString& name )
167 {
168  // Bitmap retrieval
169 ////@begin CTooltipWnd bitmap retrieval
170  wxUnusedVar(name);
171  return wxNullBitmap;
172 ////@end CTooltipWnd bitmap retrieval
173 }
174 
175 /*!
176  * Get icon resources
177  */
178 
179 wxIcon CTooltipWnd::GetIconResource( const wxString& name )
180 {
181  // Icon retrieval
182 ////@begin CTooltipWnd icon retrieval
183  wxUnusedVar(name);
184  return wxNullIcon;
185 ////@end CTooltipWnd icon retrieval
186 }
187 
188 
189 /*!
190  * All mouse events event handler for ID_CTOOLTIPWND
191  */
192 
193 void CTooltipWnd::OnMouse( wxMouseEvent& event )
194 {
195  if (m_Tooltip) {
196  m_Tooltip->Hide();
197  m_Tooltip = 0;
198  }
199 }
200 
wxStaticText * m_TooltipCtrl
void Init()
Initialises member variables.
void CreateControls()
Creates the controls and sizers.
~CTooltipWnd()
Destructor.
CTooltip * m_Tooltip
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void OnMouse(wxMouseEvent &event)
All mouse events event handler for ID_CTOOLTIPWND.
bool Create(wxWindow *parent, wxWindowID id=ID_CTOOLTIPWND, const wxString &title=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(0, 0), long style=wxFRAME_TOOL_WINDOW|wxFRAME_FLOAT_ON_PARENT|wxFRAME_NO_TASKBAR)
Creation.
Definition: tooltip_wnd.cpp:83
wxString m_TooltipText
CTooltipWnd()
Constructors.
Definition: tooltip_wnd.cpp:69
static bool ShowToolTips()
Should we show tooltips?
static void Init(void)
Definition: cursor6.c:76
#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
END_EVENT_TABLE()
const struct ncbi::grid::netcache::search::fields::SIZE size
Modified on Fri Jul 12 16:19:07 2024 by modify_doxy.py rev. 669887