X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c50f1fb9226d9260454ccb9c8a67d0be23c2827f..bbee1b4abc13379569607df8f6985ec68dc12231:/src/generic/tipdlg.cpp?ds=inline diff --git a/src/generic/tipdlg.cpp b/src/generic/tipdlg.cpp index 8ea6f3cf6b..33a019fc11 100644 --- a/src/generic/tipdlg.cpp +++ b/src/generic/tipdlg.cpp @@ -18,7 +18,7 @@ // ---------------------------------------------------------------------------- #ifdef __GNUG__ - #pragma implementation "windowbase.h" + #pragma implementation "tipdlg.h" #endif // For compilers that support precompilation, includes "wx.h". @@ -34,8 +34,14 @@ #include "wx/button.h" #include "wx/checkbox.h" #include "wx/statbox.h" - #include "wx/statbmp.h" #include "wx/dialog.h" + #include "wx/icon.h" + #include "wx/intl.h" + #include "wx/settings.h" + #include "wx/textctrl.h" + #include "wx/statbmp.h" + #include "wx/stattext.h" + #include "wx/sizer.h" #endif // WX_PRECOMP #include "wx/statline.h" @@ -74,6 +80,13 @@ public: virtual wxString GetTip(); }; + +// Empty implementation for now to keep the linker happy +wxString wxRegTipProvider::GetTip() +{ + return wxEmptyString; +} + #endif // __WIN32__ // the dialog we show in wxShowTip() @@ -140,7 +153,7 @@ wxString wxFileTipProvider::GetTip() // ---------------------------------------------------------------------------- BEGIN_EVENT_TABLE(wxTipDialog, wxDialog) - EVT_BUTTON(wxID_NEXT_TIP, OnNextTip) + EVT_BUTTON(wxID_NEXT_TIP, wxTipDialog::OnNextTip) END_EVENT_TABLE() wxTipDialog::wxTipDialog(wxWindow *parent, @@ -152,88 +165,78 @@ wxTipDialog::wxTipDialog(wxWindow *parent, { m_tipProvider = tipProvider; - wxSize sizeBtn = GetStandardButtonSize(); - wxLayoutConstraints *c; + // 1) create all controls in tab order - // create the controls in the right order, then set the constraints wxButton *btnClose = new wxButton(this, wxID_CANCEL, _("&Close")); + m_checkbox = new wxCheckBox(this, -1, _("&Show tips at startup")); - wxButton *btnNext = new wxButton(this, wxID_NEXT_TIP, _("&Next")); + m_checkbox->SetValue(showAtStartup); - wxTextCtrl *text = new wxTextCtrl(this, -1, _("Did you know..."), - wxDefaultPosition, wxDefaultSize, - wxTE_READONLY | wxNO_BORDER); - text->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxBOLD)); - text->SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE)); + wxButton *btnNext = new wxButton(this, wxID_NEXT_TIP, _("&Next Tip")); - m_text = new wxTextCtrl(this, -1, _T(""), - wxDefaultPosition, wxDefaultSize, - wxTE_MULTILINE | wxTE_READONLY | wxSUNKEN_BORDER); + wxStaticText *text = new wxStaticText(this, -1, _("Did you know..."), wxDefaultPosition, wxSize(-1,30) ); +#if defined(__WXMSW__) + text->SetFont(wxFont(16, wxSWISS, wxNORMAL, wxBOLD)); +#else + text->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxBOLD)); +#endif +// +// text->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); + + m_text = new wxTextCtrl(this, -1, wxT(""), + wxDefaultPosition, wxSize(200, 160), + wxTE_MULTILINE | + wxTE_READONLY | + wxTE_RICH | // a hack to get rid of vert scrollbar + wxSUNKEN_BORDER); +#if defined(__WXMSW__) + m_text->SetFont(wxFont(12, wxROMAN, wxNORMAL, wxNORMAL)); +#else m_text->SetFont(wxFont(14, wxROMAN, wxNORMAL, wxNORMAL)); +#endif -#ifdef __WXMSW__ +#if defined(__WXMSW__) || defined(__WXPM__) wxIcon icon("wxICON_TIP"); #else + // XPM hack: make the arrays const + #define static static const + #include "wx/generic/tip.xpm" - wxIcon icon(info); -#endif + #undef static + + wxIcon icon(tipIcon); +#endif wxStaticBitmap *bmp = new wxStaticBitmap(this, -1, icon); - const int iconSize = icon.GetWidth(); - - c = new wxLayoutConstraints; - c->top.SameAs(this, wxTop, 2*LAYOUT_Y_MARGIN); - c->left.RightOf(bmp, 2*LAYOUT_X_MARGIN); - c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN); - c->height.Absolute(2*text->GetSize().GetHeight()); - text->SetConstraints(c); - - c = new wxLayoutConstraints; - c->centreY.SameAs(text, wxCentreY); - c->left.SameAs(this, wxLeft, 2*LAYOUT_X_MARGIN); - c->width.Absolute(iconSize); - c->height.Absolute(iconSize); - bmp->SetConstraints(c); - - c = new wxLayoutConstraints; - c->bottom.SameAs(this, wxBottom, 2*LAYOUT_X_MARGIN); - c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN); - c->width.Absolute(sizeBtn.GetWidth()); - c->height.Absolute(sizeBtn.GetHeight()); - btnClose->SetConstraints(c); - - c = new wxLayoutConstraints; - c->bottom.SameAs(this, wxBottom, 2*LAYOUT_X_MARGIN); - c->right.LeftOf(btnClose, 2*LAYOUT_X_MARGIN); - c->width.Absolute(sizeBtn.GetWidth()); - c->height.Absolute(sizeBtn.GetHeight()); - btnNext->SetConstraints(c); - - c = new wxLayoutConstraints; - c->bottom.SameAs(this, wxBottom, 2*LAYOUT_X_MARGIN); - c->left.SameAs(this, wxLeft, 2*LAYOUT_X_MARGIN); - c->width.AsIs(); - c->height.AsIs(); - m_checkbox->SetConstraints(c); - m_checkbox->SetValue(showAtStartup); + // 2) put them in boxes - c = new wxLayoutConstraints; - c->top.Below(text); - c->left.SameAs(this, wxLeft, 2*LAYOUT_X_MARGIN); - c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN); - c->bottom.Above(btnClose, -2*LAYOUT_Y_MARGIN); - m_text->SetConstraints(c); + wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); - SetTipText(); + wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL ); + icon_text->Add( bmp, 0, wxCENTER ); + icon_text->Add( text, 1, wxCENTER | wxLEFT, 20 ); + topsizer->Add( icon_text, 0, wxEXPAND | wxALL, 10 ); - Centre(wxBOTH | wxCENTER_FRAME); + topsizer->Add( m_text, 1, wxEXPAND | wxLEFT|wxRIGHT, 10 ); - wxSize size(5*sizeBtn.GetWidth(), 10*sizeBtn.GetHeight()); - SetSize(size); - SetSizeHints(size.x, size.y); + wxBoxSizer *bottom = new wxBoxSizer( wxHORIZONTAL ); + bottom->Add( m_checkbox, 0, wxCENTER ); + bottom->Add( 10,10,1 ); + bottom->Add( btnNext, 0, wxCENTER | wxLEFT, 10 ); + bottom->Add( btnClose, 0, wxCENTER | wxLEFT, 10 ); + topsizer->Add( bottom, 0, wxEXPAND | wxALL, 10 ); + + SetTipText(); SetAutoLayout(TRUE); + SetSizer( topsizer ); + + topsizer->SetSizeHints( this ); + topsizer->Fit( this ); + + Centre(wxBOTH | wxCENTER_FRAME); + } // ----------------------------------------------------------------------------