OpenCPN Partial API docs
Loading...
Searching...
No Matches
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
36enum { ID_MUI_MENU = 21500 };
37
41enum {
42 CO_ANIMATION_LINEAR = 0,
43 CO_ANIMATION_QUADRATIC,
44 CO_ANIMATION_CUBIC,
45 CO_ANIMATION_CUBIC_BOUNCE_IN,
46 CO_ANIMATION_CUBIC_BACK_IN,
47 CO_ANIMATION_CUBIC_REVERSE,
48 CO_PULL,
49 CO_PUSH
50};
51
52class MyFrame;
53class ChartCanvas;
54class MUIButton;
55class MUITextButton;
56class CanvasOptions;
57
63class MUIBar : public wxEvtHandler {
64public:
65 MUIBar();
66 MUIBar(ChartCanvas *parent, int orientation = wxHORIZONTAL,
67 float size_factor = 1.0, wxWindowID id = wxID_ANY,
68 const wxPoint &pos = wxDefaultPosition,
69 const wxSize &size = wxDefaultSize, long style = 0,
70 const wxString &name = wxPanelNameStr);
71
72 ~MUIBar();
73
74 void onCanvasOptionsAnimationTimerEvent(wxTimerEvent &event);
75
76 void SetBestPosition(void);
77 void UpdateDynamicValues();
78 int GetOrientation() { return m_orientation; }
79 void ResetCanvasOptions();
80 void SetFollowButtonState(int state);
81 CanvasOptions *GetCanvasOptions() { return m_canvasOptions; }
82 void SetColorScheme(ColorScheme cs);
83 void SetCanvasENCAvailable(bool avail);
84 void OnScaleSelected(wxMouseEvent &event);
85 void DrawGL(ocpnDC &gldc, double displayScale);
86 void DrawDC(ocpnDC &dc, double displayScale);
87 wxRect GetRect() { return wxRect(m_screenPos, m_size); }
88
89 bool MouseEvent(wxMouseEvent &event);
90 void PushCanvasOptions();
91
92 wxPoint m_screenPos;
93 wxSize m_size;
94
95private:
96 void Init(void);
97 void CreateControls();
98 void PullCanvasOptions();
99 void HandleMenuClick();
100 wxBitmap &CreateBitmap(double displayScale);
101 void InvalidateBitmap();
102 wxColor &GetBackgroundColor() { return m_backcolor; }
103 void CaptureCanvasOptionsBitmap();
104 void CaptureCanvasOptionsBitmapChain(wxTimerEvent &event);
105
106 ChartCanvas *m_parentCanvas;
107 int m_orientation;
108 float m_scaleFactor;
109
110 MUIButton *m_zinButton;
111 MUIButton *m_zoutButton;
112 MUIButton *m_menuButton;
113 MUIButton *m_followButton;
114 MUITextButton *m_scaleButton;
115
116 CanvasOptions *m_canvasOptions;
117 wxPoint m_targetCOPos;
118 wxPoint m_currentCOPos;
119 wxPoint m_startCOPos;
120 int m_COTopOffset;
121
122 wxSize m_canvasOptionsFullSize;
123
124 wxTimer m_canvasOptionsAnimationTimer;
125 int m_animateStep;
126 int m_animateSteps;
127 int m_animationType;
128 int m_animationTotalTime;
129 int m_pushPull;
130
131 wxColor m_backcolor;
132 wxBitmap m_animateBitmap;
133 wxBitmap m_backingBitmap;
134 wxTimer CanvasOptionTimer;
135 int m_coSequence;
136 int m_capture_size_y;
137 wxPoint m_capturePoint;
138 wxPoint m_backingPoint;
139 bool m_coAnimateByBitmaps;
140 ColorScheme m_cs;
141 bool m_CanvasENCAvail;
142 bool m_bEffects;
143
144 uint32_t m_texture;
145 int m_end_margin;
146 wxBitmap m_bitmap;
147 int m_scale;
148};
149
150#endif
Represents the Canvas Options dialog.
Chart display canvas.
Definition chcanv.h:135
Modern User Interface Control Bar for OpenCPN.
Definition MUIBar.h:63
Main application frame.
Definition ocpn_frame.h:136
Device context class that can use either wxDC or OpenGL for drawing.
Definition ocpndc.h:64