]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtexttabspage.cpp
Avoid calling gtk_window_get_position() from "configure-event" handler, if possible.
[wxWidgets.git] / src / richtext / richtexttabspage.cpp
index f26a8dde2b26d37c2ecf0d7a54bd7a5766b9ed2d..62584f7501d6e7076b3660f05ef1d83102259e13 100644 (file)
@@ -4,36 +4,25 @@
 // Author:      Julian Smart
 // Modified by:
 // Created:     10/4/2006 8:03:20 AM
 // Author:      Julian Smart
 // Modified by:
 // Created:     10/4/2006 8:03:20 AM
-// RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Copyright:   (c) Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-    #pragma hdrstop
-#endif
-
 #if wxUSE_RICHTEXT
 
 #include "wx/richtext/richtexttabspage.h"
 
 #if wxUSE_RICHTEXT
 
 #include "wx/richtext/richtexttabspage.h"
 
-#ifndef WX_PRECOMP
-#endif
-
 /*!
  * wxRichTextTabsPage type definition
  */
 
 /*!
  * wxRichTextTabsPage type definition
  */
 
-IMPLEMENT_DYNAMIC_CLASS( wxRichTextTabsPage, wxPanel )
+IMPLEMENT_DYNAMIC_CLASS( wxRichTextTabsPage, wxRichTextDialogPage )
 
 /*!
  * wxRichTextTabsPage event table definition
  */
 
 
 /*!
  * wxRichTextTabsPage event table definition
  */
 
-BEGIN_EVENT_TABLE( wxRichTextTabsPage, wxPanel )
+BEGIN_EVENT_TABLE( wxRichTextTabsPage, wxRichTextDialogPage )
 
 ////@begin wxRichTextTabsPage event table entries
     EVT_LISTBOX( ID_RICHTEXTTABSPAGE_TABLIST, wxRichTextTabsPage::OnTablistSelected )
 
 ////@begin wxRichTextTabsPage event table entries
     EVT_LISTBOX( ID_RICHTEXTTABSPAGE_TABLIST, wxRichTextTabsPage::OnTablistSelected )
@@ -51,6 +40,8 @@ BEGIN_EVENT_TABLE( wxRichTextTabsPage, wxPanel )
 
 END_EVENT_TABLE()
 
 
 END_EVENT_TABLE()
 
+IMPLEMENT_HELP_PROVISION(wxRichTextTabsPage)
+
 /*!
  * wxRichTextTabsPage constructors
  */
 /*!
  * wxRichTextTabsPage constructors
  */
