27#include <wx/dcclient.h>
29#include "model/config_vars.h"
31#include "OCPNPlatform.h"
33#include "color_handler.h"
35#ifdef __OCPN__ANDROID__
36#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(GetCharWidth(), 1, m_size.x - 2 * GetCharWidth(),
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);
106void 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);
A custom panel for displaying chart information.
wxFont * GetFont(const wxString &TextElement, int requested_font_size=0)
Gets a font object for a UI element.