20#include <wx/statline.h>
21#include <wx/artprov.h>
23#define wxID_NEXT_TIP 32000
24#if defined(__SMARTPHONE__)
25 #define wxLARGESMALL(large,small) small
27 #define wxLARGESMALL(large,small) large
34TipDialog::
TipDialog(wxWindow *parent, wxTipProvider *tipProvider, const wxArrayString& text,
bool showAtStartup)
35 : wxDialog(GetParentForModalDialog(parent, 0), wxID_ANY, text[0], wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
37 m_tipProvider = tipProvider;
38 bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
41 wxStaticText *__text =
new wxStaticText(
this, wxID_ANY, text[1]);
45 wxFont font = __text->GetFont();
46 font.SetPointSize(
int(1.6 * font.GetPointSize()));
47 font.SetWeight(wxFONTWEIGHT_BOLD);
48 __text->SetFont(font);
51 m_text =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString,
52 wxDefaultPosition, wxSize(200, 160),
57 wxDEFAULT_CONTROL_BORDER
60 m_text->SetFont(wxFont(12, wxSWISS, wxNORMAL, wxNORMAL));
76 wxIcon icon = wxArtProvider::GetIcon(wxART_TIP, wxART_CMN_DIALOG);
77 wxStaticBitmap *bmp =
new wxStaticBitmap(
this, wxID_ANY, icon);
81 m_checkbox =
new wxCheckBox(
this, wxID_ANY, text[3]);
82 m_checkbox->SetValue(showAtStartup);
83 m_checkbox->SetFocus();
87 wxButton *btnNext =
new wxButton(
this,
wxID_NEXT_TIP, text[2]);
92 wxButton *btnClose =
new wxButton(
this, wxID_CLOSE, text[4]);
93 SetAffirmativeId(wxID_CLOSE);
99 wxBoxSizer *topsizer =
new wxBoxSizer( wxVERTICAL );
101 wxBoxSizer *icon_text =
new wxBoxSizer( wxHORIZONTAL );
102 icon_text->Add( bmp, 0, wxCENTER );
103 icon_text->Add( __text, 1, wxCENTER | wxLEFT,
wxLARGESMALL(20,0) );
104 topsizer->Add( icon_text, 0, wxEXPAND | wxALL,
wxLARGESMALL(10,0) );
106 topsizer->Add( m_text, 1, wxEXPAND | wxLEFT|wxRIGHT,
wxLARGESMALL(10,0) );
108 wxBoxSizer *bottom =
new wxBoxSizer( wxHORIZONTAL );
110 topsizer->Add( m_checkbox, 0, wxCENTER|wxTOP );
112 bottom->Add( m_checkbox, 0, wxCENTER );
117 SetLeftMenu(wxID_CLOSE);
120 bottom->Add( 10,10,1 );
121 bottom->Add( btnNext, 0, wxCENTER | wxLEFT,
wxLARGESMALL(10,0) );
122 bottom->Add( btnClose, 0, wxCENTER | wxLEFT,
wxLARGESMALL(10,0) );
126 topsizer->Add( bottom, 0, wxCENTER | wxALL, 5 );
128 topsizer->Add( bottom, 0, wxEXPAND | wxALL,
wxLARGESMALL(10,0) );
132 SetSizer( topsizer );
134 topsizer->SetSizeHints(
this );
135 topsizer->Fit(
this );
137 Centre(wxBOTH | wxCENTER_FRAME);
141bool ShowTip(wxWindow* parent, wxTipProvider* tipProvider,
const wxArrayString& text,
bool showAtStartUp)
143 TipDialog dlg(parent, tipProvider, text, showAtStartUp);
MyTipProvider(const std::vector< std::string > &vTipList)
std::vector< std::string > vTip
void OnNextTip(wxCommandEvent &WXUNUSED(event))
bool ShowTipsOnStartup() const
bool ShowTip(wxWindow *parent, wxTipProvider *tipProvider, const wxArrayString &text, bool showAtStartUp)
#define wxLARGESMALL(large, small)