OpenCPN Partial API docs
RolloverWin.h
1 /***************************************************************************
2  *
3  * Project: OpenCPN
4  *
5  ***************************************************************************
6  * Copyright (C) 2013 by David S. Register *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22  **************************************************************************/
23 
24 #ifndef __ROLLOVERWIN_H__
25 #define __ROLLOVERWIN_H__
26 
27 #include <wx/window.h>
28 #include <wx/timer.h>
29 #include "model/ocpn_types.h"
30 #include "color_types.h"
31 
32 class ocpnDC;
33 
34 // constants for rollovers fonts
35 enum { AIS_ROLLOVER = 1, LEG_ROLLOVER = 2, TC_ROLLOVER = 3 };
36 
37 class RolloverWin : public wxWindow {
38 public:
39  RolloverWin(wxWindow *parent, int timeout = -1, bool maincanvas = true);
40  ~RolloverWin();
41 
42  void OnPaint(wxPaintEvent &event);
43  void Draw(ocpnDC &dc);
44 
45  void SetColorScheme(ColorScheme cs);
46  void SetString(const wxString &s) { m_string = s; }
47  void SetPosition(wxPoint pt) { m_position = pt; }
48  void SetBitmap(int rollover);
49  wxBitmap *GetBitmap() { return m_pbm; }
50  void SetBestPosition(int x, int y, int off_x, int off_y, int rollover,
51  wxSize parent_size);
52  void OnTimer(wxTimerEvent &event);
53  void OnMouseEvent(wxMouseEvent &event);
54  void SetMousePropogation(int level) { m_mmouse_propogate = level; }
55  bool IsActive() { return isActive; }
56  void IsActive(bool state) { isActive = state; }
57 
58 private:
59  wxString m_string;
60  wxSize m_size;
61  wxPoint m_position;
62  wxBitmap *m_pbm;
63  wxTimer m_timer_timeout;
64  int m_timeout_sec;
65  int m_mmouse_propogate;
66  unsigned int m_texture;
67  bool isActive;
68  wxFont *m_plabelFont;
69  bool m_bmaincanvas;
70 
71  DECLARE_EVENT_TABLE()
72 };
73 
74 #endif
Definition: ocpndc.h:58