27#include <wx/dcclient.h>
30#include "OCPNPlatform.h"
32#include "color_handler.h"
34#ifdef __OCPN__ANDROID__
35#include "androidUTIL.h"
42EVT_PAINT(ChInfoWin::OnPaint)
43EVT_ERASE_BACKGROUND(ChInfoWin::OnEraseBackground)
44EVT_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 (
"" ), wxDefaultPosition,
58 wxDefaultSize, ststyle);
64ChInfoWin::~ChInfoWin() {
delete m_pInfoTextCtl; }
66void ChInfoWin::OnEraseBackground(wxEraseEvent& event) {}
68void ChInfoWin::MouseEvent(wxMouseEvent& event) {
70 if (event.LeftDown()) {
73#ifdef __OCPN__ANDROID__
74 androidForceFullRepaint();
80void ChInfoWin::OnPaint(wxPaintEvent& event) {
82 GetClientSize(&width, &height);
85 dc.SetBrush(wxBrush(GetGlobalColor(_T (
"UIBCK" ))));
86 dc.SetPen(wxPen(GetGlobalColor(_T (
"UITX1" ))));
87 dc.DrawRectangle(0, 0, width, height);
90void ChInfoWin::SetBitmap() {
91 SetBackgroundColour(GetGlobalColor(_T (
"UIBCK" )));
93 m_pInfoTextCtl->SetBackgroundColour(GetGlobalColor(_T (
"UIBCK" )));
94 m_pInfoTextCtl->SetForegroundColour(GetGlobalColor(_T (
"UITX1" )));
96 m_pInfoTextCtl->SetSize(1, 1, m_size.x - 2, m_size.y - 2);
97 m_pInfoTextCtl->SetLabel(m_string);
99 wxPoint top_position =
101 SetSize(top_position.x, top_position.y, m_size.x, m_size.y);
102 SetClientSize(m_size.x, m_size.y);
105void ChInfoWin::FitToChars(
int char_width,
int char_height) {
114#ifdef __OCPN__ANDROID__
118 size.x = GetCharWidth() * char_width;
119 size.y = GetCharHeight() * (char_height + adjust);
120 size.x = wxMin(size.x, g_Platform->getDisplaySize().x - 10);