void wxRichTextListStyleDefinition::Copy(const wxRichTextListStyleDefinition& def)
{
wxRichTextParagraphStyleDefinition::Copy(def);
-
+
int i;
for (i = 0; i < 10; i++)
m_levelStyles[i] = def.m_levelStyles[i];
for (i = 0; i < 10; i++)
if (!(m_levelStyles[i] == def.m_levelStyles[i]))
return false;
-
+
return true;
}
if (i >= 0 && i < 10)
{
wxTextAttrEx attr;
-
+
attr.SetBulletStyle(bulletStyle);
attr.SetLeftIndent(leftIndent, leftSubIndent);
if (!bulletSymbol.IsEmpty())
attr.SetBulletSymbol(bulletSymbol[0]);
-
- m_levelStyles[i] = attr;
- }
+
+ m_levelStyles[i] = attr;
+ }
}
/// Finds the level corresponding to the given indentation
wxTextAttrEx wxRichTextListStyleDefinition::CombineWithParagraphStyle(int indent, const wxTextAttrEx& paraStyle)
{
int listLevel = FindLevelForIndent(indent);
-
+
wxTextAttrEx attr(*GetLevelAttributes(listLevel));
int oldLeftIndent = attr.GetLeftIndent();
int oldLeftSubIndent = attr.GetLeftSubIndent();
- // First apply the overall paragraph style, if any
+ // First apply the overall paragraph style, if any
wxRichTextApplyStyle(attr, GetStyle());
// Then apply paragraph style, e.g. from paragraph style definition
wxRichTextApplyStyle(attr, paraStyle);
-
+
// We override the indents according to the list definition
attr.SetLeftIndent(oldLeftIndent, oldLeftSubIndent);
-
+
return attr;
}
int oldLeftIndent = attr.GetLeftIndent();
int oldLeftSubIndent = attr.GetLeftSubIndent();
- // Apply the overall paragraph style, if any
+ // Apply the overall paragraph style, if any
wxRichTextApplyStyle(attr, GetStyle());
// We override the indents according to the list definition
attr.SetLeftIndent(oldLeftIndent, oldLeftSubIndent);
-
+
return attr;
}
if (m_nextSheet)
m_nextSheet->m_previousSheet = m_previousSheet;
-
+
if (m_previousSheet)
m_previousSheet->m_nextSheet = m_nextSheet;
-
+
m_previousSheet = NULL;
m_nextSheet = NULL;
}
if (def->GetName().Lower() == name.Lower())
return def;
}
-
+
if (m_nextSheet && recurse)
return m_nextSheet->FindStyle(list, name, recurse);
{
m_previousSheet = before->m_previousSheet;
m_nextSheet = before;
-
+
before->m_previousSheet = this;
return true;
}
{
last = last->m_nextSheet;
}
-
+
if (last)
{
m_previousSheet = last;
last->m_nextSheet = this;
-
+
return true;
}
else
m_previousSheet->m_nextSheet = m_nextSheet;
if (m_nextSheet)
m_nextSheet->m_previousSheet = m_previousSheet;
-
+
m_previousSheet = NULL;
m_nextSheet = NULL;
}
{
if (!GetStyleSheet())
return wxEmptyString;
-
+
wxRichTextStyleDefinition* def = GetStyle(n);
if (def)
return CreateHTML(def);
else if ((GetStyleType() == wxRICHTEXT_STYLE_LIST) && (i < GetStyleSheet()->GetListStyleCount()))
{
return GetStyleSheet()->GetListStyle(i);
- }
+ }
return NULL;
}
if (GetStyleSheet())
{
SetSelection(wxNOT_FOUND);
-
+
if (GetStyleType() == wxRICHTEXT_STYLE_ALL)
SetItemCount(GetStyleSheet()->GetParagraphStyleCount()+GetStyleSheet()->GetCharacterStyleCount()+GetStyleSheet()->GetListStyleCount());
else if (GetStyleType() == wxRICHTEXT_STYLE_PARAGRAPH)
SetItemCount(GetStyleSheet()->GetCharacterStyleCount());
else if (GetStyleType() == wxRICHTEXT_STYLE_LIST)
SetItemCount(GetStyleSheet()->GetListStyleCount());
-
+
Refresh();
if (GetItemCount() > 0)
{
SetSelection(0);
SendSelectedEvent();
- }
+ }
}
}
{
styleName = para->GetAttributes().GetListStyleName();
}
-
+
return styleName;
}
const wxSize& size, long style)
{
wxControl::Create(parent, id, pos, size, style);
-
+
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
if (size != wxDefaultSize)
SetBestFittingSize(size);
-
+
bool showSelector = ((style & wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR) == 0);
-
+
m_styleListBox = new wxRichTextStyleListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, showSelector ? wxSIMPLE_BORDER : wxNO_BORDER);
wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL);
-
+
if (showSelector)
- {
+ {
wxArrayString choices;
choices.Add(_("All styles"));
choices.Add(_("Paragraph styles"));
choices.Add(_("Character styles"));
choices.Add(_("List styles"));
-
+
m_styleChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);
-
+
boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 5);
boxSizer->Add(m_styleChoice, 0, wxALL|wxEXPAND, 5);
}
{
boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 0);
}
-
+
SetSizer(boxSizer);
Layout();
m_dontUpdate = true;
if (m_styleChoice)
- {
+ {
int i = StyleTypeToIndex(m_styleListBox->GetStyleType());
m_styleChoice->SetSelection(i);
}
-
+
m_dontUpdate = false;
-
+
return true;
}
wxRichTextStyleListCtrl::~wxRichTextStyleListCtrl()
{
-
+
}
/// React to style type choice
{
if (m_dontUpdate)
return;
-
+
wxRichTextStyleListBox::wxRichTextStyleType styleType = StyleIndexToType(event.GetSelection());
m_styleListBox->SetStyleType(styleType);
}
m_dontUpdate = true;
if (m_styleChoice)
- {
+ {
int i = StyleTypeToIndex(m_styleListBox->GetStyleType());
m_styleChoice->SetSelection(i);
}
-
+
m_dontUpdate = false;
}
void wxRichTextStyleListCtrl::UpdateStyles()
{
if (m_styleListBox)
- m_styleListBox->UpdateStyles();
+ m_styleListBox->UpdateStyles();
}
#if wxUSE_COMBOCTRL
if (GetRichTextCtrl() && !IsPopupShown() && m_stylePopup && wxWindow::FindFocus() != this)
{
wxString styleName = wxRichTextStyleListBox::GetStyleToShowInIdleTime(GetRichTextCtrl(), m_stylePopup->GetStyleType());
-
+
wxString currentValue = GetValue();
if (!styleName.IsEmpty())
{
#endif
// wxUSE_RICHTEXT
-