OpenCPN Partial API docs
iENCToolbar.h
1 /****************************************************************************
2  *
3  * Project: OpenCPN
4  * Purpose: OpenCPN iENCToolbar
5  * Author: David Register
6  *
7  ***************************************************************************
8  * Copyright (C) 2017 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 #include "toolbar.h"
27 
28 //----------------------------------------------------------------------------------------------------------
29 // iENCToolbar Specification
30 //----------------------------------------------------------------------------------------------------------
31 
32 #define ID_DENSITY 20000
33 #define ID_RPLUS 20001
34 #define ID_RMINUS 20002
35 
36 #define STATE_TIMER 3689
37 
39 
40 public:
41  iENCToolbar(wxWindow *parent, wxPoint position, long orient,
42  float size_factor);
43  ~iENCToolbar();
44 
45  void LoadToolBitmaps();
46  void OnToolLeftClick(wxCommandEvent &event);
47  void SetDensityToolBitmap(int nDensity);
48  void SetRangeToolBitmap();
49 
50  void StateTimerEvent(wxTimerEvent &event);
51  void SetColorScheme(ColorScheme cs);
52 
53  wxBitmap m_bmMinimum, m_bmStandard, m_bmAll, m_bmUStd, m_bmRPlus, m_bmRMinus;
54  wxBitmap *m_pbmScratch;
55  wxBitmap m_bmTemplate;
56 
57  wxToolBarToolBase *m_toolDensity;
58 
59  int m_nDensity;
60  wxTimer m_state_timer;
61  double m_range;
62  wxFont *m_rangeFont;
63 
64 #if 0
65  void OnClose( wxCloseEvent& event );
66  void OnWindowCreate( wxWindowCreateEvent& event );
67  void OnToolLeftClick( wxCommandEvent& event );
68  void MouseEvent( wxMouseEvent& event );
69  void FadeTimerEvent( wxTimerEvent& event );
70  bool IsToolbarShown() { return ( m_ptoolbar != 0 ); }
71  float GetScaleFactor() { return m_sizefactor; }
72  void SetGrabber( wxString icon_name );
73  void DestroyTimerEvent( wxTimerEvent& event );
74 
75  void Realize();
76  ocpnToolBarSimple *GetToolbar();
77  ocpnToolBarSimple *CreateNewToolbar();
78 
79  void CreateConfigMenu();
80  bool _toolbarConfigMenuUtil( int toolid, wxString tipString );
81 
82  void Submerge();
83  void SubmergeToGrabber();
84  bool isSubmergedToGrabber();
85  void Surface();
86  void SurfaceFromGrabber();
87  void HideTooltip();
88  void ShowTooltips();
89  void EnableTooltips() { if(m_ptoolbar) m_ptoolbar->EnableTooltips(); }
90  void DisableTooltips() { if(m_ptoolbar) m_ptoolbar->DisableTooltips(); }
91  void UpdateRecoveryWindow(bool b_toolbarEnable);
92  void EnableTool( int toolid, bool enable );
93  void SetToolShortHelp( int toolid, const wxString& helpString );
94 
95  void DestroyToolBar();
96  void ToggleOrientation();
97  void MoveDialogInScreenCoords( wxPoint posn, wxPoint posn_old );
98  void RePosition();
99  void LockPosition(bool lock){ m_block = lock; }
100  void SetColorScheme( ColorScheme cs );
101  ColorScheme GetColorScheme(){ return m_cs; }
102  bool CheckSurfaceRequest( wxMouseEvent &event );
103 
104  void SetGeometry(bool bAvoid, wxRect rectAvoid);
105  long GetOrient() {
106  return m_orient;
107  }
108  void RefreshFadeTimer();
109  void SetAutoHideTimer(int time);
110  void SetAutoHide( bool hide ){ m_bAutoHideToolbar = hide; }
111 
112  int GetDockX() {
113  return m_dock_x;
114  }
115  int GetDockY() {
116  return m_dock_y;
117  }
118  bool toolbarConfigChanged;
119  GrabberWin *m_pRecoverwin;
120  bool m_bnavgrabber;
121 
122  wxMenu *m_FloatingToolbarConfigMenu;
123 #endif
124 private:
125 #if 0
126  void DoFade( int value );
127 
128  bool m_bsubmerged;
129  bool m_bsubmergedToGrabber;
130 
131  wxWindow *m_pparent;
132  ocpnToolBarSimple *m_ptoolbar;
133  wxBoxSizer *m_topSizer;
134 
135  GrabberWin *m_pGrabberwin;
136 
137  long m_orient;
138  wxTimer m_fade_timer;
139  int m_opacity;
140  ColorScheme m_cs;
141 
142  wxPoint m_position;
143  int m_dock_x;
144  int m_dock_y;
145  ocpnStyle::Style* m_style;
146  bool m_block;
147 
148  bool m_marginsInvisible;
149  float m_sizefactor;
150  wxTimer m_destroyTimer;
151  GrabberWin *m_destroyGrabber;
152  wxSize m_recoversize;
153 
154  bool m_bAutoHideToolbar;
155  int m_nAutoHideToolbar;
156 #endif
157 };