#include "wx/sstream.h"
#include "wx/html/htmlwin.h"
-#include "bitmaps/sample.xpm"
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
+
#include "bitmaps/smiley.xpm"
// #include "bitmaps/idea.xpm"
#include "bitmaps/zebra.xpm"
#include "wx/richtext/richtextctrl.h"
#include "wx/richtext/richtextstyles.h"
#include "wx/richtext/richtextxml.h"
+#include "wx/richtext/richtexthtml.h"
// ----------------------------------------------------------------------------
// resources
m_styleSheet->AddParagraphStyle(indentedPara);
+ wxRichTextParagraphStyleDefinition* indentedPara2 = new wxRichTextParagraphStyleDefinition(wxT("Red Bold Indented"));
+ wxRichTextAttr indentedAttr2;
+ indentedAttr2.SetFontFaceName(romanFont.GetFaceName());
+ indentedAttr2.SetFontSize(12);
+ indentedAttr2.SetFontWeight(wxBOLD);
+ indentedAttr2.SetTextColour(*wxRED);
+ indentedAttr2.SetFontSize(12);
+ indentedAttr2.SetLeftIndent(100, 0);
+ // We want to affect indentation, font and text colour
+ indentedAttr2.SetFlags(wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_FONT|wxTEXT_ATTR_TEXT_COLOUR);
+ indentedPara2->SetStyle(indentedAttr2);
+
+ m_styleSheet->AddParagraphStyle(indentedPara2);
+
wxRichTextParagraphStyleDefinition* flIndentedPara = new wxRichTextParagraphStyleDefinition(wxT("First Line Indented"));
wxRichTextAttr flIndentedAttr;
flIndentedAttr.SetFontFaceName(swissFont.GetFaceName());
: wxFrame(NULL, id, title, pos, size, style)
{
// set the frame icon
- SetIcon(sample_xpm);
+ SetIcon(wxICON(sample));
// create a menu bar
wxMenu *fileMenu = new wxMenu;
SetMenuBar(menuBar);
// create a status bar just for fun (by default with 1 pane only)
+ // but don't create it on limited screen space (WinCE)
+ bool is_pda = wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA;
+
#if wxUSE_STATUSBAR
- CreateStatusBar(2);
- SetStatusText(_T("Welcome to wxRichTextCtrl!"));
+ if ( !is_pda )
+ {
+ CreateStatusBar(2);
+ SetStatusText(_T("Welcome to wxRichTextCtrl!"));
+ }
#endif
wxToolBar* toolBar = CreateToolBar();
wxFont boldFont = wxFont(12, wxROMAN, wxNORMAL, wxBOLD);
wxFont italicFont = wxFont(12, wxROMAN, wxITALIC, wxNORMAL);
- m_richTextCtrl = new wxRichTextCtrl(splitter, wxID_ANY, wxDefaultPosition, wxSize(200, 200), wxVSCROLL|wxHSCROLL|wxNO_BORDER);
+ m_richTextCtrl = new wxRichTextCtrl(splitter, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200, 200), wxVSCROLL|wxHSCROLL|wxNO_BORDER|wxWANTS_CHARS);
wxFont font(12, wxROMAN, wxNORMAL, wxNORMAL);
-#ifdef __WXMAC__
- font.SetNoAntiAliasing(true);
-#endif
m_richTextCtrl->SetFont(font);
wxRichTextStyleListBox* styleListBox = new wxRichTextStyleListBox(splitter, wxID_ANY);
- splitter->SplitVertically(m_richTextCtrl, styleListBox, 400);
+
+ wxSize display = wxGetDisplaySize();
+ if ( is_pda && ( display.GetWidth() < display.GetHeight() ) )
+ {
+ splitter->SplitHorizontally(m_richTextCtrl, styleListBox);
+ }
+ else
+ {
+ splitter->SplitVertically(m_richTextCtrl, styleListBox, 400);
+ }
splitter->UpdateSize();
r.EndLineSpacing();
r.EndAlignment();
+ wxArrayInt tabs;
+ tabs.Add(400);
+ tabs.Add(600);
+ tabs.Add(800);
+ tabs.Add(1000);
+ wxTextAttrEx attr;
+ attr.SetFlags(wxTEXT_ATTR_TABS);
+ attr.SetTabs(tabs);
+ r.SetDefaultStyle(attr);
+
+ r.Newline();
+ r.WriteText(wxT("This line contains tabs:\tFirst tab\tSecond tab\tThird tab"));
+
r.Newline();
r.WriteText(wxT("Other notable features of wxRichTextCtrl include:"));
path,
filename,
filter,
- wxOPEN);
+ wxFD_OPEN);
if (dialog.ShowModal() == wxID_OK)
{
path,
filename,
filter,
- wxSAVE);
+ wxFD_SAVE);
if (dialog.ShowModal() == wxID_OK)
{