]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextstyledlg.cpp
Update header control when wxPropertyGridManager is resized.
[wxWidgets.git] / src / richtext / richtextstyledlg.cpp
index 53419028269a298c2ed91be6c7b49806d625c2f0..40705cff21c5b30f2336ab936493f779489179a2 100644 (file)
@@ -152,6 +152,10 @@ bool wxRichTextStyleOrganiserDialog::Create( int flags, wxRichTextStyleSheet* sh
 
 void wxRichTextStyleOrganiserDialog::CreateControls()
 {
+#ifdef __WXMAC__
+    SetWindowVariant(wxWINDOW_VARIANT_SMALL);
+#endif
+
     bool hideTypeSelector = false;
     wxRichTextStyleListBox::wxRichTextStyleType typesToShow = wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL;
 
@@ -538,26 +542,15 @@ bool wxRichTextStyleOrganiserDialog::ApplyStyle(wxRichTextCtrl* ctrl)
         ctrl = GetRichTextCtrl();
     if (!ctrl)
         return false;
-    if (!ctrl->HasSelection())
-        return false;
-
 
     wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
     wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
-    wxRichTextBoxStyleDefinition* boxDef = wxDynamicCast(def, wxRichTextBoxStyleDefinition);
 
-    if (listDef && m_restartNumberingCtrl->GetValue())
+    if (listDef && m_restartNumberingCtrl->GetValue() && ctrl->HasSelection())
     {
         wxRichTextRange range = ctrl->GetSelectionRange();
         return ctrl->SetListStyle(range, listDef, wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_RENUMBER);
     }
-    else if (boxDef)
-    {
-        if (!ctrl->GetFocusObject() || (ctrl->GetFocusObject() && (ctrl->GetFocusObject() == & ctrl->GetBuffer())))
-            return false;
-        ctrl->SetStyle(ctrl->GetFocusObject(), def->GetStyleMergedWithBase(m_stylesListBox->GetStyleSheet()));
-        return true;
-    }
     else
     {
         return ctrl->ApplyStyle(def);
@@ -718,19 +711,19 @@ void wxRichTextStyleOrganiserDialog::OnEditClick( wxCommandEvent& WXUNUSED(event
 
         int pages = wxRICHTEXT_FORMAT_STYLE_EDITOR;
 
-        if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
+        if (wxDynamicCast(def, wxRichTextCharacterStyleDefinition))
         {
             pages |= wxRICHTEXT_FORMAT_FONT;
         }
-        else if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition)))
+        else if (wxDynamicCast(def, wxRichTextListStyleDefinition))
         {
             pages |= wxRICHTEXT_FORMAT_LIST_STYLE|wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING;
         }
-        else if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition)))
+        else if (wxDynamicCast(def, wxRichTextParagraphStyleDefinition))
         {
             pages |= wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING|wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS;
         }
-        else if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
+        else if (wxDynamicCast(def, wxRichTextBoxStyleDefinition))
         {
             pages |= wxRICHTEXT_FORMAT_MARGINS|wxRICHTEXT_FORMAT_SIZE|wxRICHTEXT_FORMAT_BORDERS|wxRICHTEXT_FORMAT_BACKGROUND;
         }
@@ -795,13 +788,13 @@ void wxRichTextStyleOrganiserDialog::OnDeleteClick( wxCommandEvent& WXUNUSED(eve
         {
             m_stylesListBox->GetStyleListBox()->SetItemCount(0);
 
-            if (def->IsKindOf(CLASSINFO(wxRichTextListStyleDefinition)))
+            if (wxDynamicCast(def, wxRichTextListStyleDefinition))
                 GetStyleSheet()->RemoveListStyle((wxRichTextListStyleDefinition*) def, true);
-            else if (def->IsKindOf(CLASSINFO(wxRichTextParagraphStyleDefinition)))
+            else if (wxDynamicCast(def, wxRichTextParagraphStyleDefinition))
                 GetStyleSheet()->RemoveParagraphStyle((wxRichTextParagraphStyleDefinition*) def, true);
-            else if (def->IsKindOf(CLASSINFO(wxRichTextCharacterStyleDefinition)))
+            else if (wxDynamicCast(def, wxRichTextCharacterStyleDefinition))
                 GetStyleSheet()->RemoveCharacterStyle((wxRichTextCharacterStyleDefinition*) def, true);
-            else if (def->IsKindOf(CLASSINFO(wxRichTextBoxStyleDefinition)))
+            else if (wxDynamicCast(def, wxRichTextBoxStyleDefinition))
                 GetStyleSheet()->RemoveBoxStyle((wxRichTextBoxStyleDefinition*) def, true);
 
             m_stylesListBox->UpdateStyles();