30 #include <wx/bitmap.h>
31 #include <wx/colour.h>
32 #include <wx/dynarray.h>
33 #include <wx/gdicmn.h>
34 #include <wx/string.h>
36 #include "model/ocpn_types.h"
38 #include "color_types.h"
40 enum StyleToolIconTypes {
47 void bmdump(wxBitmap bm, wxString name);
48 wxBitmap MergeBitmaps(wxBitmap back, wxBitmap front, wxSize offset);
49 wxBitmap ConvertTo24Bit(wxColor bgColor, wxBitmap front);
53 WX_DECLARE_STRING_HASH_MAP(
int, intHash);
64 wxBitmap rolloverToggled;
70 bool rolloverToggledLoaded;
78 rolloverLoaded =
false;
79 rolloverToggledLoaded =
false;
80 disabledLoaded =
false;
82 toggledLoaded =
false;
83 customSize = wxSize(32, 32);
86 Tool(
void) { Unload(); }
97 void Unload(
void) { loaded =
false; }
99 Icon(
void) { Unload(); }
107 wxBitmap GetNormalBG();
108 wxBitmap GetActiveBG();
109 wxBitmap GetToggledBG();
110 wxBitmap GetToolbarStart();
111 wxBitmap GetToolbarEnd();
112 bool HasBackground()
const {
return hasBackground; }
113 void HasBackground(
bool b) { hasBackground = b; }
114 wxBitmap GetIcon(
const wxString& name,
int width = -1,
int height = -1,
115 bool bforceReload =
false);
116 wxBitmap GetIconScaled(
const wxString& name,
double scaleFactor,
117 bool bforceReload =
false );
119 wxBitmap GetToolIcon(
const wxString& toolname,
int iconType = TOOLICON_NORMAL,
120 bool rollover =
false,
int width = -1,
int height = -1);
121 wxBitmap BuildPluginIcon(wxBitmap& bm,
int iconType,
double scale = 1.0);
122 bool NativeToolIconExists(
const wxString& name);
124 int GetTopMargin()
const {
return toolMarginTop[currentOrientation]; }
125 int GetRightMargin()
const {
return toolMarginRight[currentOrientation]; }
126 int GetBottomMargin()
const {
return toolMarginBottom[currentOrientation]; }
127 int GetLeftMargin()
const {
return toolMarginLeft[currentOrientation]; }
128 int GetToolbarCornerRadius();
130 int GetCompassTopMargin()
const {
return compassMarginTop; }
131 int GetCompassRightMargin()
const {
return compassMarginRight; }
132 int GetCompassBottomMargin()
const {
return compassMarginBottom; }
133 int GetCompassLeftMargin()
const {
return compassMarginLeft; }
134 int GetCompassCornerRadius()
const {
return compasscornerRadius; }
135 int GetCompassXOffset()
const {
return compassXoffset; }
136 int GetCompassYOffset()
const {
return compassYoffset; }
138 int GetToolSeparation()
const {
return toolSeparation[currentOrientation]; }
139 wxSize GetToolSize()
const {
return toolSize[currentOrientation]; }
140 wxSize GetToggledToolSize()
const {
141 return toggledBGSize[currentOrientation];
144 bool HasToolbarStart()
const {
145 return toolbarStartLoc[currentOrientation] != wxPoint(0, 0);
147 bool HasToolbarEnd()
const {
148 return toolbarEndLoc[currentOrientation] != wxPoint(0, 0);
150 void DrawToolbarLineStart(wxBitmap& bmp,
double scale = 1.0);
151 void DrawToolbarLineEnd(wxBitmap& bmp,
double scale = 1.0);
153 static wxBitmap SetBitmapBrightness(wxBitmap& bitmap, ColorScheme cs);
154 static wxBitmap SetBitmapBrightnessAbs(wxBitmap& bitmap,
double level);
156 void SetOrientation(
long orient);
157 int GetOrientation();
158 void SetColorScheme(ColorScheme cs);
163 wxString description;
164 wxString graphicsFile;
165 int toolMarginTop[2];
166 int toolMarginRight[2];
167 int toolMarginBottom[2];
168 int toolMarginLeft[2];
169 int toolSeparation[2];
171 int compassMarginTop;
172 int compassMarginRight;
173 int compassMarginBottom;
174 int compassMarginLeft;
175 int compasscornerRadius;
180 wxSize toggledBGSize[2];
181 wxPoint toggledBGlocation[2];
182 wxPoint activeBGlocation[2];
183 wxPoint normalBGlocation[2];
184 wxSize verticalIconOffset;
185 wxArrayPtrVoid tools;
187 wxArrayPtrVoid icons;
191 wxColor consoleFontColor;
192 wxPoint consoleTextBackgroundLoc;
193 wxSize consoleTextBackgroundSize;
194 wxPoint toolbarStartLoc[2];
195 wxSize toolbarStartSize[2];
196 wxPoint toolbarEndLoc[2];
197 wxSize toolbarEndSize[2];
198 wxBitmap consoleTextBackground;
199 wxBitmap toolbarStart[2];
200 wxBitmap toolbarEnd[2];
202 bool marginsInvisible;
204 int chartStatusIconWidth;
205 bool chartStatusWindowTransparent;
210 wxString myConfigFileDir;
213 int currentOrientation;
214 ColorScheme colorscheme;
224 bool IsOK()
const {
return isOK; }
225 void Init(
const wxString& fromPath);
226 void SetStyle(wxString name);
227 void SetStyleNextInvocation(
const wxString& name) {
228 nextInvocationStyle = name;
230 const wxString& GetStyleNextInvocation()
const {
return nextInvocationStyle; }
231 Style* GetCurrentStyle();
232 wxArrayPtrVoid GetArrayOfStyles() {
return styles; };
236 wxArrayPtrVoid styles;
238 wxString nextInvocationStyle;