25 #include <wx/wxprec.h>
27 #include <wx/dcclient.h>
29 #include "model/config_vars.h"
30 #include "ChInfoWin.h"
31 #include "OCPNPlatform.h"
33 #include "color_handler.h"
35 #ifdef __OCPN__ANDROID__
36 #include "androidUTIL.h"
42 EVT_PAINT(ChInfoWin::OnPaint)
43 EVT_ERASE_BACKGROUND(ChInfoWin::OnEraseBackground)
44 EVT_MOUSE_EVENTS(ChInfoWin::MouseEvent)
49 long style = wxSIMPLE_BORDER | wxCLIP_CHILDREN | wxFRAME_FLOAT_ON_PARENT;
51 wxPanel::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style);
53 wxFont* dFont = FontMgr::Get().GetFont(_(
"Dialog"));
56 int ststyle = wxALIGN_LEFT | wxST_NO_AUTORESIZE;
57 m_pInfoTextCtl =
new wxStaticText(
this, -1, _T (
"" ),
59 wxDefaultSize, ststyle);
65 ChInfoWin::~ChInfoWin() {
delete m_pInfoTextCtl; }
67 void ChInfoWin::OnEraseBackground(wxEraseEvent& event) {}
69 void ChInfoWin::MouseEvent(wxMouseEvent& event) {
71 if (event.LeftDown()) {
74 #ifdef __OCPN__ANDROID__
75 androidForceFullRepaint();
81 void ChInfoWin::OnPaint(wxPaintEvent& event) {
83 GetClientSize(&width, &height);
86 dc.SetBrush(wxBrush(GetGlobalColor(_T (
"UIBCK" ))));
87 dc.SetPen(wxPen(GetGlobalColor(_T (
"UITX1" ))));
88 dc.DrawRectangle(0, 0, width, height);
91 void ChInfoWin::SetBitmap() {
92 SetBackgroundColour(GetGlobalColor(_T (
"UIBCK" )));
94 m_pInfoTextCtl->SetBackgroundColour(GetGlobalColor(_T (
"UIBCK" )));
95 m_pInfoTextCtl->SetForegroundColour(GetGlobalColor(_T (
"UITX1" )));
97 m_pInfoTextCtl->SetSize(GetCharWidth(), 1, m_size.x - 2 * GetCharWidth(), m_size.y - 2);
98 m_pInfoTextCtl->SetLabel(m_string);
100 wxPoint top_position =
102 SetSize(top_position.x, top_position.y, m_size.x, m_size.y);
103 SetClientSize(m_size.x, m_size.y);
106 void ChInfoWin::FitToChars(
int char_width,
int char_height) {
115 #ifdef __OCPN__ANDROID__
119 size.x = GetCharWidth() * char_width;
120 size.y = GetCharHeight() * (char_height + adjust);
121 size.x = wxMin(size.x, g_Platform->getDisplaySize().x - 10);