// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
- #pragma implementation "text.cpp"
-#endif
-
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#endif // wxUSE_TOOLTIPS
#if wxUSE_CLIPBOARD
- void OnPasteFromClipboard( wxCommandEvent &event )
+ void OnPasteFromClipboard( wxCommandEvent& WXUNUSED(event) )
{ m_panel->DoPasteFromClipboard(); }
- void OnCopyToClipboard( wxCommandEvent &event )
+ void OnCopyToClipboard( wxCommandEvent& WXUNUSED(event) )
{ m_panel->DoCopyToClipboard(); }
#endif // wxUSE_CLIPBOARD
- void OnAddTextFreeze( wxCommandEvent& event )
+ void OnAddTextFreeze( wxCommandEvent& WXUNUSED(event) )
{ DoAddText(true); }
- void OnAddText( wxCommandEvent& event )
+ void OnAddText( wxCommandEvent& WXUNUSED(event) )
{ DoAddText(false); }
- void OnRemoveText( wxCommandEvent& event )
+ void OnRemoveText( wxCommandEvent& WXUNUSED(event) )
{ m_panel->DoRemoveText(); }
- void OnReplaceText( wxCommandEvent& event )
+ void OnReplaceText( wxCommandEvent& WXUNUSED(event) )
{ m_panel->DoReplaceText(); }
- void OnSelectText( wxCommandEvent& event )
+ void OnSelectText( wxCommandEvent& WXUNUSED(event) )
{ m_panel->DoSelectText(); }
- void OnMoveToEndOfText( wxCommandEvent &event )
+ void OnMoveToEndOfText( wxCommandEvent& WXUNUSED(event) )
{ m_panel->DoMoveToEndOfText(); }
- void OnMoveToEndOfEntry( wxCommandEvent &event )
+ void OnMoveToEndOfEntry( wxCommandEvent& WXUNUSED(event) )
{ m_panel->DoMoveToEndOfEntry(); }
- void OnScrollLineDown(wxCommandEvent& event)
+ void OnScrollLineDown(wxCommandEvent& WXUNUSED(event))
{
if ( !m_panel->m_textrich->LineDown() )
wxLogMessage(_T("Already at the bottom"));
}
- void OnScrollLineUp(wxCommandEvent& event)
+ void OnScrollLineUp(wxCommandEvent& WXUNUSED(event))
{
if ( !m_panel->m_textrich->LineUp() )
wxLogMessage(_T("Already at the top"));
}
- void OnScrollPageDown(wxCommandEvent& event)
+ void OnScrollPageDown(wxCommandEvent& WXUNUSED(event))
{
if ( !m_panel->m_textrich->PageDown() )
wxLogMessage(_T("Already at the bottom"));
}
- void OnScrollPageUp(wxCommandEvent& event)
+ void OnScrollPageUp(wxCommandEvent& WXUNUSED(event))
{
if ( !m_panel->m_textrich->PageUp() )
wxLogMessage(_T("Already at the top"));
MyTextCtrl::ms_logFocus = event.IsChecked();
}
- void OnSetText(wxCommandEvent& event)
+ void OnSetText(wxCommandEvent& WXUNUSED(event))
{
m_panel->m_text->SetValue(_T("Hello, world (what else did you expect)?"));
}
}
}
-void MyTextCtrl::OnTextMaxLen(wxCommandEvent& event)
+void MyTextCtrl::OnTextMaxLen(wxCommandEvent& WXUNUSED(event))
{
wxLogMessage(_T("You can't enter more characters into this control."));
}
wxPoint(180,170), wxSize(240,70), wxTE_MULTILINE);
m_enter->SetClientData((void *)_T("enter"));
-#if 0
m_textrich = new MyTextCtrl(this, -1, _T("Allows more than 30Kb of text\n")
_T("(even under broken Win9x)\n")
_T("and a very very very very very ")
_T("very very very long line to test ")
_T("wxHSCROLL style"),
wxPoint(450, 10), wxSize(230, 230),
- wxTE_RICH2 |
- wxTE_MULTILINE |
- // wxTE_AUTO_URL |
- wxHSCROLL);
+ wxTE_RICH | wxTE_MULTILINE | wxHSCROLL);
m_textrich->SetStyle(0, 10, *wxRED);
m_textrich->SetStyle(10, 20, *wxBLUE);
m_textrich->SetStyle(30, 40,
m_textrich->SetDefaultStyle(wxTextAttr(*wxBLUE, *wxWHITE));
m_textrich->AppendText(_T("And this should be in blue and the text you ")
_T("type should be in blue as well"));
-#else
- m_textrich = new MyTextCtrl(this, -1, _T(""),
- wxPoint(450, 10), wxSize(230, 230),
- wxTE_RICH2 |
- wxTE_MULTILINE |
- wxHSCROLL);
-#endif
}
void MyPanel::OnSize( wxSizeEvent &event )
{
wxSize client_area( GetClientSize() );
- m_log->SetSize( 0, 260, client_area.x, client_area.y - 260 );
+ if (m_log)
+ m_log->SetSize( 0, 260, client_area.x, client_area.y - 260 );
event.Skip();
}
}
#if wxUSE_TOOLTIPS
-void MyFrame::OnSetTooltipDelay(wxCommandEvent& event)
+
+void MyFrame::OnSetTooltipDelay(wxCommandEvent& WXUNUSED(event))
{
static long s_delay = 5000;
wxLogStatus(this, _T("Tooltip delay set to %ld milliseconds"), s_delay);
}
-void MyFrame::OnToggleTooltips(wxCommandEvent& event)
+void MyFrame::OnToggleTooltips(wxCommandEvent& WXUNUSED(event))
{
static bool s_enabled = TRUE;
m_panel->m_textrich->Enable(enabled);
}
-void MyFrame::OnFileSave(wxCommandEvent& event)
+void MyFrame::OnFileSave(wxCommandEvent& WXUNUSED(event))
{
if ( m_panel->m_textrich->SaveFile(_T("dummy.txt")) )
{
wxLogStatus(this, _T("Couldn't save the file"));
}
-void MyFrame::OnFileLoad(wxCommandEvent& event)
+void MyFrame::OnFileLoad(wxCommandEvent& WXUNUSED(event))
{
if ( m_panel->m_textrich->LoadFile(_T("dummy.txt")) )
wxLogStatus(this, _T("Successfully loaded file"));
wxLogStatus(this, _T("Couldn't load the file"));
}
-void MyFrame::OnRichTextTest(wxCommandEvent& event)
+void MyFrame::OnRichTextTest(wxCommandEvent& WXUNUSED(event))
{
RichTextFrame* frame = new RichTextFrame(this, _T("Rich Text Editor"));
frame->Show(TRUE);
// Event handlers
-void RichTextFrame::OnClose(wxCommandEvent& event)
+void RichTextFrame::OnClose(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
}
-void RichTextFrame::OnLeftAlign(wxCommandEvent& event)
+void RichTextFrame::OnLeftAlign(wxCommandEvent& WXUNUSED(event))
{
wxTextAttr attr;
attr.SetAlignment(wxTEXT_ALIGNMENT_LEFT);
m_currentPosition = -1;
}
-void RichTextFrame::OnRightAlign(wxCommandEvent& event)
+void RichTextFrame::OnRightAlign(wxCommandEvent& WXUNUSED(event))
{
wxTextAttr attr;
attr.SetAlignment(wxTEXT_ALIGNMENT_RIGHT);
m_currentPosition = -1;
}
-void RichTextFrame::OnJustify(wxCommandEvent& event)
+void RichTextFrame::OnJustify(wxCommandEvent& WXUNUSED(event))
{
wxTextAttr attr;
attr.SetAlignment(wxTEXT_ALIGNMENT_JUSTIFIED);
m_currentPosition = -1;
}
-void RichTextFrame::OnCentre(wxCommandEvent& event)
+void RichTextFrame::OnCentre(wxCommandEvent& WXUNUSED(event))
{
wxTextAttr attr;
attr.SetAlignment(wxTEXT_ALIGNMENT_CENTRE);
m_currentPosition = -1;
}
-void RichTextFrame::OnChangeFont(wxCommandEvent& event)
+void RichTextFrame::OnChangeFont(wxCommandEvent& WXUNUSED(event))
{
wxFontData data;
}
}
-void RichTextFrame::OnChangeTextColour(wxCommandEvent& event)
+void RichTextFrame::OnChangeTextColour(wxCommandEvent& WXUNUSED(event))
{
wxColourData data;
data.SetColour(* wxBLACK);
}
}
-void RichTextFrame::OnChangeBackgroundColour(wxCommandEvent& event)
+void RichTextFrame::OnChangeBackgroundColour(wxCommandEvent& WXUNUSED(event))
{
wxColourData data;
data.SetColour(* wxWHITE);
}
}
-void RichTextFrame::OnLeftIndent(wxCommandEvent& event)
+void RichTextFrame::OnLeftIndent(wxCommandEvent& WXUNUSED(event))
{
- wxString indentStr = wxGetTextFromUser(_("Please enter the left indent in tenths of a millimetre."),
- _("Left Indent"));
+ wxString indentStr = wxGetTextFromUser
+ (
+ _("Please enter the left indent in tenths of a millimetre."),
+ _("Left Indent")
+ );
if (!indentStr.IsEmpty())
{
int indent = wxAtoi(indentStr);
}
}
-void RichTextFrame::OnRightIndent(wxCommandEvent& event)
+void RichTextFrame::OnRightIndent(wxCommandEvent& WXUNUSED(event))
{
- wxString indentStr = wxGetTextFromUser(_("Please enter the right indent in tenths of a millimetre."),
- _("Right Indent"));
+ wxString indentStr = wxGetTextFromUser
+ (
+ _("Please enter the right indent in tenths of a millimetre."),
+ _("Right Indent")
+ );
if (!indentStr.IsEmpty())
{
int indent = wxAtoi(indentStr);
}
}
-void RichTextFrame::OnIdle(wxIdleEvent& event)
+void RichTextFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
{
long insertionPoint = m_textCtrl->GetInsertionPoint();
if (insertionPoint != m_currentPosition)