OpenCPN Partial API docs
MUIBar.h
1 /******************************************************************************
2  *
3  * Project: OpenCPN
4  * Purpose: MUI Control Bar
5  * Author: David Register
6  *
7  ***************************************************************************
8  * Copyright (C) 2018 by David S. Register *
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  * This program is distributed in the hope that it will be useful, *
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18  * GNU General Public License for more details. *
19  * *
20  * You should have received a copy of the GNU General Public License *
21  * along with this program; if not, write to the *
22  * Free Software Foundation, Inc., *
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
24  ***************************************************************************
25  */
26 
27 #ifndef __muibar_H__
28 #define __muibar_H__
29 
30 #include <cstdint>
31 
32 //----------------------------------------------------------------------------
33 // constants
34 //----------------------------------------------------------------------------
35 
36 enum { ID_MUI_MENU = 21500 };
37 
38 enum {
39  CO_ANIMATION_LINEAR = 0,
40  CO_ANIMATION_QUADRATIC,
41  CO_ANIMATION_CUBIC,
42  CO_ANIMATION_CUBIC_BOUNCE_IN,
43  CO_ANIMATION_CUBIC_BACK_IN,
44  CO_ANIMATION_CUBIC_REVERSE,
45  CO_PULL,
46  CO_PUSH
47 };
48 
49 class MyFrame;
50 class ChartCanvas;
51 class MUIButton;
52 class MUITextButton;
53 class CanvasOptions;
54 
55 //----------------------------------------------------------------------------
56 // MUIBar
57 //----------------------------------------------------------------------------
58 class MUIBar : public wxEvtHandler {
59 public:
60  MUIBar();
61  MUIBar(ChartCanvas *parent, int orientation = wxHORIZONTAL,
62  float size_factor = 1.0, wxWindowID id = wxID_ANY,
63  const wxPoint &pos = wxDefaultPosition,
64  const wxSize &size = wxDefaultSize, long style = 0,
65  const wxString &name = wxPanelNameStr);
66 
67  ~MUIBar();
68 
69  void onCanvasOptionsAnimationTimerEvent(wxTimerEvent &event);
70 
71  void SetBestPosition(void);
72  void UpdateDynamicValues();
73  int GetOrientation() { return m_orientation; }
74  void ResetCanvasOptions();
75  void SetFollowButtonState(int state);
76  CanvasOptions *GetCanvasOptions() { return m_canvasOptions; }
77  void SetColorScheme(ColorScheme cs);
78  void SetCanvasENCAvailable(bool avail);
79  void OnScaleSelected(wxMouseEvent &event);
80  void DrawGL(ocpnDC &gldc, double displayScale);
81  void DrawDC(ocpnDC &dc, double displayScale);
82  wxRect GetRect(){ return wxRect(m_screenPos, m_size); }
83 
84  bool MouseEvent(wxMouseEvent &event);
85  void PushCanvasOptions();
86 
87  wxPoint m_screenPos;
88  wxSize m_size;
89 
90 private:
91  void Init(void);
92  void CreateControls();
93  void PullCanvasOptions();
94  void HandleMenuClick();
95  wxBitmap &CreateBitmap(double displayScale);
96  void InvalidateBitmap();
97  wxColor &GetBackgroundColor() { return m_backcolor; }
98  void CaptureCanvasOptionsBitmap();
99  void CaptureCanvasOptionsBitmapChain(wxTimerEvent &event);
100 
101  ChartCanvas *m_parentCanvas;
102  int m_orientation;
103  float m_scaleFactor;
104 
105  MUIButton *m_zinButton;
106  MUIButton *m_zoutButton;
107  MUIButton *m_menuButton;
108  MUIButton *m_followButton;
109  MUITextButton *m_scaleButton;
110 
111  CanvasOptions *m_canvasOptions;
112  wxPoint m_targetCOPos;
113  wxPoint m_currentCOPos;
114  wxPoint m_startCOPos;
115  int m_COTopOffset;
116 
117  wxSize m_canvasOptionsFullSize;
118 
119  wxTimer m_canvasOptionsAnimationTimer;
120  int m_animateStep;
121  int m_animateSteps;
122  int m_animationType;
123  int m_animationTotalTime;
124  int m_pushPull;
125 
126  wxColor m_backcolor;
127  wxBitmap m_animateBitmap;
128  wxBitmap m_backingBitmap;
129  wxTimer CanvasOptionTimer;
130  int m_coSequence;
131  int m_capture_size_y;
132  wxPoint m_capturePoint;
133  wxPoint m_backingPoint;
134  bool m_coAnimateByBitmaps;
135  ColorScheme m_cs;
136  bool m_CanvasENCAvail;
137  bool m_bEffects;
138 
139  uint32_t m_texture;
140  int m_end_margin;
141  wxBitmap m_bitmap;
142  int m_scale;
143 };
144 
145 #endif
Definition: MUIBar.h:58
Definition: ocpndc.h:58