@@ -69,7 +60,7 @@ wxRichTextTabsPage::wxRichTextTabsPage( wxWindow* parent, wxWindowID id, const w
 /*!
  * Initialise members
  */
 /*!
  * Initialise members
  */
+
 void wxRichTextTabsPage::Init()
 {
     m_tabsPresent = false;
 void wxRichTextTabsPage::Init()
 {
     m_tabsPresent = false;
@@ -87,7 +78,7 @@ void wxRichTextTabsPage::Init()
 bool wxRichTextTabsPage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
 {
 ////@begin wxRichTextTabsPage creation
 bool wxRichTextTabsPage::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
 {
 ////@begin wxRichTextTabsPage creation
-    wxPanel::Create( parent, id, pos, size, style );
+    wxRichTextDialogPage::Create( parent, id, pos, size, style );
 
     CreateControls();
     if (GetSizer())
 
     CreateControls();
     if (GetSizer())
@@ -106,10 +97,10 @@ bool wxRichTextTabsPage::Create( wxWindow* parent, wxWindowID id, const wxPoint&
 void wxRichTextTabsPage::CreateControls()
 {
 ////@begin wxRichTextTabsPage content construction
 void wxRichTextTabsPage::CreateControls()
 {
 ////@begin wxRichTextTabsPage content construction
-    wxRichTextTabsPage* itemPanel1 = this;
+    wxRichTextTabsPage* itemRichTextDialogPage1 = this;
 
     wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
 
     wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
-    itemPanel1->SetSizer(itemBoxSizer2);
+    itemRichTextDialogPage1->SetSizer(itemBoxSizer2);
 
     wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
     itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);
 
     wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
     itemBoxSizer2->Add(itemBoxSizer3, 1, wxGROW|wxALL, 5);
@@ -120,19 +111,18 @@ void wxRichTextTabsPage::CreateControls()
     wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
     itemBoxSizer4->Add(itemBoxSizer5, 0, wxGROW, 5);
 
     wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
     itemBoxSizer4->Add(itemBoxSizer5, 0, wxGROW, 5);
 
-    wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("&Position (tenths of a mm):"), wxDefaultPosition, wxDefaultSize, 0 );
-    itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
+    wxStaticText* itemStaticText6 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, _("&Position (tenths of a mm):"), wxDefaultPosition, wxDefaultSize, 0 );
+    itemBoxSizer5->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
 
 
-    m_tabEditCtrl = new wxTextCtrl( itemPanel1,
-                                    ID_RICHTEXTTABSPAGE_TABEDIT,
-                                    wxEmptyString,
-                                    wxDefaultPosition,
-                                    wxDefaultSize,
-                                    0 );
+    m_tabEditCtrl = new wxTextCtrl( itemRichTextDialogPage1, ID_RICHTEXTTABSPAGE_TABEDIT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+    m_tabEditCtrl->SetHelpText(_("The tab position."));
+    if (wxRichTextTabsPage::ShowToolTips())
+        m_tabEditCtrl->SetToolTip(_("The tab position."));
     itemBoxSizer5->Add(m_tabEditCtrl, 0, wxGROW|wxALL, 5);
 
     itemBoxSizer5->Add(m_tabEditCtrl, 0, wxGROW|wxALL, 5);
 
-    wxString* m_tabListCtrlStrings = NULL;
-    m_tabListCtrl = new wxListBox( itemPanel1, ID_RICHTEXTTABSPAGE_TABLIST, wxDefaultPosition, wxSize(80, 200), 0, m_tabListCtrlStrings, wxLB_SINGLE );
+    wxArrayString m_tabListCtrlStrings;
+    m_tabListCtrlStrings.Add(_("The tab positions."));
+    m_tabListCtrl = new wxListBox( itemRichTextDialogPage1, ID_RICHTEXTTABSPAGE_TABLIST, wxDefaultPosition, wxSize(80, 200), m_tabListCtrlStrings, wxLB_SINGLE );
     itemBoxSizer5->Add(m_tabListCtrl, 1, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
 
     itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
     itemBoxSizer5->Add(m_tabListCtrl, 1, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
 
     itemBoxSizer4->Add(2, 1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
@@ -140,22 +130,26 @@ void wxRichTextTabsPage::CreateControls()
     wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
     itemBoxSizer4->Add(itemBoxSizer10, 0, wxGROW, 5);
 
     wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
     itemBoxSizer4->Add(itemBoxSizer10, 0, wxGROW, 5);
 
-    wxStaticText* itemStaticText11 = new wxStaticText( itemPanel1,
-                                                       wxID_STATIC,
-                                                       wxEmptyString,
-                                                       wxDefaultPosition,
-                                                       wxDefaultSize,
-                                                       0 );
-    itemBoxSizer10->Add(itemStaticText11, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxADJUST_MINSIZE, 5);
+    wxStaticText* itemStaticText11 = new wxStaticText( itemRichTextDialogPage1, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+    itemBoxSizer10->Add(itemStaticText11, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM, 5);
 
 
-    wxButton* itemButton12 = new wxButton( itemPanel1, ID_RICHTEXTTABSPAGE_NEW_TAB, _("&New"), wxDefaultPosition, wxDefaultSize, 0 );
-    itemBoxSizer10->Add(itemButton12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
+    wxButton* itemButton12 = new wxButton( itemRichTextDialogPage1, ID_RICHTEXTTABSPAGE_NEW_TAB, _("&New"), wxDefaultPosition, wxDefaultSize, 0 );
+    itemButton12->SetHelpText(_("Click to create a new tab position."));
+    if (wxRichTextTabsPage::ShowToolTips())
+        itemButton12->SetToolTip(_("Click to create a new tab position."));
+    itemBoxSizer10->Add(itemButton12, 0, wxGROW|wxALL, 5);
 
 
-    wxButton* itemButton13 = new wxButton( itemPanel1, ID_RICHTEXTTABSPAGE_DELETE_TAB, _("&Delete"), wxDefaultPosition, wxDefaultSize, 0 );
-    itemBoxSizer10->Add(itemButton13, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
+    wxButton* itemButton13 = new wxButton( itemRichTextDialogPage1, ID_RICHTEXTTABSPAGE_DELETE_TAB, _("&Delete"), wxDefaultPosition, wxDefaultSize, 0 );
+    itemButton13->SetHelpText(_("Click to delete the selected tab position."));
+    if (wxRichTextTabsPage::ShowToolTips())
+        itemButton13->SetToolTip(_("Click to delete the selected tab position."));
+    itemBoxSizer10->Add(itemButton13, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
 
 
-    wxButton* itemButton14 = new wxButton( itemPanel1, ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS, _("Delete A&ll"), wxDefaultPosition, wxDefaultSize, 0 );
-    itemBoxSizer10->Add(itemButton14, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
+    wxButton* itemButton14 = new wxButton( itemRichTextDialogPage1, ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS, _("Delete A&ll"), wxDefaultPosition, wxDefaultSize, 0 );
+    itemButton14->SetHelpText(_("Click to delete all tab positions."));
+    if (wxRichTextTabsPage::ShowToolTips())
+        itemButton14->SetToolTip(_("Click to delete all tab positions."));
+    itemBoxSizer10->Add(itemButton14, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
 
 ////@end wxRichTextTabsPage content construction
 }
 
 ////@end wxRichTextTabsPage content construction
 }
@@ -165,7 +159,7 @@ bool wxRichTextTabsPage::TransferDataFromWindow()
 {
     wxPanel::TransferDataFromWindow();
 
 {
     wxPanel::TransferDataFromWindow();
 
-    wxTextAttrEx* attr = GetAttributes();
+    wxRichTextAttr* attr = GetAttributes();
 
     if (m_tabsPresent)
     {
 
     if (m_tabsPresent)
     {
@@ -184,7 +178,7 @@ bool wxRichTextTabsPage::TransferDataToWindow()
 {
     wxPanel::TransferDataToWindow();
 
 {
     wxPanel::TransferDataToWindow();
 
-    wxTextAttrEx* attr = GetAttributes();
+    wxRichTextAttr* attr = GetAttributes();
 
     m_tabListCtrl->Clear();
     m_tabEditCtrl->SetValue(wxEmptyString);
 
     m_tabListCtrl->Clear();
     m_tabEditCtrl->SetValue(wxEmptyString);
@@ -232,7 +226,7 @@ void wxRichTextTabsPage::SortTabs()
     }
 }
 
     }
 }
 
-wxTextAttrEx* wxRichTextTabsPage::GetAttributes()
+wxRichTextAttr* wxRichTextTabsPage::GetAttributes()
 {
     return wxRichTextFormattingDialog::GetDialogAttributes(this);
 }
 {
     return wxRichTextFormattingDialog::GetDialogAttributes(this);
 }
@@ -243,7 +237,7 @@ wxTextAttrEx* wxRichTextTabsPage::GetAttributes()
 
 bool wxRichTextTabsPage::ShowToolTips()
 {
 
 bool wxRichTextTabsPage::ShowToolTips()
 {
-    return true;
+    return wxRichTextFormattingDialog::ShowToolTips();
 }
 
 /*!
 }
 
 /*!
@@ -273,7 +267,7 @@ wxIcon wxRichTextTabsPage::GetIconResource( const wxString& name )
 }
 
 /*!
 }
 
 /*!
- * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_NEW_TAB
+ * wxEVT_BUTTON event handler for ID_RICHTEXTTABSPAGE_NEW_TAB
  */
 
 void wxRichTextTabsPage::OnNewTabClick( wxCommandEvent& WXUNUSED(event) )
  */
 
 void wxRichTextTabsPage::OnNewTabClick( wxCommandEvent& WXUNUSED(event) )
@@ -310,7 +304,7 @@ void wxRichTextTabsPage::OnNewTabUpdate( wxUpdateUIEvent& event )
 
 
 /*!
 
 
 /*!
- * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_DELETE_TAB
+ * wxEVT_BUTTON event handler for ID_RICHTEXTTABSPAGE_DELETE_TAB
  */
 
 void wxRichTextTabsPage::OnDeleteTabClick( wxCommandEvent& WXUNUSED(event) )
  */
 
 void wxRichTextTabsPage::OnDeleteTabClick( wxCommandEvent& WXUNUSED(event) )
@@ -332,7 +326,7 @@ void wxRichTextTabsPage::OnDeleteTabUpdate( wxUpdateUIEvent& event )
 
 
 /*!
 
 
 /*!
- * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS
+ * wxEVT_BUTTON event handler for ID_RICHTEXTTABSPAGE_DELETE_ALL_TABS
  */
 
 void wxRichTextTabsPage::OnDeleteAllTabsClick( wxCommandEvent& WXUNUSED(event) )
  */
 
 void wxRichTextTabsPage::OnDeleteAllTabsClick( wxCommandEvent& WXUNUSED(event) )
@@ -355,7 +349,7 @@ void wxRichTextTabsPage::OnDeleteAllTabsUpdate( wxUpdateUIEvent& event )
 
 
 /*!
 
 
 /*!
- * wxEVT_COMMAND_LISTBOX_SELECTED event handler for ID_RICHTEXTTABSPAGE_TABLIST
+ * wxEVT_LISTBOX event handler for ID_RICHTEXTTABSPAGE_TABLIST
  */
 
 void wxRichTextTabsPage::OnTablistSelected( wxCommandEvent& WXUNUSED(event) )
  */
 
 void wxRichTextTabsPage::OnTablistSelected( wxCommandEvent& WXUNUSED(event) )