1 /*************************************************************************** 2 * 3 * Project: OpenCPN 4 * 5 *************************************************************************** 6 * Copyright (C) 2010 by David S. Register * 7 * * 8 * This program is free software; you can redistribute it and/or modify * 9 * it under the terms of the GNU General Public License as published by * 10 * the Free Software Foundation; either version 2 of the License, or * 11 * (at your option) any later version. * 12 * * 13 * This program is distributed in the hope that it will be useful, * 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 16 * GNU General Public License for more details. * 17 * * 18 * You should have received a copy of the GNU General Public License * 19 * along with this program; if not, write to the * 20 * Free Software Foundation, Inc., * 21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 22 **************************************************************************/ 23 24 #ifndef __AISTARGETQUERYDIALOG_H__ 25 #define __AISTARGETQUERYDIALOG_H__ 26 27 #include <wx/frame.h> 28 #include <wx/sizer.h> 29 30 #include "ocpn_types.h" 31 32 #define AIS_TARGET_QUERY_STYLE wxDEFAULT_FRAME_STYLE|wxFRAME_FLOAT_ON_PARENT 33 34 class wxHtmlWindow; 35 class AIS_Target_Data; 36 37 class AISTargetQueryDialog: public wxFrame 38 { 39 DECLARE_CLASS( AISTargetQueryDialog ) 40 DECLARE_EVENT_TABLE() 41 public: 42 43 /// Constructors 44 45 AISTargetQueryDialog( ); 46 AISTargetQueryDialog( wxWindow* parent, 47 wxWindowID id = wxID_ANY, 48 const wxString& caption = _("Object Query"), 49 const wxPoint& pos = wxDefaultPosition, 50 const wxSize& size = wxDefaultSize, 51 long style = AIS_TARGET_QUERY_STYLE ); 52 53 ~AISTargetQueryDialog( ); 54 /// Initialise our variables 55 void Init(); 56 57 /// Creation 58 bool Create( wxWindow* parent, 59 wxWindowID id = wxID_ANY, 60 const wxString& caption = _("Object Query"), 61 const wxPoint& pos = wxDefaultPosition, 62 const wxSize& size = wxDefaultSize, 63 long style = AIS_TARGET_QUERY_STYLE ); 64 65 void OnClose(wxCloseEvent& event); 66 void OnIdOKClick( wxCommandEvent& event ); 67 void OnIdWptCreateClick( wxCommandEvent& event ); 68 void OnIdTrkCreateClick( wxCommandEvent& event ); 69 void OnMove( wxMoveEvent& event ); 70 void OnSize( wxSizeEvent& event ); 71 void AdjustBestSize(AIS_Target_Data *td); 72 void CreateControls(); 73 void RenderHTMLQuery(AIS_Target_Data *td); 74 void OnKey( wxKeyEvent& ke ); 75 76 void SetText(const wxString &text_string); 77 void SetColorScheme(ColorScheme cs); 78 79 void RecalculateSize( void ); SetAutoCentre(bool bval)80 void SetAutoCentre( bool bval ){ m_bautoCentre = bval;} SetAutoSize(bool bval)81 void SetAutoSize( bool bval ){ m_bautosize = bval;} 82 83 void UpdateText(void); 84 void SetMMSI(int mmsi); GetMMSI(void)85 int GetMMSI(void){ return m_MMSI; } 86 87 // Data 88 int m_MMSI; 89 wxHtmlWindow *m_pQueryTextCtl; 90 ColorScheme m_colorscheme; 91 wxBoxSizer *m_pboxSizer; 92 int m_nl; 93 wxButton *m_okButton; 94 wxButton *m_createWptBtn; 95 wxButton *m_createTrkBtn; 96 bool m_bsize_set; 97 int m_adjustedFontSize; 98 int m_control_font_size; 99 wxFont *m_basefont; 100 wxWindow *m_parent; 101 bool m_bautoCentre; 102 bool m_bautosize; 103 }; 104 105 #endif 106