git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31497
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
50 files changed:
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_COMBOBOX(id, func)}}{Process a wxEVT\_COMMAND\_COMBOBOX\_SELECTED event,
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_COMBOBOX(id, func)}}{Process a wxEVT\_COMMAND\_COMBOBOX\_SELECTED event,
-when an item on the list is selected. Note that calling
+when an item on the list is selected. Note that calling
\helpref{GetValue}{wxcomboboxgetvalue} returns the new value of selection.}
\twocolitem{{\bf EVT\_TEXT(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_UPDATED event,
when the combobox text changes.}
\helpref{GetValue}{wxcomboboxgetvalue} returns the new value of selection.}
\twocolitem{{\bf EVT\_TEXT(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_UPDATED event,
when the combobox text changes.}
Returns true if the combobox is editable and the last undo can be redone.
Only available on Windows.
Returns true if the combobox is editable and the last undo can be redone.
Only available on Windows.
\membersection{wxComboBox::CanUndo}\label{wxcomboboxcanundo}
\constfunc{bool}{CanUndo}{\void}
Returns true if the combobox is editable and the last edit can be undone.
Only available on Windows.
\membersection{wxComboBox::CanUndo}\label{wxcomboboxcanundo}
\constfunc{bool}{CanUndo}{\void}
Returns true if the combobox is editable and the last edit can be undone.
Only available on Windows.
\membersection{wxComboBox::Copy}\label{wxcomboboxcopy}
\func{void}{Copy}{\void}
\membersection{wxComboBox::Copy}\label{wxcomboboxcopy}
\func{void}{Copy}{\void}
\membersection{wxComboBox::GetLastPosition}\label{wxcomboboxgetlastposition}
\membersection{wxComboBox::GetLastPosition}\label{wxcomboboxgetlastposition}
-\constfunc{long}{GetLastPosition}{\void}
+\constfunc{virtual wxTextPos}{GetLastPosition}{\void}
Returns the last position in the combobox text field.
Returns the last position in the combobox text field.
\docparam{to}{The second position.}
\pythonnote{This method is called {\tt SetMark} in wxPython, {\tt SetSelection}
\docparam{to}{The second position.}
\pythonnote{This method is called {\tt SetMark} in wxPython, {\tt SetSelection}
\helpref{wxControlWithItems::SetSelection}{wxcontrolwithitemssetselection}.}
\membersection{wxComboBox::SetValue}\label{wxcomboboxsetvalue}
\helpref{wxControlWithItems::SetSelection}{wxcontrolwithitemssetselection}.}
\membersection{wxComboBox::SetValue}\label{wxcomboboxsetvalue}
-The values below are the possible return codes of the
+The values below are the possible return codes of the
\helpref{HitTest}{wxtextctrlhittest} method:
{\small
\begin{verbatim}
\helpref{HitTest}{wxtextctrlhittest} method:
{\small
\begin{verbatim}
\func{void}{SetLeftIndent}{\param{int }{indent}, \param{int }{subIndent = 0}}
Sets the left indent in tenths of a millimetre.
\func{void}{SetLeftIndent}{\param{int }{indent}, \param{int }{subIndent = 0}}
Sets the left indent in tenths of a millimetre.
-subIndent sets the indent for all lines but the first line in a paragraph
+subIndent sets the indent for all lines but the first line in a paragraph
relative to the first line.
relative to the first line.
separated by {\tt $\backslash$n} characters, i.e. in the Unix text format even
on non-Unix platforms. This allows the user code to ignore the differences
between the platforms but at a price: the indices in the control such as those
separated by {\tt $\backslash$n} characters, i.e. in the Unix text format even
on non-Unix platforms. This allows the user code to ignore the differences
between the platforms but at a price: the indices in the control such as those
-returned by \helpref{GetInsertionPoint}{wxtextctrlgetinsertionpoint} or
+returned by \helpref{GetInsertionPoint}{wxtextctrlgetinsertionpoint} or
\helpref{GetSelection}{wxtextctrlgetselection} can {\bf not} be used as
indices into the string returned by \helpref{GetValue}{wxtextctrlgetvalue} as
\helpref{GetSelection}{wxtextctrlgetselection} can {\bf not} be used as
indices into the string returned by \helpref{GetValue}{wxtextctrlgetvalue} as
-they're going to be slightly off for platforms using
+they're going to be slightly off for platforms using
{\tt $\backslash$r$\backslash$n} as separator (as Windows does), for example.
Instead, if you need to obtain a substring between the $2$ indices obtained
from the control with the help of the functions mentioned above, you should
use \helpref{GetRange}{wxtextctrlgetrange}. And the indices themselves can
{\tt $\backslash$r$\backslash$n} as separator (as Windows does), for example.
Instead, if you need to obtain a substring between the $2$ indices obtained
from the control with the help of the functions mentioned above, you should
use \helpref{GetRange}{wxtextctrlgetrange}. And the indices themselves can
-only be passed to other methods, for example
-\helpref{SetInsertionPoint}{wxtextctrlsetinsertionpoint} or
+only be passed to other methods, for example
+\helpref{SetInsertionPoint}{wxtextctrlsetinsertionpoint} or
\helpref{SetSelection}{wxtextctrlsetselection}.
To summarize: never use the indices returned by (multiline) wxTextCtrl as
\helpref{SetSelection}{wxtextctrlsetselection}.
To summarize: never use the indices returned by (multiline) wxTextCtrl as
\func{bool}{EmulateKeyPress}{\param{const wxKeyEvent\& }{event}}
This functions inserts into the control the character which would have been
\func{bool}{EmulateKeyPress}{\param{const wxKeyEvent\& }{event}}
This functions inserts into the control the character which would have been
-inserted if the given key event had occured in the text control. The
+inserted if the given key event had occured in the text control. The
{\it event} object should be the same as the one passed to {\tt EVT\_KEY\_DOWN}
handler previously by wxWidgets.
{\it event} object should be the same as the one passed to {\tt EVT\_KEY\_DOWN}
handler previously by wxWidgets.
\membersection{wxTextCtrl::GetLastPosition}\label{wxtextctrlgetlastposition}
\membersection{wxTextCtrl::GetLastPosition}\label{wxtextctrlgetlastposition}
-\constfunc{virtual long}{GetLastPosition}{\void}
+\constfunc{virtual wxTextPos}{GetLastPosition}{\void}
Returns the zero based index of the last position in the text control,
which is equal to the number of characters in the control.
Returns the zero based index of the last position in the text control,
which is equal to the number of characters in the control.
wxTextCtrl method.
Please note that the positions in a multiline wxTextCtrl do {\bf not}
wxTextCtrl method.
Please note that the positions in a multiline wxTextCtrl do {\bf not}
-correspond to the indices in the string returned by
+correspond to the indices in the string returned by
\helpref{GetValue}{wxtextctrlgetvalue} because of the different new line
representations ({\tt CR} or {\tt CR LF}) and so this method should be used to
obtain the correct results instead of extracting parts of the entire value. It
\helpref{GetValue}{wxtextctrlgetvalue} because of the different new line
representations ({\tt CR} or {\tt CR LF}) and so this method should be used to
obtain the correct results instead of extracting parts of the entire value. It
This function finds the character at the specified position expressed in
pixels. If the return code is not \texttt{wxTE\_HT\_UNKNOWN} the row and column
This function finds the character at the specified position expressed in
pixels. If the return code is not \texttt{wxTE\_HT\_UNKNOWN} the row and column
-of the character closest to this position are returned in the \arg{col} and
+of the character closest to this position are returned in the \arg{col} and
\arg{row} parameters (unless the pointers are {\tt NULL} which is allowed).
Please note that this function is currently only implemented in wxUniv,
\arg{row} parameters (unless the pointers are {\tt NULL} which is allowed).
Please note that this function is currently only implemented in wxUniv,
Returns {\tt true} if the controls contents may be edited by user (note that it
always can be changed by the program), i.e. if the control hasn't been put in
Returns {\tt true} if the controls contents may be edited by user (note that it
always can be changed by the program), i.e. if the control hasn't been put in
-read-only mode by a previous call to
+read-only mode by a previous call to
\helpref{SetEditable}{wxtextctrlseteditable}.
\helpref{SetEditable}{wxtextctrlseteditable}.
\constfunc{bool}{IsModified}{\void}
\constfunc{bool}{IsModified}{\void}
-Returns {\tt true} if the text has been modified by user. Note that calling
+Returns {\tt true} if the text has been modified by user. Note that calling
\helpref{SetValue}{wxtextctrlsetvalue} doesn't make the control modified.
\helpref{SetValue}{wxtextctrlsetvalue} doesn't make the control modified.
% VZ: commenting this out as: (a) the docs are wrong (you can't replace
% anything), (b) wxTextCtrl doesn't have any OnChar() anyhow
%% \membersection{wxTextCtrl::OnChar}\label{wxtextctrlonchar}
% VZ: commenting this out as: (a) the docs are wrong (you can't replace
% anything), (b) wxTextCtrl doesn't have any OnChar() anyhow
%% \membersection{wxTextCtrl::OnChar}\label{wxtextctrlonchar}
%% \func{void}{OnChar}{\param{wxKeyEvent\& }{event}}
%% \func{void}{OnChar}{\param{wxKeyEvent\& }{event}}
%% Default handler for character input.
%% Default handler for character input.
%% It is possible to intercept character
%% input by overriding this member. Call this function
%% to let the default behaviour take place; not calling
%% it results in the character being ignored. You can
%% replace the {\it keyCode} member of {\it event} to
%% translate keystrokes.
%% It is possible to intercept character
%% input by overriding this member. Call this function
%% to let the default behaviour take place; not calling
%% it results in the character being ignored. You can
%% replace the {\it keyCode} member of {\it event} to
%% translate keystrokes.
%% Note that Windows and Motif have different ways
%% of implementing the default behaviour. In Windows,
%% calling wxTextCtrl::OnChar immediately
%% Note that Windows and Motif have different ways
%% of implementing the default behaviour. In Windows,
%% calling wxTextCtrl::OnChar immediately
%% to let default processing happen. This might affect
%% the way in which you write your OnChar function
%% on different platforms.
%% to let default processing happen. This might affect
%% the way in which you write your OnChar function
%% on different platforms.
%% \helpref{wxKeyEvent}{wxkeyevent}
%% \helpref{wxKeyEvent}{wxkeyevent}
\func{virtual void}{SetValue}{\param{const wxString\& }{ value}}
\func{virtual void}{SetValue}{\param{const wxString\& }{ value}}
-Sets the text value and marks the control as not-modified (which means that
+Sets the text value and marks the control as not-modified (which means that
\helpref{IsModified}{wxtextctrlismodified} would return {\tt false} immediately
after the call to SetValue).
\helpref{IsModified}{wxtextctrlismodified} would return {\tt false} immediately
after the call to SetValue).
// Created: 2003/07/14
// RCS-ID: $Id$
// Copyright: (c) 2003 David Elliott
// Created: 2003/07/14
// RCS-ID: $Id$
// Copyright: (c) 2003 David Elliott
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __WX_COCOA_COMBOBOX_H__
#define __WX_COCOA_COMBOBOX_H__
/////////////////////////////////////////////////////////////////////////////
#ifndef __WX_COCOA_COMBOBOX_H__
#define __WX_COCOA_COMBOBOX_H__
-#include "wx/textctrl.h"
-
//#include "wx/cocoa/NSTableView.h"
// ========================================================================
//#include "wx/cocoa/NSTableView.h"
// ========================================================================
{ wxTextCtrl::SetInsertionPointEnd(); }
virtual long GetInsertionPoint() const
{ return wxTextCtrl::GetInsertionPoint(); }
{ wxTextCtrl::SetInsertionPointEnd(); }
virtual long GetInsertionPoint() const
{ return wxTextCtrl::GetInsertionPoint(); }
- virtual long GetLastPosition() const
+ virtual wxTextPos GetLastPosition() const
{ return wxTextCtrl::GetLastPosition(); }
virtual void Replace(long from, long to, const wxString& value)
{ wxTextCtrl::Replace(from,to,value); }
{ return wxTextCtrl::GetLastPosition(); }
virtual void Replace(long from, long to, const wxString& value)
{ wxTextCtrl::Replace(from,to,value); }
// Author: David Elliott
// Modified by:
// Created: 2003/03/16
// Author: David Elliott
// Modified by:
// Created: 2003/03/16
// Copyright: (c) 2003 David Elliott
// Copyright: (c) 2003 David Elliott
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __WX_COCOA_TEXTCTRL_H__
/////////////////////////////////////////////////////////////////////////////
#ifndef __WX_COCOA_TEXTCTRL_H__
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to);
// virtual void SelectAll();
virtual void SetSelection(long from, long to);
// virtual void SelectAll();
// wxComboBoxBase: this interface defines the methods wxComboBox must implement
// ----------------------------------------------------------------------------
// wxComboBoxBase: this interface defines the methods wxComboBox must implement
// ----------------------------------------------------------------------------
+#include "wx/textctrl.h"
#include "wx/ctrlsub.h"
class WXDLLEXPORT wxComboBoxBase : public wxItemContainer
#include "wx/ctrlsub.h"
class WXDLLEXPORT wxComboBoxBase : public wxItemContainer
virtual void Paste() = 0;
virtual void SetInsertionPoint(long pos) = 0;
virtual long GetInsertionPoint() const = 0;
virtual void Paste() = 0;
virtual void SetInsertionPoint(long pos) = 0;
virtual long GetInsertionPoint() const = 0;
- virtual long GetLastPosition() const = 0;
+ virtual wxTextPos GetLastPosition() const = 0;
virtual void Replace(long from, long to, const wxString& value) = 0;
virtual void SetSelection(long from, long to) = 0;
virtual void SetEditable(bool editable) = 0;
virtual void Replace(long from, long to, const wxString& value) = 0;
virtual void SetSelection(long from, long to) = 0;
virtual void SetEditable(bool editable) = 0;
// Created: 01/02/97
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Created: 01/02/97
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void SetInsertionPoint( long pos );
void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
long GetInsertionPoint() const;
void SetInsertionPoint( long pos );
void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
long GetInsertionPoint() const;
- long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
void Replace( long from, long to, const wxString& value );
void SetSelection( long from, long to );
void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
void Replace( long from, long to, const wxString& value );
void SetSelection( long from, long to );
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
- virtual bool Enable( bool enable = TRUE );
+ virtual bool Enable( bool enable = true );
// Implementation from now on
void OnDropFiles( wxDropFilesEvent &event );
// Implementation from now on
void OnDropFiles( wxDropFilesEvent &event );
void UpdateFontIfNeeded();
#endif // __WXGTK20__/!__WXGTK20__
void UpdateFontIfNeeded();
#endif // __WXGTK20__/!__WXGTK20__
- void SetModified() { m_modified = TRUE; }
+ void SetModified() { m_modified = true; }
// GTK+ textctrl is so dumb that you need to freeze/thaw it manually to
// avoid horrible flicker/scrolling back and forth
virtual void Freeze();
virtual void Thaw();
// GTK+ textctrl is so dumb that you need to freeze/thaw it manually to
// avoid horrible flicker/scrolling back and forth
virtual void Freeze();
virtual void Thaw();
// textctrl specific scrolling
virtual bool ScrollLines(int lines);
virtual bool ScrollPages(int pages);
// textctrl specific scrolling
virtual bool ScrollLines(int lines);
virtual bool ScrollPages(int pages);
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
protected:
virtual wxSize DoGetBestSize() const;
protected:
virtual wxSize DoGetBestSize() const;
// has the control been frozen by Freeze()?
bool IsFrozen() const { return m_frozenness > 0; }
#endif
// has the control been frozen by Freeze()?
bool IsFrozen() const { return m_frozenness > 0; }
#endif
private:
// change the font for everything in this control
void ChangeFontGlobally();
private:
// change the font for everything in this control
void ChangeFontGlobally();
// number of calls to Freeze() minus number of calls to Thaw()
unsigned int m_frozenness;
// number of calls to Freeze() minus number of calls to Thaw()
unsigned int m_frozenness;
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxTextCtrl);
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxTextCtrl);
// Created: 01/02/97
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Created: 01/02/97
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void SetInsertionPoint( long pos );
void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
long GetInsertionPoint() const;
void SetInsertionPoint( long pos );
void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
long GetInsertionPoint() const;
- long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
void Replace( long from, long to, const wxString& value );
void SetSelection( long from, long to );
void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
void Replace( long from, long to, const wxString& value );
void SetSelection( long from, long to );
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
- virtual bool Enable( bool enable = TRUE );
+ virtual bool Enable( bool enable = true );
// Implementation from now on
void OnDropFiles( wxDropFilesEvent &event );
// Implementation from now on
void OnDropFiles( wxDropFilesEvent &event );
void UpdateFontIfNeeded();
#endif // __WXGTK20__/!__WXGTK20__
void UpdateFontIfNeeded();
#endif // __WXGTK20__/!__WXGTK20__
- void SetModified() { m_modified = TRUE; }
+ void SetModified() { m_modified = true; }
// GTK+ textctrl is so dumb that you need to freeze/thaw it manually to
// avoid horrible flicker/scrolling back and forth
virtual void Freeze();
virtual void Thaw();
// GTK+ textctrl is so dumb that you need to freeze/thaw it manually to
// avoid horrible flicker/scrolling back and forth
virtual void Freeze();
virtual void Thaw();
// textctrl specific scrolling
virtual bool ScrollLines(int lines);
virtual bool ScrollPages(int pages);
// textctrl specific scrolling
virtual bool ScrollLines(int lines);
virtual bool ScrollPages(int pages);
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
protected:
virtual wxSize DoGetBestSize() const;
protected:
virtual wxSize DoGetBestSize() const;
// has the control been frozen by Freeze()?
bool IsFrozen() const { return m_frozenness > 0; }
#endif
// has the control been frozen by Freeze()?
bool IsFrozen() const { return m_frozenness > 0; }
#endif
private:
// change the font for everything in this control
void ChangeFontGlobally();
private:
// change the font for everything in this control
void ChangeFontGlobally();
// number of calls to Freeze() minus number of calls to Thaw()
unsigned int m_frozenness;
// number of calls to Freeze() minus number of calls to Thaw()
unsigned int m_frozenness;
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxTextCtrl);
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxTextCtrl);
#pragma interface "combobox.h"
#endif
#pragma interface "combobox.h"
#endif
-#include "wx/textctrl.h"
#include "wx/choice.h"
WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr;
#include "wx/choice.h"
WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr;
virtual void DoMoveWindow(int x, int y, int width, int height);
// forward these functions to all subcontrols
virtual void DoMoveWindow(int x, int y, int width, int height);
// forward these functions to all subcontrols
- virtual bool Enable(bool enable = TRUE);
- virtual bool Show(bool show = TRUE);
+ virtual bool Enable(bool enable = true);
+ virtual bool Show(bool show = true);
virtual void SetFocus();
// callback functions
virtual void SetFocus();
// callback functions
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const ;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const ;
- virtual long GetLastPosition() const ;
+ virtual wxTextPos GetLastPosition() const ;
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
class WXDLLEXPORT wxTextCtrl: public wxTextCtrlBase
{
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
class WXDLLEXPORT wxTextCtrl: public wxTextCtrlBase
{
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
public:
// creation
// --------
public:
// creation
// --------
Create(parent, id, value, pos, size, style, validator, name);
}
Create(parent, id, value, pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTextCtrlNameStr);
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTextCtrlNameStr);
// accessors
// ---------
virtual wxString GetValue() const ;
// accessors
// ---------
virtual wxString GetValue() const ;
virtual void Copy();
virtual void Cut();
virtual void Paste();
virtual void Copy();
virtual void Cut();
virtual void Paste();
virtual bool CanCopy() const;
virtual bool CanCut() const;
virtual bool CanPaste() const;
virtual bool CanCopy() const;
virtual bool CanCut() const;
virtual bool CanPaste() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
void OnUpdatePaste(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
void OnUpdatePaste(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
void OnEraseBackground(wxEraseEvent& event) ;
virtual bool MacCanFocus() const { return true ; }
void OnEraseBackground(wxEraseEvent& event) ;
virtual bool MacCanFocus() const { return true ; }
#pragma interface "combobox.h"
#endif
#pragma interface "combobox.h"
#endif
-#include "wx/textctrl.h"
#include "wx/choice.h"
WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr;
#include "wx/choice.h"
WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr;
virtual void DoMoveWindow(int x, int y, int width, int height);
// forward these functions to all subcontrols
virtual void DoMoveWindow(int x, int y, int width, int height);
// forward these functions to all subcontrols
- virtual bool Enable(bool enable = TRUE);
- virtual bool Show(bool show = TRUE);
+ virtual bool Enable(bool enable = true);
+ virtual bool Show(bool show = true);
virtual void SetFocus();
// callback functions
virtual void SetFocus();
// callback functions
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const ;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const ;
- virtual long GetLastPosition() const ;
+ virtual wxTextPos GetLastPosition() const ;
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
class WXDLLEXPORT wxTextCtrl: public wxTextCtrlBase
{
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
class WXDLLEXPORT wxTextCtrl: public wxTextCtrlBase
{
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
public:
// creation
// --------
public:
// creation
// --------
Create(parent, id, value, pos, size, style, validator, name);
}
Create(parent, id, value, pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTextCtrlNameStr);
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTextCtrlNameStr);
// accessors
// ---------
virtual wxString GetValue() const ;
// accessors
// ---------
virtual wxString GetValue() const ;
virtual void Copy();
virtual void Cut();
virtual void Paste();
virtual void Copy();
virtual void Cut();
virtual void Paste();
virtual bool CanCopy() const;
virtual bool CanCut() const;
virtual bool CanPaste() const;
virtual bool CanCopy() const;
virtual bool CanCut() const;
virtual bool CanPaste() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual bool MacSetupCursor( const wxPoint& pt ) ;
virtual void MacSuperShown( bool show ) ;
virtual bool MacSetupCursor( const wxPoint& pt ) ;
virtual void MacSuperShown( bool show ) ;
- virtual bool Show(bool show = TRUE) ;
+ virtual bool Show(bool show = true) ;
protected:
// common part of all ctors
protected:
// common part of all ctors
void* m_macTXNvars ;
bool m_macUsesTXN ;
unsigned long m_maxLength ;
void* m_macTXNvars ;
bool m_macUsesTXN ;
unsigned long m_maxLength ;
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COMBOBOX_H_
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COMBOBOX_H_
class WXDLLEXPORT wxComboBox: public wxChoice
{
DECLARE_DYNAMIC_CLASS(wxComboBox)
class WXDLLEXPORT wxComboBox: public wxChoice
{
DECLARE_DYNAMIC_CLASS(wxComboBox)
public:
wxComboBox() { m_inSetSelection = false; }
~wxComboBox();
public:
wxComboBox() { m_inSetSelection = false; }
~wxComboBox();
inline wxComboBox(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
inline wxComboBox(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
Create(parent, id, value, pos, size, n, choices,
style, validator, name);
}
Create(parent, id, value, pos, size, n, choices,
style, validator, name);
}
inline wxComboBox(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
inline wxComboBox(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
Create(parent, id, value, pos, size, choices,
style, validator, name);
}
Create(parent, id, value, pos, size, choices,
style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr);
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr);
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr);
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr);
// implementation of wxControlWithItems
virtual int DoAppend(const wxString& item);
virtual int DoInsert(const wxString& item, int pos);
// implementation of wxControlWithItems
virtual int DoAppend(const wxString& item);
virtual int DoInsert(const wxString& item, int pos);
// Text field functions
virtual wxString GetValue() const ;
virtual void SetValue(const wxString& value);
// Text field functions
virtual wxString GetValue() const ;
virtual void SetValue(const wxString& value);
// Clipboard operations
virtual void Copy();
virtual void Cut();
// Clipboard operations
virtual void Copy();
virtual void Cut();
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const ;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const ;
- virtual long GetLastPosition() const ;
+ virtual wxTextPos GetLastPosition() const ;
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
- virtual void ChangeFont(bool keepOriginalSize = TRUE);
+ virtual void ChangeFont(bool keepOriginalSize = true);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const { return m_mainWidget; }
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const { return m_mainWidget; }
class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase
{
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase
{
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
public:
// creation
// --------
public:
// creation
// --------
{
Create(parent, id, value, pos, size, style, validator, name);
}
{
Create(parent, id, value, pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTextCtrlNameStr);
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTextCtrlNameStr);
// accessors
// ---------
virtual wxString GetValue() const;
virtual void SetValue(const wxString& value);
// accessors
// ---------
virtual wxString GetValue() const;
virtual void SetValue(const wxString& value);
virtual int GetLineLength(long lineNo) const;
virtual wxString GetLineText(long lineNo) const;
virtual int GetNumberOfLines() const;
virtual int GetLineLength(long lineNo) const;
virtual wxString GetLineText(long lineNo) const;
virtual int GetNumberOfLines() const;
// operations
// ----------
// operations
// ----------
// Clipboard operations
virtual void Copy();
virtual void Cut();
// Clipboard operations
virtual void Copy();
virtual void Cut();
virtual bool CanCopy() const;
virtual bool CanCut() const;
virtual bool CanPaste() const;
virtual bool CanCopy() const;
virtual bool CanCut() const;
virtual bool CanPaste() const;
// Undo/redo
virtual void Undo();
virtual void Redo();
// Undo/redo
virtual void Undo();
virtual void Redo();
virtual bool CanUndo() const;
virtual bool CanRedo() const;
virtual bool CanUndo() const;
virtual bool CanRedo() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
// selection.
virtual void GetSelection(long* from, long* to) const;
virtual bool IsEditable() const ;
// selection.
virtual void GetSelection(long* from, long* to) const;
virtual bool IsEditable() const ;
virtual void WriteText(const wxString& text);
virtual void AppendText(const wxString& text);
virtual void MarkDirty();
virtual void DiscardEdits();
virtual bool IsModified() const;
virtual void WriteText(const wxString& text);
virtual void AppendText(const wxString& text);
virtual void MarkDirty();
virtual void DiscardEdits();
virtual bool IsModified() const;
virtual long XYToPosition(long x, long y) const;
virtual bool PositionToXY(long pos, long *x, long *y) const;
virtual void ShowPosition(long pos);
virtual void Clear();
virtual long XYToPosition(long x, long y) const;
virtual bool PositionToXY(long pos, long *x, long *y) const;
virtual void ShowPosition(long pos);
virtual void Clear();
// callbacks
// ---------
void OnDropFiles(wxDropFilesEvent& event);
void OnChar(wxKeyEvent& event);
// void OnEraseBackground(wxEraseEvent& event);
// callbacks
// ---------
void OnDropFiles(wxDropFilesEvent& event);
void OnChar(wxKeyEvent& event);
// void OnEraseBackground(wxEraseEvent& event);
void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);
void OnPaste(wxCommandEvent& event);
void OnUndo(wxCommandEvent& event);
void OnRedo(wxCommandEvent& event);
void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);
void OnPaste(wxCommandEvent& event);
void OnUndo(wxCommandEvent& event);
void OnRedo(wxCommandEvent& event);
void OnUpdateCut(wxUpdateUIEvent& event);
void OnUpdateCopy(wxUpdateUIEvent& event);
void OnUpdatePaste(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
void OnUpdateCut(wxUpdateUIEvent& event);
void OnUpdateCopy(wxUpdateUIEvent& event);
void OnUpdatePaste(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
virtual void Command(wxCommandEvent& event);
virtual void Command(wxCommandEvent& event);
// implementation from here to the end
// -----------------------------------
// implementation from here to the end
// -----------------------------------
- virtual void ChangeFont(bool keepOriginalSize = TRUE);
+ virtual void ChangeFont(bool keepOriginalSize = true);
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
void SetModified(bool mod) { m_modified = mod; }
virtual WXWidget GetTopWidget() const;
virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour();
void SetModified(bool mod) { m_modified = mod; }
virtual WXWidget GetTopWidget() const;
// send the CHAR and TEXT_UPDATED events
void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs,
long keycode);
// send the CHAR and TEXT_UPDATED events
void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs,
long keycode);
protected:
wxString m_fileName;
protected:
wxString m_fileName;
void* m_tempCallbackStruct;
bool m_modified;
wxString m_value; // Required for password text controls
void* m_tempCallbackStruct;
bool m_modified;
wxString m_value; // Required for password text controls
// Did we call wxTextCtrl::OnChar? If so, generate a command event.
bool m_processedDefault;
// Did we call wxTextCtrl::OnChar? If so, generate a command event.
bool m_processedDefault;
private:
DECLARE_EVENT_TABLE()
};
private:
DECLARE_EVENT_TABLE()
};
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/wince/textctrlce.h
/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/wince/textctrlce.h
-// Purpose: wxTextCtrl implementation for smart phones driven by WinCE
+// Purpose: wxTextCtrl implementation for smart phones driven by WinCE
// Author: Wlodzimierz ABX Skiba
// Modified by:
// Created: 30.08.2004
// Author: Wlodzimierz ABX Skiba
// Modified by:
// Created: 30.08.2004
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual void SetInsertionPoint(long lPos);
virtual void SetInsertionPointEnd(void);
virtual long GetInsertionPoint(void) const;
virtual void SetInsertionPoint(long lPos);
virtual void SetInsertionPointEnd(void);
virtual long GetInsertionPoint(void) const;
- virtual long GetLastPosition(void) const;
+ virtual wxTextPos GetLastPosition(void) const;
virtual void Replace( long lFrom
,long lTo
,const wxString& rsValue
virtual void Replace( long lFrom
,long lTo
,const wxString& rsValue
virtual void SetInsertionPoint(long lPos);
virtual void SetInsertionPointEnd(void);
virtual long GetInsertionPoint(void) const;
virtual void SetInsertionPoint(long lPos);
virtual void SetInsertionPointEnd(void);
virtual long GetInsertionPoint(void) const;
- virtual long GetLastPosition(void) const;
+ virtual wxTextPos GetLastPosition(void) const;
virtual void SetSelection( long lFrom
,long lTo
virtual void SetSelection( long lFrom
,long lTo
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
WXDLLEXPORT_DATA(extern const wxChar*) wxTextCtrlNameStr;
WXDLLEXPORT_DATA(extern const wxChar*) wxTextCtrlNameStr;
+// this is intentionally not enum to avoid warning fixes with
+// typecasting from enum type to wxTextCoord
+const wxTextCoord wxOutOfRangeTextCoord = -1;
+const wxTextCoord wxInvalidTextCoord = -2;
+
// ----------------------------------------------------------------------------
// wxTextCtrl style flags
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxTextCtrl style flags
// ----------------------------------------------------------------------------
virtual void SetInsertionPoint(long pos) = 0;
virtual void SetInsertionPointEnd() = 0;
virtual long GetInsertionPoint() const = 0;
virtual void SetInsertionPoint(long pos) = 0;
virtual void SetInsertionPointEnd() = 0;
virtual long GetInsertionPoint() const = 0;
- virtual long GetLastPosition() const = 0;
+ virtual wxTextPos GetLastPosition() const = 0;
virtual void SetSelection(long from, long to) = 0;
virtual void SelectAll();
virtual void SetSelection(long from, long to) = 0;
virtual void SelectAll();
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to);
virtual void Redo() {}
virtual bool CanUndo() const { return (m_undos.GetCount() > 0); }
virtual void Redo() {}
virtual bool CanUndo() const { return (m_undos.GetCount() > 0); }
- virtual bool CanRedo() const { return FALSE; }
+ virtual bool CanRedo() const { return false; }
// Insertion point
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
// Insertion point
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
- virtual long GetLastPosition() const;
+ virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
- virtual bool Enable( bool enable = TRUE );
+ virtual bool Enable( bool enable = true );
void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);
void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);
bool SetForegroundColour(const wxColour& colour);
bool SetBackgroundColour(const wxColour& colour);
bool SetForegroundColour(const wxColour& colour);
bool SetBackgroundColour(const wxColour& colour);
- void SetModified() { m_modified = TRUE; }
+ void SetModified() { m_modified = true; }
virtual void Freeze();
virtual void Thaw();
virtual void Freeze();
virtual void Thaw();
void OnInternalIdle();
void RefreshLine( int n );
void RefreshDown( int n );
void OnInternalIdle();
void RefreshLine( int n );
void RefreshDown( int n );
- void MoveCursor( int new_x, int new_y, bool shift = FALSE, bool centre = FALSE );
+ void MoveCursor( int new_x, int new_y, bool shift = false, bool centre = false );
void MyAdjustScrollbars();
protected:
void MyAdjustScrollbars();
protected:
// wxTextCtrl types
// ----------------------------------------------------------------------------
// wxTextCtrl types
// ----------------------------------------------------------------------------
-// wxTextPos is the position in the text
-typedef long wxTextPos;
-
-// wxTextCoord is the line or row number (which should have been unsigned but
-// is long for backwards compatibility)
-typedef long wxTextCoord;
-
class WXDLLEXPORT wxStdTextCtrlInputHandler : public wxStdInputHandler
{
public:
class WXDLLEXPORT wxStdTextCtrlInputHandler : public wxStdInputHandler
{
public:
virtual bool HandleKey(wxInputConsumer *consumer,
const wxKeyEvent& event,
virtual bool HandleKey(wxInputConsumer *consumer,
const wxKeyEvent& event,
- bool pressed) { return FALSE; }
- virtual bool HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { return FALSE; }
- virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { return FALSE; }
- virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) { return FALSE; }
+ bool pressed) { return false; }
+ virtual bool HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { return false; }
+ virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { return false; }
+ virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) { return false; }
protected:
// get the position of the mouse click
protected:
// get the position of the mouse click
// Created: 2003/03/16
// RCS-ID: $Id:
// Copyright: (c) 2003 David Elliott
// Created: 2003/03/16
// RCS-ID: $Id:
// Copyright: (c) 2003 David Elliott
-// Licence: wxWidgets licence
+// Licence: wxWidgets licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
-long wxTextCtrl::GetLastPosition() const
+wxTextPos wxTextCtrl::GetLastPosition() const
bool wxTextCtrlBase::SaveFile(const wxString& filename)
{
bool wxTextCtrlBase::SaveFile(const wxString& filename)
{
- wxString filenameToUse = filename.IsEmpty() ? m_filename : filename;
+ wxString filenameToUse = filename.empty() ? m_filename : filename;
if ( filenameToUse.empty() )
{
// what kind of message to give? is it an error or a program bug?
if ( filenameToUse.empty() )
{
// what kind of message to give? is it an error or a program bug?
case WXK_NUMPAD_DELETE:
// delete the character at cursor
{
case WXK_NUMPAD_DELETE:
// delete the character at cursor
{
- const long pos = GetInsertionPoint(),
- last = GetLastPosition();
- if ( pos < last )
+ const long pos = GetInsertionPoint();
+ if ( pos < GetLastPosition() )
Remove(pos, pos + 1);
}
break;
Remove(pos, pos + 1);
}
break;
// remove selection (WriteText is in fact ReplaceSelection)
#ifdef __WXMSW__
// remove selection (WriteText is in fact ReplaceSelection)
#ifdef __WXMSW__
- long nLen = pText->GetLastPosition();
+ wxTextPos nLen = pText->GetLastPosition();
pText->SetSelection(nLen, nLen);
#endif // Windows
pText->SetSelection(nLen, nLen);
#endif // Windows
if (combo->m_ignoreNextUpdate)
{
if (combo->m_ignoreNextUpdate)
{
- combo->m_ignoreNextUpdate = FALSE;
+ combo->m_ignoreNextUpdate = false;
static void
gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
static void
gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
// when the popup is hidden, throw a SELECTED event only if the combobox
// selection changed.
int curSelection = combo->GetSelection();
// when the popup is hidden, throw a SELECTED event only if the combobox
// selection changed.
int curSelection = combo->GetSelection();
event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event );
}
event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event );
}
// reset the selection flag to an identifiable value
g_SelectionBeforePopup = -1;
}
// reset the selection flag to an identifiable value
g_SelectionBeforePopup = -1;
}
long style, const wxValidator& validator,
const wxString& name )
{
long style, const wxValidator& validator,
const wxString& name )
{
- m_ignoreNextUpdate = FALSE;
- m_needParent = TRUE;
- m_acceptsFocus = TRUE;
+ m_ignoreNextUpdate = false;
+ m_needParent = true;
+ m_acceptsFocus = true;
m_prevSelection = 0;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxComboBox creation failed") );
m_prevSelection = 0;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxComboBox creation failed") );
}
m_widget = gtk_combo_new();
}
m_widget = gtk_combo_new();
gtk_signal_disconnect( GTK_OBJECT(combo->entry), combo->entry_change_id );
// ... and add surogate handler.
combo->entry_change_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "changed",
gtk_signal_disconnect( GTK_OBJECT(combo->entry), combo->entry_change_id );
// ... and add surogate handler.
combo->entry_change_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "changed",
- (GtkSignalFunc) gtk_dummy_callback, combo);
+ (GtkSignalFunc) gtk_dummy_callback, combo);
// make it more useable
gtk_combo_set_use_arrows_always( GTK_COMBO(m_widget), TRUE );
// make it more useable
gtk_combo_set_use_arrows_always( GTK_COMBO(m_widget), TRUE );
if (style & wxNO_BORDER)
g_object_set( GTK_ENTRY( combo->entry ), "has-frame", FALSE, NULL );
#endif
if (style & wxNO_BORDER)
g_object_set( GTK_ENTRY( combo->entry ), "has-frame", FALSE, NULL );
#endif
GtkWidget *list = GTK_COMBO(m_widget)->list;
#ifndef __WXGTK20__
GtkWidget *list = GTK_COMBO(m_widget)->list;
#ifndef __WXGTK20__
// "show" and "hide" events are generated when user click on the combobox button which popups a list
// this list is the "popwin" gtk widget
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(combo)->popwin), "hide",
// "show" and "hide" events are generated when user click on the combobox button which popups a list
// this list is the "popwin" gtk widget
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(combo)->popwin), "hide",
- GTK_SIGNAL_FUNC(gtk_popup_hide_callback), (gpointer)this );
+ GTK_SIGNAL_FUNC(gtk_popup_hide_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(combo)->popwin), "show",
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(combo)->popwin), "show",
- GTK_SIGNAL_FUNC(gtk_popup_show_callback), (gpointer)this );
+ GTK_SIGNAL_FUNC(gtk_popup_show_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(combo->entry), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(combo->entry), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this );
wxSize setsize = GetSize();
gtk_widget_set_usize( m_widget, setsize.x, setsize.y );
wxSize setsize = GetSize();
gtk_widget_set_usize( m_widget, setsize.x, setsize.y );
}
wxComboBox::~wxComboBox()
}
wxComboBox::~wxComboBox()
return (long) GET_EDITABLE_POS( GTK_COMBO(m_widget)->entry );
}
return (long) GET_EDITABLE_POS( GTK_COMBO(m_widget)->entry );
}
-long wxComboBox::GetLastPosition() const
+wxTextPos wxComboBox::GetLastPosition() const
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length;
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length;
void wxTextCtrl::Init()
{
m_ignoreNextUpdate =
void wxTextCtrl::Init()
{
m_ignoreNextUpdate =
- m_modified = FALSE;
- SetUpdateFont(FALSE);
+ m_modified = false;
+ SetUpdateFont(false);
m_text =
m_vScrollbar = (GtkWidget *)NULL;
#ifdef __WXGTK20__
m_frozenness = 0;
m_text =
m_vScrollbar = (GtkWidget *)NULL;
#ifdef __WXGTK20__
m_frozenness = 0;
}
wxTextCtrl::wxTextCtrl( wxWindow *parent,
}
wxTextCtrl::wxTextCtrl( wxWindow *parent,
const wxValidator& validator,
const wxString &name )
{
const wxValidator& validator,
const wxString &name )
{
- m_needParent = TRUE;
- m_acceptsFocus = TRUE;
+ m_needParent = true;
+ m_acceptsFocus = true;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxTextCtrl creation failed") );
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxTextCtrl creation failed") );
- m_vScrollbarVisible = FALSE;
+ m_vScrollbarVisible = false;
bool multi_line = (style & wxTE_MULTILINE) != 0;
bool multi_line = (style & wxTE_MULTILINE) != 0;
if (!HasFlag(wxNO_BORDER))
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN );
if (!HasFlag(wxNO_BORDER))
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
#else
// create our control ...
m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
// ... and put into the upper left hand corner of the table
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
#else
// create our control ...
m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
// ... and put into the upper left hand corner of the table
- bool bHasHScrollbar = FALSE;
+ bool bHasHScrollbar = false;
m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1,
m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1,
m_widget =
m_text = gtk_entry_new();
m_widget =
m_text = gtk_entry_new();
if (style & wxNO_BORDER)
g_object_set( GTK_ENTRY(m_text), "has-frame", FALSE, NULL );
#endif
if (style & wxNO_BORDER)
g_object_set( GTK_ENTRY(m_text), "has-frame", FALSE, NULL );
#endif
{
#ifdef __WXGTK20__
SetValue( value );
{
#ifdef __WXGTK20__
SetValue( value );
#endif
}
#endif // __WXGTK20__
#endif
}
#endif // __WXGTK20__
// We want to be notified about text changes.
#ifdef __WXGTK20__
if (multi_line)
// We want to be notified about text changes.
#ifdef __WXGTK20__
if (multi_line)
{
gtk_signal_connect( GTK_OBJECT(m_text), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
{
gtk_signal_connect( GTK_OBJECT(m_text), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
wxTextAttr attrDef(GetForegroundColour(), GetBackgroundColour(), GetFont());
SetDefaultStyle( attrDef );
wxTextAttr attrDef(GetForegroundColour(), GetBackgroundColour(), GetFont());
SetDefaultStyle( attrDef );
if (m_vScrollbarVisible)
{
gtk_widget_hide( m_vScrollbar );
if (m_vScrollbarVisible)
{
gtk_widget_hide( m_vScrollbar );
- m_vScrollbarVisible = FALSE;
+ m_vScrollbarVisible = false;
if (!m_vScrollbarVisible)
{
gtk_widget_show( m_vScrollbar );
if (!m_vScrollbarVisible)
{
gtk_widget_show( m_vScrollbar );
- m_vScrollbarVisible = TRUE;
+ m_vScrollbarVisible = true;
// customize this behaviour.
SetInsertionPoint(0);
// customize this behaviour.
SetInsertionPoint(0);
}
void wxTextCtrl::WriteText( const wxString &text )
}
void wxTextCtrl::WriteText( const wxString &text )
// in UpdateFontIfNeeded() any longer
if ( !text.empty() )
{
// in UpdateFontIfNeeded() any longer
if ( !text.empty() )
{
}
// Bring editable's cursor back uptodate.
}
// Bring editable's cursor back uptodate.
// cast to prevent warning. But pos really should've been unsigned.
if( (unsigned long)pos > text.Len() )
// cast to prevent warning. But pos really should've been unsigned.
if( (unsigned long)pos > text.Len() )
*x=0; // First Col
*y=0; // First Line
*x=0; // First Col
*y=0; // First Line
else
{
// index out of bounds
else
{
// index out of bounds
}
long wxTextCtrl::XYToPosition(long x, long y ) const
}
long wxTextCtrl::XYToPosition(long x, long y ) const
if (!wxWindowBase::Enable(enable))
{
// nothing to do
if (!wxWindowBase::Enable(enable))
{
// nothing to do
}
if (m_windowStyle & wxTE_MULTILINE)
}
if (m_windowStyle & wxTE_MULTILINE)
gtk_widget_set_sensitive( m_text, enable );
}
gtk_widget_set_sensitive( m_text, enable );
}
}
// wxGTK-specific: called recursively by Enable,
}
// wxGTK-specific: called recursively by Enable,
void wxTextCtrl::MarkDirty()
{
void wxTextCtrl::MarkDirty()
{
}
void wxTextCtrl::DiscardEdits()
{
}
void wxTextCtrl::DiscardEdits()
{
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
void wxTextCtrl::IgnoreNextTextUpdate()
{
void wxTextCtrl::IgnoreNextTextUpdate()
{
- m_ignoreNextUpdate = TRUE;
+ m_ignoreNextUpdate = true;
}
bool wxTextCtrl::IgnoreTextUpdate()
{
if ( m_ignoreNextUpdate )
{
}
bool wxTextCtrl::IgnoreTextUpdate()
{
if ( m_ignoreNextUpdate )
{
- m_ignoreNextUpdate = FALSE;
+ m_ignoreNextUpdate = false;
}
void wxTextCtrl::SetMaxLength(unsigned long len)
}
void wxTextCtrl::SetMaxLength(unsigned long len)
-long wxTextCtrl::GetLastPosition() const
+wxTextPos wxTextCtrl::GetLastPosition() const
{
wxCHECK_MSG( m_text != NULL, 0, wxT("invalid text ctrl") );
{
wxCHECK_MSG( m_text != NULL, 0, wxT("invalid text ctrl") );
{
#ifdef __WXGTK20__
SetInsertionPoint( from );
{
#ifdef __WXGTK20__
SetInsertionPoint( from );
{
// TODO
//wxFAIL_MSG( wxT("wxTextCtrl::CanUndo not implemented") );
{
// TODO
//wxFAIL_MSG( wxT("wxTextCtrl::CanUndo not implemented") );
}
bool wxTextCtrl::CanRedo() const
{
// TODO
//wxFAIL_MSG( wxT("wxTextCtrl::CanRedo not implemented") );
}
bool wxTextCtrl::CanRedo() const
{
// TODO
//wxFAIL_MSG( wxT("wxTextCtrl::CanRedo not implemented") );
}
// If the return values from and to are the same, there is no
}
// If the return values from and to are the same, there is no
gint from = -1;
gint to = -1;
gint from = -1;
gint to = -1;
- bool haveSelection = FALSE;
+ bool haveSelection = false;
#ifdef __WXGTK20__
if (m_windowStyle & wxTE_MULTILINE)
#ifdef __WXGTK20__
if (m_windowStyle & wxTE_MULTILINE)
GtkTextIter ifrom, ito;
if ( gtk_text_buffer_get_selection_bounds(m_buffer, &ifrom, &ito) )
{
GtkTextIter ifrom, ito;
if ( gtk_text_buffer_get_selection_bounds(m_buffer, &ifrom, &ito) )
{
from = gtk_text_iter_get_offset(&ifrom);
to = gtk_text_iter_get_offset(&ito);
}
from = gtk_text_iter_get_offset(&ifrom);
to = gtk_text_iter_get_offset(&ito);
}
if ( gtk_editable_get_selection_bounds( GTK_EDITABLE(m_text),
&from, &to) )
{
if ( gtk_editable_get_selection_bounds( GTK_EDITABLE(m_text),
&from, &to) )
{
}
}
#else // not GTK2
if ( (GTK_EDITABLE(m_text)->has_selection) )
{
}
}
#else // not GTK2
if ( (GTK_EDITABLE(m_text)->has_selection) )
{
from = (long) GTK_EDITABLE(m_text)->selection_start_pos;
to = (long) GTK_EDITABLE(m_text)->selection_end_pos;
}
from = (long) GTK_EDITABLE(m_text)->selection_start_pos;
to = (long) GTK_EDITABLE(m_text)->selection_end_pos;
}
bool wxTextCtrl::IsEditable() const
{
bool wxTextCtrl::IsEditable() const
{
- wxCHECK_MSG( m_text != NULL, FALSE, wxT("invalid text ctrl") );
+ wxCHECK_MSG( m_text != NULL, false, wxT("invalid text ctrl") );
#ifdef __WXGTK20__
if (m_windowStyle & wxTE_MULTILINE)
#ifdef __WXGTK20__
if (m_windowStyle & wxTE_MULTILINE)
// the font will change for subsequent text insertiongs
bool wxTextCtrl::SetFont( const wxFont &font )
{
// the font will change for subsequent text insertiongs
bool wxTextCtrl::SetFont( const wxFont &font )
{
- wxCHECK_MSG( m_text != NULL, FALSE, wxT("invalid text ctrl") );
+ wxCHECK_MSG( m_text != NULL, false, wxT("invalid text ctrl") );
if ( !wxTextCtrlBase::SetFont(font) )
{
// font didn't change, nothing to do
if ( !wxTextCtrlBase::SetFont(font) )
{
// font didn't change, nothing to do
}
if ( m_windowStyle & wxTE_MULTILINE )
{
}
if ( m_windowStyle & wxTE_MULTILINE )
{
m_defaultStyle.SetFont(font);
ChangeFontGlobally();
}
m_defaultStyle.SetFont(font);
ChangeFontGlobally();
}
}
void wxTextCtrl::ChangeFontGlobally()
}
void wxTextCtrl::ChangeFontGlobally()
#endif
wxString value = GetValue();
#endif
wxString value = GetValue();
- if ( !value.IsEmpty() )
Clear();
AppendText(value);
Clear();
AppendText(value);
bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
{
if ( !wxControl::SetForegroundColour(colour) )
bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
{
if ( !wxControl::SetForegroundColour(colour) )
// update default fg colour too
m_defaultStyle.SetTextColour(colour);
// update default fg colour too
m_defaultStyle.SetTextColour(colour);
}
bool wxTextCtrl::SetBackgroundColour( const wxColour &colour )
{
}
bool wxTextCtrl::SetBackgroundColour( const wxColour &colour )
{
- wxCHECK_MSG( m_text != NULL, FALSE, wxT("invalid text ctrl") );
+ wxCHECK_MSG( m_text != NULL, false, wxT("invalid text ctrl") );
if ( !wxControl::SetBackgroundColour( colour ) )
if ( !wxControl::SetBackgroundColour( colour ) )
#ifndef __WXGTK20__
if (!m_widget->window)
#ifndef __WXGTK20__
if (!m_widget->window)
#endif
if (!m_backgroundColour.Ok())
#endif
if (!m_backgroundColour.Ok())
if (m_windowStyle & wxTE_MULTILINE)
{
#ifndef __WXGTK20__
GdkWindow *window = GTK_TEXT(m_text)->text_area;
if (!window)
if (m_windowStyle & wxTE_MULTILINE)
{
#ifndef __WXGTK20__
GdkWindow *window = GTK_TEXT(m_text)->text_area;
if (!window)
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
gdk_window_set_background( window, m_backgroundColour.GetColor() );
gdk_window_clear( window );
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
gdk_window_set_background( window, m_backgroundColour.GetColor() );
gdk_window_clear( window );
// change active background color too
m_defaultStyle.SetBackgroundColour( colour );
// change active background color too
m_defaultStyle.SetBackgroundColour( colour );
}
bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
}
bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
if ( style.IsDefault() )
{
// nothing to do
if ( style.IsDefault() )
{
// nothing to do
}
#ifdef __WXGTK20__
gint l = gtk_text_buffer_get_char_count( m_buffer );
}
#ifdef __WXGTK20__
gint l = gtk_text_buffer_get_char_count( m_buffer );
- wxCHECK_MSG( start >= 0 && end <= l, FALSE,
+ wxCHECK_MSG( start >= 0 && end <= l, false,
_T("invalid range in wxTextCtrl::SetStyle") );
GtkTextIter starti, endi;
_T("invalid range in wxTextCtrl::SetStyle") );
GtkTextIter starti, endi;
wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi );
wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi );
#else
// VERY dirty way to do that - removes the required text and re-adds it
// with styling (FIXME)
gint l = gtk_text_get_length( GTK_TEXT(m_text) );
#else
// VERY dirty way to do that - removes the required text and re-adds it
// with styling (FIXME)
gint l = gtk_text_get_length( GTK_TEXT(m_text) );
- wxCHECK_MSG( start >= 0 && end <= l, FALSE,
+ wxCHECK_MSG( start >= 0 && end <= l, false,
_T("invalid range in wxTextCtrl::SetStyle") );
gint old_pos = gtk_editable_get_position( GTK_EDITABLE(m_text) );
_T("invalid range in wxTextCtrl::SetStyle") );
gint old_pos = gtk_editable_get_position( GTK_EDITABLE(m_text) );
gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */
SetInsertionPoint( old_pos );
#endif
gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */
SetInsertionPoint( old_pos );
#endif
}
else // singe line
{
// cannot do this for GTK+'s Entry widget
}
else // singe line
{
// cannot do this for GTK+'s Entry widget
if ( fabs(adj->value - value) < 0.2 )
{
// well, this is what Robert does in wxScrollBar, so it must be good...
if ( fabs(adj->value - value) < 0.2 )
{
// well, this is what Robert does in wxScrollBar, so it must be good...
gtk_signal_emit_by_name(GTK_OBJECT(adj), "value_changed");
#endif
gtk_signal_emit_by_name(GTK_OBJECT(adj), "value_changed");
#endif
}
bool wxTextCtrl::ScrollLines(int lines)
{
GtkAdjustment *adj = GetVAdj();
if ( !adj )
}
bool wxTextCtrl::ScrollLines(int lines)
{
GtkAdjustment *adj = GetVAdj();
if ( !adj )
#ifdef __WXGTK20__
int diff = (int)ceil(lines*adj->step_increment);
#ifdef __WXGTK20__
int diff = (int)ceil(lines*adj->step_increment);
{
GtkAdjustment *adj = GetVAdj();
if ( !adj )
{
GtkAdjustment *adj = GetVAdj();
if ( !adj )
return DoScroll(adj, (int)ceil(pages*adj->page_increment));
}
return DoScroll(adj, (int)ceil(pages*adj->page_increment));
}
if (combo->m_ignoreNextUpdate)
{
if (combo->m_ignoreNextUpdate)
{
- combo->m_ignoreNextUpdate = FALSE;
+ combo->m_ignoreNextUpdate = false;
static void
gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
static void
gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
// when the popup is hidden, throw a SELECTED event only if the combobox
// selection changed.
int curSelection = combo->GetSelection();
// when the popup is hidden, throw a SELECTED event only if the combobox
// selection changed.
int curSelection = combo->GetSelection();
event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event );
}
event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event );
}
// reset the selection flag to an identifiable value
g_SelectionBeforePopup = -1;
}
// reset the selection flag to an identifiable value
g_SelectionBeforePopup = -1;
}
long style, const wxValidator& validator,
const wxString& name )
{
long style, const wxValidator& validator,
const wxString& name )
{
- m_ignoreNextUpdate = FALSE;
- m_needParent = TRUE;
- m_acceptsFocus = TRUE;
+ m_ignoreNextUpdate = false;
+ m_needParent = true;
+ m_acceptsFocus = true;
m_prevSelection = 0;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxComboBox creation failed") );
m_prevSelection = 0;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxComboBox creation failed") );
}
m_widget = gtk_combo_new();
}
m_widget = gtk_combo_new();
gtk_signal_disconnect( GTK_OBJECT(combo->entry), combo->entry_change_id );
// ... and add surogate handler.
combo->entry_change_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "changed",
gtk_signal_disconnect( GTK_OBJECT(combo->entry), combo->entry_change_id );
// ... and add surogate handler.
combo->entry_change_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "changed",
- (GtkSignalFunc) gtk_dummy_callback, combo);
+ (GtkSignalFunc) gtk_dummy_callback, combo);
// make it more useable
gtk_combo_set_use_arrows_always( GTK_COMBO(m_widget), TRUE );
// make it more useable
gtk_combo_set_use_arrows_always( GTK_COMBO(m_widget), TRUE );
if (style & wxNO_BORDER)
g_object_set( GTK_ENTRY( combo->entry ), "has-frame", FALSE, NULL );
#endif
if (style & wxNO_BORDER)
g_object_set( GTK_ENTRY( combo->entry ), "has-frame", FALSE, NULL );
#endif
GtkWidget *list = GTK_COMBO(m_widget)->list;
#ifndef __WXGTK20__
GtkWidget *list = GTK_COMBO(m_widget)->list;
#ifndef __WXGTK20__
// "show" and "hide" events are generated when user click on the combobox button which popups a list
// this list is the "popwin" gtk widget
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(combo)->popwin), "hide",
// "show" and "hide" events are generated when user click on the combobox button which popups a list
// this list is the "popwin" gtk widget
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(combo)->popwin), "hide",
- GTK_SIGNAL_FUNC(gtk_popup_hide_callback), (gpointer)this );
+ GTK_SIGNAL_FUNC(gtk_popup_hide_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(combo)->popwin), "show",
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(combo)->popwin), "show",
- GTK_SIGNAL_FUNC(gtk_popup_show_callback), (gpointer)this );
+ GTK_SIGNAL_FUNC(gtk_popup_show_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(combo->entry), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(combo->entry), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this );
wxSize setsize = GetSize();
gtk_widget_set_usize( m_widget, setsize.x, setsize.y );
wxSize setsize = GetSize();
gtk_widget_set_usize( m_widget, setsize.x, setsize.y );
}
wxComboBox::~wxComboBox()
}
wxComboBox::~wxComboBox()
return (long) GET_EDITABLE_POS( GTK_COMBO(m_widget)->entry );
}
return (long) GET_EDITABLE_POS( GTK_COMBO(m_widget)->entry );
}
-long wxComboBox::GetLastPosition() const
+wxTextPos wxComboBox::GetLastPosition() const
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length;
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length;
void wxTextCtrl::Init()
{
m_ignoreNextUpdate =
void wxTextCtrl::Init()
{
m_ignoreNextUpdate =
- m_modified = FALSE;
- SetUpdateFont(FALSE);
+ m_modified = false;
+ SetUpdateFont(false);
m_text =
m_vScrollbar = (GtkWidget *)NULL;
#ifdef __WXGTK20__
m_frozenness = 0;
m_text =
m_vScrollbar = (GtkWidget *)NULL;
#ifdef __WXGTK20__
m_frozenness = 0;
}
wxTextCtrl::wxTextCtrl( wxWindow *parent,
}
wxTextCtrl::wxTextCtrl( wxWindow *parent,
const wxValidator& validator,
const wxString &name )
{
const wxValidator& validator,
const wxString &name )
{
- m_needParent = TRUE;
- m_acceptsFocus = TRUE;
+ m_needParent = true;
+ m_acceptsFocus = true;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxTextCtrl creation failed") );
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
wxFAIL_MSG( wxT("wxTextCtrl creation failed") );
- m_vScrollbarVisible = FALSE;
+ m_vScrollbarVisible = false;
bool multi_line = (style & wxTE_MULTILINE) != 0;
bool multi_line = (style & wxTE_MULTILINE) != 0;
if (!HasFlag(wxNO_BORDER))
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN );
if (!HasFlag(wxNO_BORDER))
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
#else
// create our control ...
m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
// ... and put into the upper left hand corner of the table
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
#else
// create our control ...
m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
// ... and put into the upper left hand corner of the table
- bool bHasHScrollbar = FALSE;
+ bool bHasHScrollbar = false;
m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1,
m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1,
m_widget =
m_text = gtk_entry_new();
m_widget =
m_text = gtk_entry_new();
if (style & wxNO_BORDER)
g_object_set( GTK_ENTRY(m_text), "has-frame", FALSE, NULL );
#endif
if (style & wxNO_BORDER)
g_object_set( GTK_ENTRY(m_text), "has-frame", FALSE, NULL );
#endif
{
#ifdef __WXGTK20__
SetValue( value );
{
#ifdef __WXGTK20__
SetValue( value );
#endif
}
#endif // __WXGTK20__
#endif
}
#endif // __WXGTK20__
// We want to be notified about text changes.
#ifdef __WXGTK20__
if (multi_line)
// We want to be notified about text changes.
#ifdef __WXGTK20__
if (multi_line)
{
gtk_signal_connect( GTK_OBJECT(m_text), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
{
gtk_signal_connect( GTK_OBJECT(m_text), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
wxTextAttr attrDef(GetForegroundColour(), GetBackgroundColour(), GetFont());
SetDefaultStyle( attrDef );
wxTextAttr attrDef(GetForegroundColour(), GetBackgroundColour(), GetFont());
SetDefaultStyle( attrDef );
if (m_vScrollbarVisible)
{
gtk_widget_hide( m_vScrollbar );
if (m_vScrollbarVisible)
{
gtk_widget_hide( m_vScrollbar );
- m_vScrollbarVisible = FALSE;
+ m_vScrollbarVisible = false;
if (!m_vScrollbarVisible)
{
gtk_widget_show( m_vScrollbar );
if (!m_vScrollbarVisible)
{
gtk_widget_show( m_vScrollbar );
- m_vScrollbarVisible = TRUE;
+ m_vScrollbarVisible = true;
// customize this behaviour.
SetInsertionPoint(0);
// customize this behaviour.
SetInsertionPoint(0);
}
void wxTextCtrl::WriteText( const wxString &text )
}
void wxTextCtrl::WriteText( const wxString &text )
// in UpdateFontIfNeeded() any longer
if ( !text.empty() )
{
// in UpdateFontIfNeeded() any longer
if ( !text.empty() )
{
}
// Bring editable's cursor back uptodate.
}
// Bring editable's cursor back uptodate.
// cast to prevent warning. But pos really should've been unsigned.
if( (unsigned long)pos > text.Len() )
// cast to prevent warning. But pos really should've been unsigned.
if( (unsigned long)pos > text.Len() )
*x=0; // First Col
*y=0; // First Line
*x=0; // First Col
*y=0; // First Line
else
{
// index out of bounds
else
{
// index out of bounds
}
long wxTextCtrl::XYToPosition(long x, long y ) const
}
long wxTextCtrl::XYToPosition(long x, long y ) const
if (!wxWindowBase::Enable(enable))
{
// nothing to do
if (!wxWindowBase::Enable(enable))
{
// nothing to do
}
if (m_windowStyle & wxTE_MULTILINE)
}
if (m_windowStyle & wxTE_MULTILINE)
gtk_widget_set_sensitive( m_text, enable );
}
gtk_widget_set_sensitive( m_text, enable );
}
}
// wxGTK-specific: called recursively by Enable,
}
// wxGTK-specific: called recursively by Enable,
void wxTextCtrl::MarkDirty()
{
void wxTextCtrl::MarkDirty()
{
}
void wxTextCtrl::DiscardEdits()
{
}
void wxTextCtrl::DiscardEdits()
{
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
void wxTextCtrl::IgnoreNextTextUpdate()
{
void wxTextCtrl::IgnoreNextTextUpdate()
{
- m_ignoreNextUpdate = TRUE;
+ m_ignoreNextUpdate = true;
}
bool wxTextCtrl::IgnoreTextUpdate()
{
if ( m_ignoreNextUpdate )
{
}
bool wxTextCtrl::IgnoreTextUpdate()
{
if ( m_ignoreNextUpdate )
{
- m_ignoreNextUpdate = FALSE;
+ m_ignoreNextUpdate = false;
}
void wxTextCtrl::SetMaxLength(unsigned long len)
}
void wxTextCtrl::SetMaxLength(unsigned long len)
-long wxTextCtrl::GetLastPosition() const
+wxTextPos wxTextCtrl::GetLastPosition() const
{
wxCHECK_MSG( m_text != NULL, 0, wxT("invalid text ctrl") );
{
wxCHECK_MSG( m_text != NULL, 0, wxT("invalid text ctrl") );
{
#ifdef __WXGTK20__
SetInsertionPoint( from );
{
#ifdef __WXGTK20__
SetInsertionPoint( from );
{
// TODO
//wxFAIL_MSG( wxT("wxTextCtrl::CanUndo not implemented") );
{
// TODO
//wxFAIL_MSG( wxT("wxTextCtrl::CanUndo not implemented") );
}
bool wxTextCtrl::CanRedo() const
{
// TODO
//wxFAIL_MSG( wxT("wxTextCtrl::CanRedo not implemented") );
}
bool wxTextCtrl::CanRedo() const
{
// TODO
//wxFAIL_MSG( wxT("wxTextCtrl::CanRedo not implemented") );
}
// If the return values from and to are the same, there is no
}
// If the return values from and to are the same, there is no
gint from = -1;
gint to = -1;
gint from = -1;
gint to = -1;
- bool haveSelection = FALSE;
+ bool haveSelection = false;
#ifdef __WXGTK20__
if (m_windowStyle & wxTE_MULTILINE)
#ifdef __WXGTK20__
if (m_windowStyle & wxTE_MULTILINE)
GtkTextIter ifrom, ito;
if ( gtk_text_buffer_get_selection_bounds(m_buffer, &ifrom, &ito) )
{
GtkTextIter ifrom, ito;
if ( gtk_text_buffer_get_selection_bounds(m_buffer, &ifrom, &ito) )
{
from = gtk_text_iter_get_offset(&ifrom);
to = gtk_text_iter_get_offset(&ito);
}
from = gtk_text_iter_get_offset(&ifrom);
to = gtk_text_iter_get_offset(&ito);
}
if ( gtk_editable_get_selection_bounds( GTK_EDITABLE(m_text),
&from, &to) )
{
if ( gtk_editable_get_selection_bounds( GTK_EDITABLE(m_text),
&from, &to) )
{
}
}
#else // not GTK2
if ( (GTK_EDITABLE(m_text)->has_selection) )
{
}
}
#else // not GTK2
if ( (GTK_EDITABLE(m_text)->has_selection) )
{
from = (long) GTK_EDITABLE(m_text)->selection_start_pos;
to = (long) GTK_EDITABLE(m_text)->selection_end_pos;
}
from = (long) GTK_EDITABLE(m_text)->selection_start_pos;
to = (long) GTK_EDITABLE(m_text)->selection_end_pos;
}
bool wxTextCtrl::IsEditable() const
{
bool wxTextCtrl::IsEditable() const
{
- wxCHECK_MSG( m_text != NULL, FALSE, wxT("invalid text ctrl") );
+ wxCHECK_MSG( m_text != NULL, false, wxT("invalid text ctrl") );
#ifdef __WXGTK20__
if (m_windowStyle & wxTE_MULTILINE)
#ifdef __WXGTK20__
if (m_windowStyle & wxTE_MULTILINE)
// the font will change for subsequent text insertiongs
bool wxTextCtrl::SetFont( const wxFont &font )
{
// the font will change for subsequent text insertiongs
bool wxTextCtrl::SetFont( const wxFont &font )
{
- wxCHECK_MSG( m_text != NULL, FALSE, wxT("invalid text ctrl") );
+ wxCHECK_MSG( m_text != NULL, false, wxT("invalid text ctrl") );
if ( !wxTextCtrlBase::SetFont(font) )
{
// font didn't change, nothing to do
if ( !wxTextCtrlBase::SetFont(font) )
{
// font didn't change, nothing to do
}
if ( m_windowStyle & wxTE_MULTILINE )
{
}
if ( m_windowStyle & wxTE_MULTILINE )
{
m_defaultStyle.SetFont(font);
ChangeFontGlobally();
}
m_defaultStyle.SetFont(font);
ChangeFontGlobally();
}
}
void wxTextCtrl::ChangeFontGlobally()
}
void wxTextCtrl::ChangeFontGlobally()
#endif
wxString value = GetValue();
#endif
wxString value = GetValue();
- if ( !value.IsEmpty() )
Clear();
AppendText(value);
Clear();
AppendText(value);
bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
{
if ( !wxControl::SetForegroundColour(colour) )
bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
{
if ( !wxControl::SetForegroundColour(colour) )
// update default fg colour too
m_defaultStyle.SetTextColour(colour);
// update default fg colour too
m_defaultStyle.SetTextColour(colour);
}
bool wxTextCtrl::SetBackgroundColour( const wxColour &colour )
{
}
bool wxTextCtrl::SetBackgroundColour( const wxColour &colour )
{
- wxCHECK_MSG( m_text != NULL, FALSE, wxT("invalid text ctrl") );
+ wxCHECK_MSG( m_text != NULL, false, wxT("invalid text ctrl") );
if ( !wxControl::SetBackgroundColour( colour ) )
if ( !wxControl::SetBackgroundColour( colour ) )
#ifndef __WXGTK20__
if (!m_widget->window)
#ifndef __WXGTK20__
if (!m_widget->window)
#endif
if (!m_backgroundColour.Ok())
#endif
if (!m_backgroundColour.Ok())
if (m_windowStyle & wxTE_MULTILINE)
{
#ifndef __WXGTK20__
GdkWindow *window = GTK_TEXT(m_text)->text_area;
if (!window)
if (m_windowStyle & wxTE_MULTILINE)
{
#ifndef __WXGTK20__
GdkWindow *window = GTK_TEXT(m_text)->text_area;
if (!window)
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
gdk_window_set_background( window, m_backgroundColour.GetColor() );
gdk_window_clear( window );
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
gdk_window_set_background( window, m_backgroundColour.GetColor() );
gdk_window_clear( window );
// change active background color too
m_defaultStyle.SetBackgroundColour( colour );
// change active background color too
m_defaultStyle.SetBackgroundColour( colour );
}
bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
}
bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
if ( style.IsDefault() )
{
// nothing to do
if ( style.IsDefault() )
{
// nothing to do
}
#ifdef __WXGTK20__
gint l = gtk_text_buffer_get_char_count( m_buffer );
}
#ifdef __WXGTK20__
gint l = gtk_text_buffer_get_char_count( m_buffer );
- wxCHECK_MSG( start >= 0 && end <= l, FALSE,
+ wxCHECK_MSG( start >= 0 && end <= l, false,
_T("invalid range in wxTextCtrl::SetStyle") );
GtkTextIter starti, endi;
_T("invalid range in wxTextCtrl::SetStyle") );
GtkTextIter starti, endi;
wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi );
wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi );
#else
// VERY dirty way to do that - removes the required text and re-adds it
// with styling (FIXME)
gint l = gtk_text_get_length( GTK_TEXT(m_text) );
#else
// VERY dirty way to do that - removes the required text and re-adds it
// with styling (FIXME)
gint l = gtk_text_get_length( GTK_TEXT(m_text) );
- wxCHECK_MSG( start >= 0 && end <= l, FALSE,
+ wxCHECK_MSG( start >= 0 && end <= l, false,
_T("invalid range in wxTextCtrl::SetStyle") );
gint old_pos = gtk_editable_get_position( GTK_EDITABLE(m_text) );
_T("invalid range in wxTextCtrl::SetStyle") );
gint old_pos = gtk_editable_get_position( GTK_EDITABLE(m_text) );
gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */
SetInsertionPoint( old_pos );
#endif
gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */
SetInsertionPoint( old_pos );
#endif
}
else // singe line
{
// cannot do this for GTK+'s Entry widget
}
else // singe line
{
// cannot do this for GTK+'s Entry widget
if ( fabs(adj->value - value) < 0.2 )
{
// well, this is what Robert does in wxScrollBar, so it must be good...
if ( fabs(adj->value - value) < 0.2 )
{
// well, this is what Robert does in wxScrollBar, so it must be good...
gtk_signal_emit_by_name(GTK_OBJECT(adj), "value_changed");
#endif
gtk_signal_emit_by_name(GTK_OBJECT(adj), "value_changed");
#endif
}
bool wxTextCtrl::ScrollLines(int lines)
{
GtkAdjustment *adj = GetVAdj();
if ( !adj )
}
bool wxTextCtrl::ScrollLines(int lines)
{
GtkAdjustment *adj = GetVAdj();
if ( !adj )
#ifdef __WXGTK20__
int diff = (int)ceil(lines*adj->step_increment);
#ifdef __WXGTK20__
int diff = (int)ceil(lines*adj->step_increment);
{
GtkAdjustment *adj = GetVAdj();
if ( !adj )
{
GtkAdjustment *adj = GetVAdj();
if ( !adj )
return DoScroll(adj, (int)ceil(pages*adj->page_increment));
}
return DoScroll(adj, (int)ceil(pages*adj->page_increment));
}
protected:
void OnChar( wxKeyEvent& event )
{
protected:
void OnChar( wxKeyEvent& event )
{
- // Allows processing the tab key to go to the next control
- if (event.GetKeyCode() == WXK_TAB)
- {
- wxNavigationKeyEvent NavEvent;
- NavEvent.SetEventObject(this);
- NavEvent.SetDirection(true);
- NavEvent.SetWindowChange(false);
-
- // Get the parent of the combo and have it process the navigation?
- if (m_cb->GetParent()->GetEventHandler()->ProcessEvent(NavEvent))
+ // Allows processing the tab key to go to the next control
+ if (event.GetKeyCode() == WXK_TAB)
+ {
+ wxNavigationKeyEvent NavEvent;
+ NavEvent.SetEventObject(this);
+ NavEvent.SetDirection(true);
+ NavEvent.SetWindowChange(false);
+
+ // Get the parent of the combo and have it process the navigation?
+ if (m_cb->GetParent()->GetEventHandler()->ProcessEvent(NavEvent))
if ( event.GetKeyCode() == WXK_RETURN )
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_cb->GetId());
if ( event.GetKeyCode() == WXK_RETURN )
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_cb->GetId());
bool wxComboBox::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
bool wxComboBox::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
}
bool wxComboBox::Show(bool show)
{
if ( !wxControl::Show(show) )
}
bool wxComboBox::Show(bool show)
{
if ( !wxControl::Show(show) )
}
void wxComboBox::SetFocus()
}
void wxComboBox::SetFocus()
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
wxDefaultValidator, name) )
{
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
wxDefaultValidator, name) )
{
}
m_choice = new wxComboBoxChoice(this, style );
}
m_choice = new wxComboBoxChoice(this, style );
SetBestSize(size); // Needed because it is a wxControlWithItems
SetBestSize(size); // Needed because it is a wxControlWithItems
}
wxString wxComboBox::GetValue() const
}
wxString wxComboBox::GetValue() const
-long wxComboBox::GetLastPosition() const
+wxTextPos wxComboBox::GetLastPosition() const
if (s > -1)
{
SetSelection (s);
if (s > -1)
{
SetSelection (s);
}
void wxComboBox::SetString(int n, const wxString& s)
}
void wxComboBox::SetString(int n, const wxString& s)
bool wxComboBox::IsEditable() const
{
bool wxComboBox::IsEditable() const
{
- return m_text != NULL && !HasFlag(wxCB_READONLY);
+ return m_text != NULL && !HasFlag(wxCB_READONLY);
}
void wxComboBox::Undo()
}
void wxComboBox::Undo()
#include "wx/mac/uma.h"
#if TARGET_API_MAC_OSX
#ifndef __HIVIEW__
#include "wx/mac/uma.h"
#if TARGET_API_MAC_OSX
#ifndef __HIVIEW__
- #include <HIToolbox/HIView.h>
+ #include <HIToolbox/HIView.h>
wxSize wxComboBox::DoGetBestSize() const
{
#if USE_HICOMBOBOX
wxSize wxComboBox::DoGetBestSize() const
{
#if USE_HICOMBOBOX
- return wxControl::DoGetBestSize();
+ return wxControl::DoGetBestSize();
#else
wxSize size = m_choice->GetBestSize();
#else
wxSize size = m_choice->GetBestSize();
void wxComboBox::DoMoveWindow(int x, int y, int width, int height) {
#if USE_HICOMBOBOX
void wxComboBox::DoMoveWindow(int x, int y, int width, int height) {
#if USE_HICOMBOBOX
- wxControl::DoMoveWindow(x, y, width, height);
+ wxControl::DoMoveWindow(x, y, width, height);
#else
height = POPUPHEIGHT;
#else
height = POPUPHEIGHT;
bool wxComboBox::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
bool wxComboBox::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
}
bool wxComboBox::Show(bool show)
{
if ( !wxControl::Show(show) )
}
bool wxComboBox::Show(bool show)
{
if ( !wxControl::Show(show) )
}
void wxComboBox::SetFocus()
{
#if USE_HICOMBOBOX
}
void wxComboBox::SetFocus()
{
#if USE_HICOMBOBOX
#else
if ( m_text != NULL) {
m_text->SetFocus();
#else
if ( m_text != NULL) {
m_text->SetFocus();
m_text = NULL;
m_choice = NULL;
#if USE_HICOMBOBOX
m_text = NULL;
m_choice = NULL;
#if USE_HICOMBOBOX
- m_macIsUserPane = FALSE ;
+ m_macIsUserPane = false ;
#endif
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
wxDefaultValidator, name) )
{
#endif
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
wxDefaultValidator, name) )
{
}
#if USE_HICOMBOBOX
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
}
#if USE_HICOMBOBOX
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
//hiRect.size.width = bounds.right - bounds.left;
//hiRect.size.height = bounds.bottom - bounds.top;
//printf("left = %d, right = %d, top = %d, bottom = %d\n", bounds.left, bounds.right, bounds.top, bounds.bottom);
//hiRect.size.width = bounds.right - bounds.left;
//hiRect.size.height = bounds.bottom - bounds.top;
//printf("left = %d, right = %d, top = %d, bottom = %d\n", bounds.left, bounds.right, bounds.top, bounds.bottom);
- //printf("x = %d, y = %d, width = %d, height = %d\n", hibounds.origin.x, hibounds.origin.y, hibounds.size.width, hibounds.size.height);
- m_peer = new wxMacControl() ;
+ //printf("x = %d, y = %d, width = %d, height = %d\n", hibounds.origin.x, hibounds.origin.y, hibounds.size.width, hibounds.size.height);
+ m_peer = new wxMacControl() ;
verify_noerr( HIComboBoxCreate( &hiRect, CFSTR(""), NULL, NULL, kHIComboBoxStandardAttributes, *m_peer ) );
verify_noerr( HIComboBoxCreate( &hiRect, CFSTR(""), NULL, NULL, kHIComboBoxStandardAttributes, *m_peer ) );
SetBestSize(csize); // Needed because it is a wxControlWithItems
#endif
SetBestSize(csize); // Needed because it is a wxControlWithItems
#endif
}
wxString wxComboBox::GetValue() const
}
wxString wxComboBox::GetValue() const
-long wxComboBox::GetLastPosition() const
+wxTextPos wxComboBox::GetLastPosition() const
int wxComboBox::GetCount() const {
#if USE_HICOMBOBOX
int wxComboBox::GetCount() const {
#if USE_HICOMBOBOX
- return (int) HIComboBoxGetItemCount( *m_peer );
+ return (int) HIComboBoxGetItemCount( *m_peer );
- return m_choice->GetCount() ;
+ return m_choice->GetCount() ;
#if USE_HICOMBOBOX
for( int i = 0 ; i < GetCount() ; i++ )
{
#if USE_HICOMBOBOX
for( int i = 0 ; i < GetCount() ; i++ )
{
- if ( GetString( i ).IsSameAs(s, FALSE) )
+ if ( GetString( i ).IsSameAs(s, false) )
return i ;
}
return wxNOT_FOUND ;
return i ;
}
return wxNOT_FOUND ;
if (s > -1)
{
SetSelection (s);
if (s > -1)
{
SetSelection (s);
}
void wxComboBox::SetString(int n, const wxString& s)
}
void wxComboBox::SetString(int n, const wxString& s)
bool wxComboBox::IsEditable() const
{
#if USE_HICOMBOBOX
bool wxComboBox::IsEditable() const
{
#if USE_HICOMBOBOX
- // TODO
- return !HasFlag(wxCB_READONLY);
+ // TODO
+ return !HasFlag(wxCB_READONLY);
- return m_text != NULL && !HasFlag(wxCB_READONLY);
+ return m_text != NULL && !HasFlag(wxCB_READONLY);
#endif
}
void wxComboBox::Undo()
{
#if USE_HICOMBOBOX
#endif
}
void wxComboBox::Undo()
{
#if USE_HICOMBOBOX
#else
if (m_text != NULL)
m_text->Undo();
#else
if (m_text != NULL)
m_text->Undo();
void wxComboBox::Redo()
{
#if USE_HICOMBOBOX
void wxComboBox::Redo()
{
#if USE_HICOMBOBOX
#else
if (m_text != NULL)
m_text->Redo();
#else
if (m_text != NULL)
m_text->Redo();
void wxComboBox::SelectAll()
{
#if USE_HICOMBOBOX
void wxComboBox::SelectAll()
{
#if USE_HICOMBOBOX
#else
if (m_text != NULL)
m_text->SelectAll();
#else
if (m_text != NULL)
m_text->SelectAll();
bool wxComboBox::CanCopy() const
{
#if USE_HICOMBOBOX
bool wxComboBox::CanCopy() const
{
#if USE_HICOMBOBOX
- // TODO
- return false;
+ // TODO
+ return false;
#else
if (m_text != NULL)
return m_text->CanCopy();
#else
if (m_text != NULL)
return m_text->CanCopy();
bool wxComboBox::CanCut() const
{
#if USE_HICOMBOBOX
bool wxComboBox::CanCut() const
{
#if USE_HICOMBOBOX
- // TODO
- return false;
+ // TODO
+ return false;
#else
if (m_text != NULL)
return m_text->CanCut();
#else
if (m_text != NULL)
return m_text->CanCut();
bool wxComboBox::CanPaste() const
{
#if USE_HICOMBOBOX
bool wxComboBox::CanPaste() const
{
#if USE_HICOMBOBOX
- // TODO
- return false;
+ // TODO
+ return false;
#else
if (m_text != NULL)
return m_text->CanPaste();
#else
if (m_text != NULL)
return m_text->CanPaste();
bool wxComboBox::CanUndo() const
{
#if USE_HICOMBOBOX
bool wxComboBox::CanUndo() const
{
#if USE_HICOMBOBOX
- // TODO
- return false;
+ // TODO
+ return false;
#else
if (m_text != NULL)
return m_text->CanUndo();
#else
if (m_text != NULL)
return m_text->CanUndo();
bool wxComboBox::CanRedo() const
{
#if USE_HICOMBOBOX
bool wxComboBox::CanRedo() const
{
#if USE_HICOMBOBOX
- // TODO
- return false;
+ // TODO
+ return false;
#else
if (m_text != NULL)
return m_text->CanRedo();
#else
if (m_text != NULL)
return m_text->CanRedo();
wxMacFunctor(){}
virtual ~wxMacFunctor() {}
virtual void* operator()() = 0 ;
wxMacFunctor(){}
virtual ~wxMacFunctor() {}
virtual void* operator()() = 0 ;
- static void* CallBackProc(void *param)
+ static void* CallBackProc(void *param)
{
wxMacFunctor* f = (wxMacFunctor*) param ;
void *result = (*f)() ;
{
wxMacFunctor* f = (wxMacFunctor*) param ;
void *result = (*f)() ;
{
typedef void (classtype::*function)( param1type p1 ) ;
typedef void (classtype::*ref_function)( const param1type& p1 ) ;
{
typedef void (classtype::*function)( param1type p1 ) ;
typedef void (classtype::*ref_function)( const param1type& p1 ) ;
wxMacObjectFunctor1( classtype *obj , function f , param1type p1 ) :
wxMacFunctor( )
{
wxMacObjectFunctor1( classtype *obj , function f , param1type p1 ) :
wxMacFunctor( )
{
}
~wxMacObjectFunctor1() {}
}
~wxMacObjectFunctor1() {}
-
- virtual void* operator()()
+
+ virtual void* operator()()
{
(m_object->*m_function)(m_param1) ;
return NULL ;
{
(m_object->*m_function)(m_param1) ;
return NULL ;
-template<typename classtype, typename param1type>
+template<typename classtype, typename param1type>
void* wxMacMPRemoteCall( classtype *object , void (classtype::*function)( param1type p1 ) , param1type p1 )
{
void* wxMacMPRemoteCall( classtype *object , void (classtype::*function)( param1type p1 ) , param1type p1 )
{
- wxMacObjectFunctor1<classtype,param1type> params(object,function,p1) ;
- void *result =
+ wxMacObjectFunctor1<classtype,param1type> params(object,function,p1) ;
+ void *result =
MPRemoteCall( wxMacFunctor::CallBackProc , ¶ms , kMPOwningProcessRemoteContext ) ;
return result ;
}
MPRemoteCall( wxMacFunctor::CallBackProc , ¶ms , kMPOwningProcessRemoteContext ) ;
return result ;
}
-template<typename classtype, typename param1type>
+template<typename classtype, typename param1type>
void* wxMacMPRemoteCall( classtype *object , void (classtype::*function)( const param1type& p1 ) , param1type p1 )
{
void* wxMacMPRemoteCall( classtype *object , void (classtype::*function)( const param1type& p1 ) , param1type p1 )
{
- wxMacObjectFunctor1<classtype,param1type> params(object,function,p1) ;
- void *result =
+ wxMacObjectFunctor1<classtype,param1type> params(object,function,p1) ;
+ void *result =
MPRemoteCall( wxMacFunctor::CallBackProc , ¶ms , kMPOwningProcessRemoteContext ) ;
return result ;
}
MPRemoteCall( wxMacFunctor::CallBackProc , ¶ms , kMPOwningProcessRemoteContext ) ;
return result ;
}
-template<typename classtype, typename param1type>
+template<typename classtype, typename param1type>
void* wxMacMPRemoteGUICall( classtype *object , void (classtype::*function)( param1type p1 ) , param1type p1 )
{
wxMutexGuiLeave() ;
void* wxMacMPRemoteGUICall( classtype *object , void (classtype::*function)( param1type p1 ) , param1type p1 )
{
wxMutexGuiLeave() ;
-template<typename classtype, typename param1type>
+template<typename classtype, typename param1type>
void* wxMacMPRemoteGUICall( classtype *object , void (classtype::*function)( const param1type& p1 ) , param1type p1 )
{
wxMutexGuiLeave() ;
void* wxMacMPRemoteGUICall( classtype *object , void (classtype::*function)( const param1type& p1 ) , param1type p1 )
{
wxMutexGuiLeave() ;
public :
wxMacTextControl() ;
~wxMacTextControl() ;
public :
wxMacTextControl() ;
~wxMacTextControl() ;
virtual wxString GetStringValue() const = 0 ;
virtual void SetStringValue( const wxString &val ) = 0 ;
virtual void SetStyle(long start, long end, const wxTextAttr& style) ;
virtual wxString GetStringValue() const = 0 ;
virtual void SetStringValue( const wxString &val ) = 0 ;
virtual void SetStyle(long start, long end, const wxTextAttr& style) ;
virtual void Paste() ;
virtual bool CanPaste() const ;
virtual void SetEditable(bool editable) ;
virtual void Paste() ;
virtual bool CanPaste() const ;
virtual void SetEditable(bool editable) ;
- virtual long GetLastPosition() const ;
+ virtual wxTextPos GetLastPosition() const ;
virtual void Replace( long from , long to , const wxString str ) ;
virtual void Remove( long from , long to ) = 0 ;
virtual void SetSelection( long from , long to ) = 0 ;
virtual void Replace( long from , long to , const wxString str ) ;
virtual void Remove( long from , long to ) = 0 ;
virtual void SetSelection( long from , long to ) = 0 ;
virtual void Clear() ;
virtual bool CanUndo() const;
virtual void Clear() ;
virtual bool CanUndo() const;
virtual bool CanRedo() const;
virtual void Redo() ;
virtual int GetNumberOfLines() const ;
virtual bool CanRedo() const;
virtual void Redo() ;
virtual int GetNumberOfLines() const ;
public :
virtual wxString GetStringValue() const ;
virtual void SetStringValue( const wxString &str) ;
public :
virtual wxString GetStringValue() const ;
virtual void SetStringValue( const wxString &str) ;
static TXNFrameOptions FrameOptionsFromWXStyle( long wxStyle ) ;
void AdjustCreationAttributes( const wxColour& background , bool visible ) ;
static TXNFrameOptions FrameOptionsFromWXStyle( long wxStyle ) ;
void AdjustCreationAttributes( const wxColour& background , bool visible ) ;
virtual void Paste() ;
virtual bool CanPaste() const ;
virtual void SetEditable(bool editable) ;
virtual void Paste() ;
virtual bool CanPaste() const ;
virtual void SetEditable(bool editable) ;
- virtual long GetLastPosition() const ;
+ virtual wxTextPos GetLastPosition() const ;
virtual void Replace( long from , long to , const wxString str ) ;
virtual void Remove( long from , long to ) ;
virtual void GetSelection( long* from, long* to) const ;
virtual void SetSelection( long from , long to ) ;
virtual void Replace( long from , long to , const wxString str ) ;
virtual void Remove( long from , long to ) ;
virtual void GetSelection( long* from, long* to) const ;
virtual void SetSelection( long from , long to ) ;
virtual void WriteText(const wxString& str) ;
virtual void Clear() ;
virtual void WriteText(const wxString& str) ;
virtual void Clear() ;
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
-class wxMacMLTEHIViewControl : public wxMacMLTEControl
+class wxMacMLTEHIViewControl : public wxMacMLTEControl
{
public :
wxMacMLTEHIViewControl( wxWindow *wxPeer,
{
public :
wxMacMLTEHIViewControl( wxWindow *wxPeer,
const wxValidator& validator,
const wxString& name)
{
const wxValidator& validator,
const wxString& name)
{
- m_macIsUserPane = FALSE ;
+ m_macIsUserPane = false ;
m_editable = true ;
if ( ! ( style & wxNO_BORDER) )
style = ( style & ~wxBORDER_MASK) | wxSUNKEN_BORDER ;
m_editable = true ;
if ( ! ( style & wxNO_BORDER) )
style = ( style & ~wxBORDER_MASK) | wxSUNKEN_BORDER ;
if ( !wxTextCtrlBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) )
if ( !wxTextCtrlBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) )
- Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
if ( m_windowStyle & wxTE_MULTILINE )
{
if ( m_windowStyle & wxTE_MULTILINE )
{
#endif
#if !wxMAC_AWAYS_USE_MLTE
if ( !m_peer )
#endif
#if !wxMAC_AWAYS_USE_MLTE
if ( !m_peer )
m_peer = new wxMacUnicodeTextControl( this , str , pos , size , style ) ;
}
#endif
m_peer = new wxMacUnicodeTextControl( this , str , pos , size , style ) ;
}
#endif
if ( !HasFlag(wxNO_BORDER) )
{
m_windowStyle &= ~wxSUNKEN_BORDER ;
if ( !HasFlag(wxNO_BORDER) )
{
m_windowStyle &= ~wxSUNKEN_BORDER ;
- bounds = wxMacGetBoundsForControl( this , pos , size ) ;
- }
+ bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ }
m_peer = new wxMacMLTEClassicControl( this , str , pos , size , style ) ;
}
m_peer = new wxMacMLTEClassicControl( this , str , pos , size , style ) ;
}
{
SetEditable( false ) ;
}
{
SetEditable( false ) ;
}
-void wxTextCtrl::MacVisibilityChanged()
+void wxTextCtrl::MacVisibilityChanged()
{
GetPeer()->VisibilityChanged( MacIsReallyShown() ) ;
}
{
GetPeer()->VisibilityChanged( MacIsReallyShown() ) ;
}
-void wxTextCtrl::MacEnabledStateChanged()
+void wxTextCtrl::MacEnabledStateChanged()
}
void wxTextCtrl::GetSelection(long* from, long* to) const
}
void wxTextCtrl::GetSelection(long* from, long* to) const
GetPeer()->GetSelection( from , to ) ;
}
GetPeer()->GetSelection( from , to ) ;
}
bool wxTextCtrl::SetFont( const wxFont& font )
{
if ( !wxTextCtrlBase::SetFont( font ) )
bool wxTextCtrl::SetFont( const wxFont& font )
{
if ( !wxTextCtrlBase::SetFont( font ) )
GetPeer()->SetFont( font , GetForegroundColour() , GetWindowStyle() ) ;
return true ;
}
GetPeer()->SetFont( font , GetForegroundColour() , GetWindowStyle() ) ;
return true ;
}
{
wxTextCtrlBase::SetDefaultStyle( style ) ;
SetStyle( kTXNUseCurrentSelection , kTXNUseCurrentSelection , GetDefaultStyle() ) ;
{
wxTextCtrlBase::SetDefaultStyle( style ) ;
SetStyle( kTXNUseCurrentSelection , kTXNUseCurrentSelection , GetDefaultStyle() ) ;
}
// Clipboard operations
}
// Clipboard operations
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
event.SetEventObject( this );
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
event.SetEventObject( this );
// eventually we should add setting the default style again
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
// eventually we should add setting the default style again
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
bool wxTextCtrl::CanPaste() const
{
if (!IsEditable())
bool wxTextCtrl::CanPaste() const
{
if (!IsEditable())
return GetPeer()->CanPaste() ;
}
return GetPeer()->CanPaste() ;
}
void wxTextCtrl::SetInsertionPointEnd()
{
void wxTextCtrl::SetInsertionPointEnd()
{
- long pos = GetLastPosition();
+ wxTextPos pos = GetLastPosition();
SetInsertionPoint(pos);
}
SetInsertionPoint(pos);
}
-long wxTextCtrl::GetLastPosition() const
+wxTextPos wxTextCtrl::GetLastPosition() const
{
return GetPeer()->GetLastPosition( ) ;
}
{
return GetPeer()->GetLastPosition( ) ;
}
{
if ( wxTextCtrlBase::LoadFile(file) )
{
{
if ( wxTextCtrlBase::LoadFile(file) )
{
}
void wxTextCtrl::WriteText(const wxString& str)
}
void wxTextCtrl::WriteText(const wxString& str)
// TODO this MPRemoting will be moved into a remoting peer proxy for any command
if ( !wxIsMainThread() )
{
// TODO this MPRemoting will be moved into a remoting peer proxy for any command
if ( !wxIsMainThread() )
{
- // unfortunately CW 8 is not able to correctly deduce the template types, so we have
+ // unfortunately CW 8 is not able to correctly deduce the template types, so we have
// to instantiate explicitely
wxMacMPRemoteGUICall<wxTextCtrl,wxString>( this , &wxTextCtrl::WriteText , str ) ;
return ;
// to instantiate explicitely
wxMacMPRemoteGUICall<wxTextCtrl,wxString>( this , &wxTextCtrl::WriteText , str ) ;
return ;
break ;
default :
hText = 22 - 6;
break ;
default :
hText = 22 - 6;
}
// as the above numbers have some free space around the text
}
// as the above numbers have some free space around the text
bool wxTextCtrl::CanUndo() const
{
bool wxTextCtrl::CanUndo() const
{
}
return GetPeer()->CanUndo() ;
}
bool wxTextCtrl::CanRedo() const
{
}
return GetPeer()->CanUndo() ;
}
bool wxTextCtrl::CanRedo() const
{
}
return GetPeer()->CanRedo() ;
}
}
return GetPeer()->CanRedo() ;
}
// this will make wxWidgets eat the ENTER key so that
// we actually prevent line wrapping in a single line
// text control
// this will make wxWidgets eat the ENTER key so that
// we actually prevent line wrapping in a single line
// text control
// be inserted.
WriteText(wxT("\t"));
}
// be inserted.
WriteText(wxT("\t"));
}
// perform keystroke handling
if ( wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL )
CallNextEventHandler((EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef() , (EventRef) wxTheApp->MacGetCurrentEvent() ) ;
// perform keystroke handling
if ( wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL )
CallNextEventHandler((EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef() , (EventRef) wxTheApp->MacGetCurrentEvent() ) ;
{
EventRecord rec ;
if ( wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) )
{
EventRecord rec ;
if ( wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) )
// user pane implementation
// user pane implementation
-void wxTextCtrl::MacControlUserPaneDrawProc(wxInt16 part)
+void wxTextCtrl::MacControlUserPaneDrawProc(wxInt16 part)
-wxInt16 wxTextCtrl::MacControlUserPaneHitTestProc(wxInt16 x, wxInt16 y)
+wxInt16 wxTextCtrl::MacControlUserPaneHitTestProc(wxInt16 x, wxInt16 y)
{
return kControlNoPart ;
}
{
return kControlNoPart ;
}
-wxInt16 wxTextCtrl::MacControlUserPaneTrackingProc(wxInt16 x, wxInt16 y, void* actionProc)
+wxInt16 wxTextCtrl::MacControlUserPaneTrackingProc(wxInt16 x, wxInt16 y, void* actionProc)
{
return kControlNoPart ;
}
{
return kControlNoPart ;
}
-void wxTextCtrl::MacControlUserPaneIdleProc()
+void wxTextCtrl::MacControlUserPaneIdleProc()
-wxInt16 wxTextCtrl::MacControlUserPaneKeyDownProc(wxInt16 keyCode, wxInt16 charCode, wxInt16 modifiers)
+wxInt16 wxTextCtrl::MacControlUserPaneKeyDownProc(wxInt16 keyCode, wxInt16 charCode, wxInt16 modifiers)
{
return kControlNoPart ;
}
{
return kControlNoPart ;
}
-void wxTextCtrl::MacControlUserPaneActivateProc(bool activating)
+void wxTextCtrl::MacControlUserPaneActivateProc(bool activating)
-wxInt16 wxTextCtrl::MacControlUserPaneFocusProc(wxInt16 action)
+wxInt16 wxTextCtrl::MacControlUserPaneFocusProc(wxInt16 action)
{
return kControlNoPart ;
}
{
return kControlNoPart ;
}
-void wxTextCtrl::MacControlUserPaneBackgroundProc(void* info)
+void wxTextCtrl::MacControlUserPaneBackgroundProc(void* info)
// implementation base class
// ----------------------------------------------------------------------------
// implementation base class
// ----------------------------------------------------------------------------
-wxMacTextControl::wxMacTextControl()
+wxMacTextControl::wxMacTextControl()
-wxMacTextControl::~wxMacTextControl()
+wxMacTextControl::~wxMacTextControl()
-void wxMacTextControl::SetStyle(long start, long end, const wxTextAttr& style)
+void wxMacTextControl::SetStyle(long start, long end, const wxTextAttr& style)
-void wxMacTextControl::Copy()
+void wxMacTextControl::Copy()
-void wxMacTextControl::Cut()
+void wxMacTextControl::Cut()
-void wxMacTextControl::Paste()
+void wxMacTextControl::Paste()
-bool wxMacTextControl::CanPaste() const
-{
+bool wxMacTextControl::CanPaste() const
+{
-void wxMacTextControl::SetEditable(bool editable)
+void wxMacTextControl::SetEditable(bool editable)
-long wxMacTextControl::GetLastPosition() const
+wxTextPos wxMacTextControl::GetLastPosition() const
{
return GetStringValue().Length() ;
}
{
return GetStringValue().Length() ;
}
-void wxMacTextControl::Replace( long from , long to , const wxString str )
+void wxMacTextControl::Replace( long from , long to , const wxString str )
-void wxMacTextControl::Clear()
+void wxMacTextControl::Clear()
{
SetStringValue( wxEmptyString ) ;
}
{
SetStringValue( wxEmptyString ) ;
}
-bool wxMacTextControl::CanUndo() const
+bool wxMacTextControl::CanUndo() const
-void wxMacTextControl::Undo() { }
+void wxMacTextControl::Undo() { }
bool wxMacTextControl::CanRedo() const
{
return false ;
bool wxMacTextControl::CanRedo() const
{
return false ;
-void wxMacTextControl::Redo()
+void wxMacTextControl::Redo()
-bool wxMacTextControl::PositionToXY(long pos, long *x, long *y) const
+bool wxMacTextControl::PositionToXY(long pos, long *x, long *y) const
-void wxMacTextControl::ShowPosition( long WXUNUSED(pos) )
-{
-}
+void wxMacTextControl::ShowPosition( long WXUNUSED(pos) )
+{
+}
-int wxMacTextControl::GetNumberOfLines() const
+int wxMacTextControl::GetNumberOfLines() const
{
ItemCount lines = 0 ;
wxString content = GetStringValue() ;
{
ItemCount lines = 0 ;
wxString content = GetStringValue() ;
{
// TODO change this if possible to reflect real lines
wxString content = GetStringValue() ;
{
// TODO change this if possible to reflect real lines
wxString content = GetStringValue() ;
// Find line first
int count = 0;
for (size_t i = 0; i < content.Length() ; i++)
// Find line first
int count = 0;
for (size_t i = 0; i < content.Length() ; i++)
{
// Add chars in line then
wxString tmp;
{
// Add chars in line then
wxString tmp;
for (size_t j = i; j < content.Length(); j++)
{
if (content[j] == '\n')
return tmp;
for (size_t j = i; j < content.Length(); j++)
{
if (content[j] == '\n')
return tmp;
return tmp;
}
if (content[i] == '\n') count++;
return tmp;
}
if (content[i] == '\n') count++;
{
// TODO change this if possible to reflect real lines
wxString content = GetStringValue() ;
{
// TODO change this if possible to reflect real lines
wxString content = GetStringValue() ;
// Find line first
int count = 0;
for (size_t i = 0; i < content.Length() ; i++)
// Find line first
int count = 0;
for (size_t i = 0; i < content.Length() ; i++)
count++;
if (content[j] == '\n') return count;
}
count++;
if (content[j] == '\n') return count;
}
return count;
}
if (content[i] == '\n') count++;
return count;
}
if (content[i] == '\n') count++;
{
m_font = wxPeer->GetFont() ;
m_windowStyle = style ;
{
m_font = wxPeer->GetFont() ;
m_windowStyle = style ;
- Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
+ Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
wxString st = str ;
wxMacConvertNewlines10To13( &st ) ;
wxMacCFStringHolder cf(st , m_font.GetEncoding()) ;
wxString st = str ;
wxMacConvertNewlines10To13( &st ) ;
wxMacCFStringHolder cf(st , m_font.GetEncoding()) ;
Boolean isPassword = ( m_windowStyle & wxTE_PASSWORD ) != 0 ;
m_valueTag = isPassword ? kControlEditTextPasswordCFStringTag : kControlEditTextCFStringTag ;
CreateEditUnicodeTextControl( MAC_WXHWND(wxPeer->MacGetTopLevelWindowRef()), &bounds , cfr , isPassword , NULL , &m_controlRef ) ;
Boolean isPassword = ( m_windowStyle & wxTE_PASSWORD ) != 0 ;
m_valueTag = isPassword ? kControlEditTextPasswordCFStringTag : kControlEditTextCFStringTag ;
CreateEditUnicodeTextControl( MAC_WXHWND(wxPeer->MacGetTopLevelWindowRef()), &bounds , cfr , isPassword , NULL , &m_controlRef ) ;
if ( !(m_windowStyle & wxTE_MULTILINE) )
{
SetData<Boolean>( kControlEditTextPart , kControlEditTextSingleLineTag , true ) ;
if ( !(m_windowStyle & wxTE_MULTILINE) )
{
SetData<Boolean>( kControlEditTextPart , kControlEditTextSingleLineTag , true ) ;
-void wxMacUnicodeTextControl::VisibilityChanged(bool shown)
+void wxMacUnicodeTextControl::VisibilityChanged(bool shown)
{
if ( !(m_windowStyle & wxTE_MULTILINE) && shown )
{
{
if ( !(m_windowStyle & wxTE_MULTILINE) && shown )
{
verify_noerr( GetData<CFStringRef>( 0, m_valueTag , &value ) );
verify_noerr( SetData<CFStringRef>( 0, m_valueTag, &value ) );
verify_noerr( SetData<ControlEditTextSelectionRec>( 0, kControlEditTextSelectionTag, &sel ) );
verify_noerr( GetData<CFStringRef>( 0, m_valueTag , &value ) );
verify_noerr( SetData<CFStringRef>( 0, m_valueTag, &value ) );
verify_noerr( SetData<ControlEditTextSelectionRec>( 0, kControlEditTextSelectionTag, &sel ) );
-wxString wxMacUnicodeTextControl::GetStringValue() const
+wxString wxMacUnicodeTextControl::GetStringValue() const
{
wxString result ;
CFStringRef value = GetData<CFStringRef>(0,m_valueTag) ;
{
wxString result ;
CFStringRef value = GetData<CFStringRef>(0,m_valueTag) ;
-void wxMacUnicodeTextControl::SetStringValue( const wxString &str)
+void wxMacUnicodeTextControl::SetStringValue( const wxString &str)
{
wxString st = str ;
wxMacConvertNewlines10To13( &st ) ;
{
wxString st = str ;
wxMacConvertNewlines10To13( &st ) ;
-void wxMacUnicodeTextControl::SetEditable(bool editable)
+void wxMacUnicodeTextControl::SetEditable(bool editable)
{
SetData<Boolean>( 0 , kControlEditTextLockedTag , (Boolean) !editable ) ;
}
{
SetData<Boolean>( 0 , kControlEditTextLockedTag , (Boolean) !editable ) ;
}
-void wxMacUnicodeTextControl::Remove( long from , long to )
+void wxMacUnicodeTextControl::Remove( long from , long to )
if ( to ) *to = sel.selEnd ;
}
if ( to ) *to = sel.selEnd ;
}
-void wxMacUnicodeTextControl::SetSelection( long from , long to )
+void wxMacUnicodeTextControl::SetSelection( long from , long to )
{
ControlEditTextSelectionRec sel ;
sel.selStart = from ;
{
ControlEditTextSelectionRec sel ;
sel.selStart = from ;
// MLTE control implementation (common part)
// ----------------------------------------------------------------------------
// MLTE control implementation (common part)
// ----------------------------------------------------------------------------
-#if TARGET_API_MAC_OSX == 0
+#if TARGET_API_MAC_OSX == 0
// declaration needed because of one line in the code...
static void TPUpdateVisibility(ControlRef theControl) ;
#endif
// declaration needed because of one line in the code...
static void TPUpdateVisibility(ControlRef theControl) ;
#endif
-// if mlte is on read only , no changes at all are allowed, not even from
+// if mlte is on read only , no changes at all are allowed, not even from
// procedural API, in order to allow changes via API all the same we must undo
// the readonly status while we are executing, this class helps to do so
// procedural API, in order to allow changes via API all the same we must undo
// the readonly status while we are executing, this class helps to do so
TXNSetTXNObjectControls( m_txn , false , 1 , tag , data ) ;
}
}
TXNSetTXNObjectControls( m_txn , false , 1 , tag , data ) ;
}
}
{
TXNControlTag tag[] = { kTXNIOPrivilegesTag } ;
if ( m_data[0].uValue == kTXNReadOnly )
{
TXNControlTag tag[] = { kTXNIOPrivilegesTag } ;
if ( m_data[0].uValue == kTXNReadOnly )
TXNControlData m_data[1] ;
} ;
TXNControlData m_data[1] ;
} ;
-wxString wxMacMLTEControl::GetStringValue() const
+wxString wxMacMLTEControl::GetStringValue() const
{
wxString result ;
OSStatus err ;
{
wxString result ;
OSStatus err ;
if ( actualSize > 0 )
{
wxChar *ptr = NULL ;
if ( actualSize > 0 )
{
wxChar *ptr = NULL ;
-#if SIZEOF_WCHAR_T == 2
- ptr = new wxChar[actualSize + 1 ] ;
+#if SIZEOF_WCHAR_T == 2
+ ptr = new wxChar[actualSize + 1 ] ;
wxStrncpy( ptr , (wxChar*) *theText , actualSize ) ;
wxStrncpy( ptr , (wxChar*) *theText , actualSize ) ;
#else
SetHandleSize( theText , ( actualSize + 1 ) * sizeof( UniChar ) ) ;
HLock( theText ) ;
#else
SetHandleSize( theText , ( actualSize + 1 ) * sizeof( UniChar ) ) ;
HLock( theText ) ;
wxMBConvUTF16BE converter ;
size_t noChars = converter.MB2WC( NULL , (const char*)*theText , 0 ) ;
ptr = new wxChar[noChars + 1] ;
wxMBConvUTF16BE converter ;
size_t noChars = converter.MB2WC( NULL , (const char*)*theText , 0 ) ;
ptr = new wxChar[noChars + 1] ;
noChars = converter.MB2WC( ptr , (const char*)*theText , noChars ) ;
ptr[noChars] = 0 ;
HUnlock( theText ) ;
noChars = converter.MB2WC( ptr , (const char*)*theText , noChars ) ;
ptr[noChars] = 0 ;
HUnlock( theText ) ;
-void wxMacMLTEControl::SetStringValue( const wxString &str)
+void wxMacMLTEControl::SetStringValue( const wxString &str)
}
else
frameOptions |= kTXNSingleLineOnlyMask ;
}
else
frameOptions |= kTXNSingleLineOnlyMask ;
if ( wxStyle & wxHSCROLL )
frameOptions |= kTXNWantHScrollBarMask ;
if ( wxStyle & wxHSCROLL )
frameOptions |= kTXNWantHScrollBarMask ;
iControlTags[2] = kTXNVisibilityTag ;
iControlData[2].uValue = visible ;
toptag++ ;
iControlTags[2] = kTXNVisibilityTag ;
iControlData[2].uValue = visible ;
toptag++ ;
if ( m_windowStyle & wxTE_MULTILINE )
{
if (m_windowStyle & wxTE_DONTWRAP)
iControlData[1].uValue = kTXNNoAutoWrap ;
else
iControlData[1].uValue = kTXNAutoWrap ;
if ( m_windowStyle & wxTE_MULTILINE )
{
if (m_windowStyle & wxTE_DONTWRAP)
iControlData[1].uValue = kTXNNoAutoWrap ;
else
iControlData[1].uValue = kTXNAutoWrap ;
}
verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag,
iControlTags, iControlData )) ;
}
verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag,
iControlTags, iControlData )) ;
TXNSetBackground( m_txn , &tback);
}
TXNSetBackground( m_txn , &tback);
}
-void wxMacMLTEControl::SetBackground( const wxBrush &brush )
+void wxMacMLTEControl::SetBackground( const wxBrush &brush )
{
// currently only solid background are supported
TXNBackground tback;
{
// currently only solid background are supported
TXNBackground tback;
void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , long to)
{
void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , long to)
{
- TXNTypeAttributes typeAttr[4] ;
+ TXNTypeAttributes typeAttr[4] ;
Str255 fontName = "\pMonaco" ;
SInt16 fontSize = 12 ;
Style fontStyle = normal ;
Str255 fontName = "\pMonaco" ;
SInt16 fontSize = 12 ;
Style fontStyle = normal ;
-void wxMacMLTEControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle )
+void wxMacMLTEControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle )
{
EditHelper help(m_txn) ;
TXNSetAttribute( wxTextAttr(foreground,wxNullColour,font) , kTXNStartOffset,kTXNEndOffset ) ;
}
{
EditHelper help(m_txn) ;
TXNSetAttribute( wxTextAttr(foreground,wxNullColour,font) , kTXNStartOffset,kTXNEndOffset ) ;
}
-void wxMacMLTEControl::SetStyle(long start, long end, const wxTextAttr& style)
-{
+void wxMacMLTEControl::SetStyle(long start, long end, const wxTextAttr& style)
+{
EditHelper help(m_txn) ;
TXNSetAttribute( style , start,end ) ;
EditHelper help(m_txn) ;
TXNSetAttribute( style , start,end ) ;
-}
-
-void wxMacMLTEControl::Copy()
+}
+
+void wxMacMLTEControl::Copy()
{
ClearCurrentScrap();
TXNCopy(m_txn);
TXNConvertToPublicScrap();
}
{
ClearCurrentScrap();
TXNCopy(m_txn);
TXNConvertToPublicScrap();
}
-void wxMacMLTEControl::Cut()
+void wxMacMLTEControl::Cut()
{
ClearCurrentScrap();
TXNCut(m_txn);
TXNConvertToPublicScrap();
}
{
ClearCurrentScrap();
TXNCut(m_txn);
TXNConvertToPublicScrap();
}
-void wxMacMLTEControl::Paste()
+void wxMacMLTEControl::Paste()
{
TXNConvertFromPublicScrap();
TXNPaste(m_txn);
{
TXNConvertFromPublicScrap();
TXNPaste(m_txn);
return TXNIsScrapPastable() ;
}
return TXNIsScrapPastable() ;
}
-void wxMacMLTEControl::SetEditable(bool editable)
+void wxMacMLTEControl::SetEditable(bool editable)
{
TXNControlTag tag[] = { kTXNIOPrivilegesTag } ;
TXNControlData data[] = { { editable ? kTXNReadWrite : kTXNReadOnly } } ;
TXNSetTXNObjectControls( m_txn , false , sizeof(tag) / sizeof (TXNControlTag) , tag , data ) ;
}
{
TXNControlTag tag[] = { kTXNIOPrivilegesTag } ;
TXNControlData data[] = { { editable ? kTXNReadWrite : kTXNReadOnly } } ;
TXNSetTXNObjectControls( m_txn , false , sizeof(tag) / sizeof (TXNControlTag) , tag , data ) ;
}
-long wxMacMLTEControl::GetLastPosition() const
+wxTextPos wxMacMLTEControl::GetLastPosition() const
+ wxTextPos actualsize = 0 ;
Handle theText ;
OSErr err = TXNGetDataEncoded( m_txn, kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
Handle theText ;
OSErr err = TXNGetDataEncoded( m_txn, kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
-void wxMacMLTEControl::Replace( long from , long to , const wxString str )
+void wxMacMLTEControl::Replace( long from , long to , const wxString str )
{
wxString value = str ;
wxMacConvertNewlines10To13( &value ) ;
{
wxString value = str ;
wxMacConvertNewlines10To13( &value ) ;
TXNGetSelection( m_txn , (TXNOffset*) from , (TXNOffset*) to ) ;
}
TXNGetSelection( m_txn , (TXNOffset*) from , (TXNOffset*) to ) ;
}
-void wxMacMLTEControl::SetSelection( long from , long to )
+void wxMacMLTEControl::SetSelection( long from , long to )
{
/* change the selection */
if ((from == -1) && (to == -1))
{
/* change the selection */
if ((from == -1) && (to == -1))
- TXNSetSelection( m_txn, from, to);
+ TXNSetSelection( m_txn, from, to);
TXNShowSelection( m_txn, kTXNShowStart);
}
TXNShowSelection( m_txn, kTXNShowStart);
}
-void wxMacMLTEControl::WriteText(const wxString& str)
+void wxMacMLTEControl::WriteText(const wxString& str)
{
EditHelper helper( m_txn ) ;
wxString st = str ;
{
EditHelper helper( m_txn ) ;
wxString st = str ;
// TODO SetStyle( start , end , GetDefaultStyle() ) ;
}
// TODO SetStyle( start , end , GetDefaultStyle() ) ;
}
-void wxMacMLTEControl::Clear()
+void wxMacMLTEControl::Clear()
{
EditHelper st(m_txn) ;
TXNSetSelection( m_txn , kTXNStartOffset , kTXNEndOffset ) ;
TXNClear(m_txn);
}
{
EditHelper st(m_txn) ;
TXNSetSelection( m_txn , kTXNStartOffset , kTXNEndOffset ) ;
TXNClear(m_txn);
}
-bool wxMacMLTEControl::CanUndo() const
+bool wxMacMLTEControl::CanUndo() const
{
return TXNCanUndo( m_txn , NULL ) ;
}
{
return TXNCanUndo( m_txn , NULL ) ;
}
-void wxMacMLTEControl::Undo()
+void wxMacMLTEControl::Undo()
bool wxMacMLTEControl::CanRedo() const
{
return TXNCanRedo( m_txn , NULL ) ;
bool wxMacMLTEControl::CanRedo() const
{
return TXNCanRedo( m_txn , NULL ) ;
-void wxMacMLTEControl::Redo()
-{
+void wxMacMLTEControl::Redo()
+{
-int wxMacMLTEControl::GetNumberOfLines() const
+int wxMacMLTEControl::GetNumberOfLines() const
{
ItemCount lines = 0 ;
TXNGetLineCount(m_txn, &lines ) ;
{
ItemCount lines = 0 ;
TXNGetLineCount(m_txn, &lines ) ;
long wxMacMLTEControl::XYToPosition(long x, long y) const
{
Point curpt ;
long wxMacMLTEControl::XYToPosition(long x, long y) const
{
Point curpt ;
-
- long lastpos = GetLastPosition() ;
-
- // TODO find a better implementation : while we can get the
+
+ wxTextPos lastpos = GetLastPosition() ;
+
+ // TODO find a better implementation : while we can get the
// line metrics of a certain line, we don't get its starting
// position, so it would probably be rather a binary search
// for the start position
// line metrics of a certain line, we don't get its starting
// position, so it would probably be rather a binary search
// for the start position
long ypos = 0 ;
int lastHeight = 0 ;
long ypos = 0 ;
int lastHeight = 0 ;
{
if ( y == ypos && x == xpos )
return n ;
{
if ( y == ypos && x == xpos )
return n ;
TXNOffsetToPoint( m_txn , n , &curpt);
if ( curpt.v > lastHeight )
TXNOffsetToPoint( m_txn , n , &curpt);
if ( curpt.v > lastHeight )
bool wxMacMLTEControl::PositionToXY(long pos, long *x, long *y) const
{
Point curpt ;
bool wxMacMLTEControl::PositionToXY(long pos, long *x, long *y) const
{
Point curpt ;
-
- long lastpos = GetLastPosition() ;
-
+
+ wxTextPos lastpos = GetLastPosition() ;
+
if ( y ) *y = 0 ;
if ( x ) *x = 0 ;
if ( y ) *y = 0 ;
if ( x ) *x = 0 ;
- // TODO find a better implementation : while we can get the
+ // TODO find a better implementation : while we can get the
// line metrics of a certain line, we don't get its starting
// position, so it would probably be rather a binary search
// for the start position
// line metrics of a certain line, we don't get its starting
// position, so it would probably be rather a binary search
// for the start position
long ypos = 0 ;
int lastHeight = 0 ;
long ypos = 0 ;
int lastHeight = 0 ;
-void wxMacMLTEControl::ShowPosition( long pos )
+void wxMacMLTEControl::ShowPosition( long pos )
{
#if TARGET_RT_MAC_MACHO && defined(AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
{
{
#if TARGET_RT_MAC_MACHO && defined(AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
{
SInt32 dv = desired.v - current.v ;
SInt32 dh = desired.h - current.h ;
TXNShowSelection( m_txn , true ) ;
SInt32 dv = desired.v - current.v ;
SInt32 dh = desired.h - current.h ;
TXNShowSelection( m_txn , true ) ;
- theErr = TXNScroll( m_txn, kTXNScrollUnitsInPixels , kTXNScrollUnitsInPixels , &dv , &dh );
+ theErr = TXNScroll( m_txn, kTXNScrollUnitsInPixels , kTXNScrollUnitsInPixels , &dv , &dh );
wxASSERT_MSG( theErr == noErr, _T("TXNScroll returned an error!") );
}
}
wxASSERT_MSG( theErr == noErr, _T("TXNScroll returned an error!") );
}
}
{
#if wxUSE_UNICODE
#if SIZEOF_WCHAR_T == 2
{
#if wxUSE_UNICODE
#if SIZEOF_WCHAR_T == 2
- size_t len = st.Len() ;
+ size_t len = st.Len() ;
TXNSetData( m_txn , kTXNUnicodeTextData, (void*)st.wc_str(), len * 2,
start, end);
#else
TXNSetData( m_txn , kTXNUnicodeTextData, (void*)st.wc_str(), len * 2,
start, end);
#else
- wxMBConvUTF16BE converter ;
- ByteCount byteBufferLen = converter.WC2MB( NULL , st.wc_str() , 0 ) ;
- UniChar *unibuf = (UniChar*) malloc(byteBufferLen) ;
- converter.WC2MB( (char*) unibuf , st.wc_str() , byteBufferLen ) ;
+ wxMBConvUTF16BE converter ;
+ ByteCount byteBufferLen = converter.WC2MB( NULL , st.wc_str() , 0 ) ;
+ UniChar *unibuf = (UniChar*) malloc(byteBufferLen) ;
+ converter.WC2MB( (char*) unibuf , st.wc_str() , byteBufferLen ) ;
TXNSetData( m_txn , kTXNUnicodeTextData, (void*)unibuf, byteBufferLen ,
start, end);
TXNSetData( m_txn , kTXNUnicodeTextData, (void*)unibuf, byteBufferLen ,
start, end);
- wxCharBuffer text = st.mb_str(wxConvLocal) ;
+ wxCharBuffer text = st.mb_str(wxConvLocal) ;
TXNSetData( m_txn , kTXNTextData, (void*)text.data(), strlen( text ) ,
start, end);
TXNSetData( m_txn , kTXNTextData, (void*)text.data(), strlen( text ) ,
start, end);
if ( lineNo < GetNumberOfLines() )
{
long ypos = 0 ;
if ( lineNo < GetNumberOfLines() )
{
long ypos = 0 ;
lineHeight,
currentHeight = 0;
lineHeight,
currentHeight = 0;
// get the first possible position in the control
Point firstPoint;
TXNOffsetToPoint(m_txn, 0, &firstPoint);
// get the first possible position in the control
Point firstPoint;
TXNOffsetToPoint(m_txn, 0, &firstPoint);
// Iterate through the lines until we reach the one we want,
// adding to our current y pixel point position
while (ypos < lineNo)
// Iterate through the lines until we reach the one we want,
// adding to our current y pixel point position
while (ypos < lineNo)
TXNGetLineMetrics(m_txn, ypos++, &lineWidth, &lineHeight);
currentHeight += lineHeight;
}
TXNGetLineMetrics(m_txn, ypos++, &lineWidth, &lineHeight);
currentHeight += lineHeight;
}
Point thePoint = { firstPoint.v + (currentHeight >> 16), firstPoint.h + (0) };
TXNOffset theOffset;
TXNPointToOffset(m_txn, thePoint, &theOffset);
Point thePoint = { firstPoint.v + (currentHeight >> 16), firstPoint.h + (0) };
TXNOffset theOffset;
TXNPointToOffset(m_txn, thePoint, &theOffset);
wxString content = GetStringValue() ;
Point currentPoint = thePoint;
while(thePoint.v == currentPoint.v && theOffset < content.length())
wxString content = GetStringValue() ;
Point currentPoint = thePoint;
while(thePoint.v == currentPoint.v && theOffset < content.length())
if ( lineNo < GetNumberOfLines() )
{
long ypos = 0 ;
if ( lineNo < GetNumberOfLines() )
{
long ypos = 0 ;
lineHeight,
currentHeight = 0;
lineHeight,
currentHeight = 0;
// get the first possible position in the control
Point firstPoint;
TXNOffsetToPoint(m_txn, 0, &firstPoint);
// get the first possible position in the control
Point firstPoint;
TXNOffsetToPoint(m_txn, 0, &firstPoint);
// Iterate through the lines until we reach the one we want,
// adding to our current y pixel point position
while (ypos < lineNo)
// Iterate through the lines until we reach the one we want,
// adding to our current y pixel point position
while (ypos < lineNo)
TXNGetLineMetrics(m_txn, ypos++, &lineWidth, &lineHeight);
currentHeight += lineHeight;
}
TXNGetLineMetrics(m_txn, ypos++, &lineWidth, &lineHeight);
currentHeight += lineHeight;
}
Point thePoint = { firstPoint.v + (currentHeight >> 16), firstPoint.h + (0) };
TXNOffset theOffset;
TXNPointToOffset(m_txn, thePoint, &theOffset);
Point thePoint = { firstPoint.v + (currentHeight >> 16), firstPoint.h + (0) };
TXNOffset theOffset;
TXNPointToOffset(m_txn, thePoint, &theOffset);
wxString content = GetStringValue() ;
Point currentPoint = thePoint;
while(thePoint.v == currentPoint.v && theOffset < content.length())
wxString content = GetStringValue() ;
Point currentPoint = thePoint;
while(thePoint.v == currentPoint.v && theOffset < content.length())
Boolean fInFocus; /* true while the focus rect is drawn around the control */
Boolean fIsActive; /* true while the control is drawn in the active state */
Boolean fTXNObjectActive; /* reflects the activation state of the text edit record */
Boolean fInFocus; /* true while the focus rect is drawn around the control */
Boolean fIsActive; /* true while the control is drawn in the active state */
Boolean fTXNObjectActive; /* reflects the activation state of the text edit record */
- Boolean fFocusDrawState; /* true if focus is drawn (default: true) */
+ Boolean fFocusDrawState; /* true if focus is drawn (default: true) */
/* calculated locations */
Rect fRBounds; /* control bounds */
Rect fRTextArea; /* area where the text is drawn */
/* calculated locations */
Rect fRBounds; /* control bounds */
Rect fRTextArea; /* area where the text is drawn */
ControlUserPaneFocusUPP gTPFocusProc = NULL;
// one place for calculating all
ControlUserPaneFocusUPP gTPFocusProc = NULL;
// one place for calculating all
-static void TPCalculateBounds(STPTextPaneVars *varsp, const Rect& bounds)
+static void TPCalculateBounds(STPTextPaneVars *varsp, const Rect& bounds)
{
SetRect(&varsp->fRBounds, bounds.left, bounds.top, bounds.right, bounds.bottom);
SetRect(&varsp->fRFocusOutline, bounds.left, bounds.top, bounds.right, bounds.bottom);
{
SetRect(&varsp->fRBounds, bounds.left, bounds.top, bounds.right, bounds.bottom);
SetRect(&varsp->fRFocusOutline, bounds.left, bounds.top, bounds.right, bounds.bottom);
SetRect(&varsp->fRTextOutline, bounds.left, bounds.top, bounds.right, bounds.bottom);
if ( !varsp->fNoBorders )
{
SetRect(&varsp->fRTextOutline, bounds.left, bounds.top, bounds.right, bounds.bottom);
if ( !varsp->fNoBorders )
{
- SetRect(&varsp->fRTextArea, bounds.left + 2 , bounds.top + (varsp->fMultiline ? 0 : 2) ,
+ SetRect(&varsp->fRTextArea, bounds.left + 2 , bounds.top + (varsp->fMultiline ? 0 : 2) ,
bounds.right - (varsp->fMultiline ? 0 : 2), bounds.bottom - (varsp->fMultiline ? 0 : 2));
}
else
bounds.right - (varsp->fMultiline ? 0 : 2), bounds.bottom - (varsp->fMultiline ? 0 : 2));
}
else
if ( textctrl )
{
#if TARGET_API_MAC_OSX
if ( textctrl )
{
#if TARGET_API_MAC_OSX
- TXNControlTag iControlTags[1] = { kTXNVisibilityTag };
- TXNControlData iControlData[1] = {{ vis }};
- err = ::TXNSetTXNObjectControls( varsp->fTXNRec, false, 1, iControlTags, iControlData );
+ TXNControlTag iControlTags[1] = { kTXNVisibilityTag };
+ TXNControlData iControlData[1] = {{ vis }};
+ err = ::TXNSetTXNObjectControls( varsp->fTXNRec, false, 1, iControlTags, iControlData );
#endif
Rect bounds ;
UMAGetControlBoundsInWindowCoords( varsp->fUserPaneRec, &bounds);
TPCalculateBounds( varsp , bounds ) ;
#endif
Rect bounds ;
UMAGetControlBoundsInWindowCoords( varsp->fUserPaneRec, &bounds);
TPCalculateBounds( varsp , bounds ) ;
- if ( vis )
- {
- wxMacWindowClipper cl(textctrl) ;
- TXNSetFrameBounds( varsp->fTXNRec, varsp->fRTextArea.top, varsp->fRTextArea.left,
- varsp->fRTextArea.bottom, varsp->fRTextArea.right, varsp->fTXNFrame);
- TXNShowSelection( varsp->fTXNRec, kTXNShowStart);
- }
- else
- {
+ if ( vis )
+ {
+ wxMacWindowClipper cl(textctrl) ;
+ TXNSetFrameBounds( varsp->fTXNRec, varsp->fRTextArea.top, varsp->fRTextArea.left,
+ varsp->fRTextArea.bottom, varsp->fRTextArea.right, varsp->fTXNFrame);
+ TXNShowSelection( varsp->fTXNRec, kTXNShowStart);
+ }
+ else
+ {
- // in 10.2 the scrollbars are still actively redrawn when using only the code above
- if ( UMAGetSystemVersion() < 0x1030 )
- {
- TXNSetFrameBounds( varsp->fTXNRec, varsp->fRTextArea.top + 20000 , varsp->fRTextArea.left + 20000 ,
- varsp->fRTextArea.bottom + 20000 , varsp->fRTextArea.right + 20000 , varsp->fTXNFrame);
-
- }
+ // in 10.2 the scrollbars are still actively redrawn when using only the code above
+ if ( UMAGetSystemVersion() < 0x1030 )
+ {
+ TXNSetFrameBounds( varsp->fTXNRec, varsp->fRTextArea.top + 20000 , varsp->fRTextArea.left + 20000 ,
+ varsp->fRTextArea.bottom + 20000 , varsp->fRTextArea.right + 20000 , varsp->fTXNFrame);
+ }
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(theControl);
if ( textctrl == NULL )
return ;
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(theControl);
if ( textctrl == NULL )
return ;
STPTextPaneVars *varsp = (STPTextPaneVars *) ((wxMacMLTEClassicControl*)textctrl->GetPeer())->m_macTXNvars ;
STPTextPaneVars *varsp = (STPTextPaneVars *) ((wxMacMLTEClassicControl*)textctrl->GetPeer())->m_macTXNvars ;
Rect bounds ;
UMAGetControlBoundsInWindowCoords(theControl, &bounds);
if ( textctrl->MacIsReallyShown() != varsp->fVisible )
Rect bounds ;
UMAGetControlBoundsInWindowCoords(theControl, &bounds);
if ( textctrl->MacIsReallyShown() != varsp->fVisible )
// make correct activations
static void TPActivatePaneText(STPTextPaneVars *varsp, Boolean setActive) {
// make correct activations
static void TPActivatePaneText(STPTextPaneVars *varsp, Boolean setActive) {
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(varsp->fUserPaneRec);
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(varsp->fUserPaneRec);
- if (varsp->fTXNObjectActive != setActive && textctrl->MacIsReallyShown() )
+ if (varsp->fTXNObjectActive != setActive && textctrl->MacIsReallyShown() )
{
varsp->fTXNObjectActive = setActive;
TXNActivate(varsp->fTXNRec, varsp->fTXNFrame, varsp->fTXNObjectActive);
{
varsp->fTXNObjectActive = setActive;
TXNActivate(varsp->fTXNRec, varsp->fTXNFrame, varsp->fTXNObjectActive);
// update focus outlines
static void TPRedrawFocusOutline(STPTextPaneVars *varsp) {
// update focus outlines
static void TPRedrawFocusOutline(STPTextPaneVars *varsp) {
- if (varsp->fFocusDrawState != (varsp->fIsActive && varsp->fInFocus))
- {
- varsp->fFocusDrawState = (varsp->fIsActive && varsp->fInFocus);
- // DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fFocusDrawState);
- }
+ if (varsp->fFocusDrawState != (varsp->fIsActive && varsp->fInFocus))
+ {
+ varsp->fFocusDrawState = (varsp->fIsActive && varsp->fInFocus);
+ // DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fFocusDrawState);
+ }
}
// update TXN focus state
static void TPFocusPaneText(STPTextPaneVars *varsp, Boolean setFocus) {
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(varsp->fUserPaneRec);
}
// update TXN focus state
static void TPFocusPaneText(STPTextPaneVars *varsp, Boolean setFocus) {
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(varsp->fUserPaneRec);
if (varsp->fInFocus != setFocus && textctrl->MacIsReallyShown()) {
varsp->fInFocus = setFocus;
TXNFocus( varsp->fTXNRec, varsp->fInFocus);
if (varsp->fInFocus != setFocus && textctrl->MacIsReallyShown()) {
varsp->fInFocus = setFocus;
TXNFocus( varsp->fTXNRec, varsp->fInFocus);
// draw the control
static pascal void TPPaneDrawProc(ControlRef theControl, ControlPartCode thePart) {
/* set up our globals */
// draw the control
static pascal void TPPaneDrawProc(ControlRef theControl, ControlPartCode thePart) {
/* set up our globals */
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(theControl);
if ( textctrl == NULL )
return ;
TPUpdateVisibility( theControl ) ;
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(theControl);
if ( textctrl == NULL )
return ;
TPUpdateVisibility( theControl ) ;
STPTextPaneVars *varsp = (STPTextPaneVars *) ((wxMacMLTEClassicControl*)textctrl->GetPeer())->m_macTXNvars ;
if ( textctrl->MacIsReallyShown() )
{
wxMacWindowClipper clipper( textctrl ) ;
TXNDraw(varsp->fTXNRec, NULL);
if ( !varsp->fNoBorders )
STPTextPaneVars *varsp = (STPTextPaneVars *) ((wxMacMLTEClassicControl*)textctrl->GetPeer())->m_macTXNvars ;
if ( textctrl->MacIsReallyShown() )
{
wxMacWindowClipper clipper( textctrl ) ;
TXNDraw(varsp->fTXNRec, NULL);
if ( !varsp->fNoBorders )
- DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
+ DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
TPRedrawFocusOutline( varsp ) ;
}
TPRedrawFocusOutline( varsp ) ;
}
return 0 ;
TPUpdateVisibility( theControl ) ;
STPTextPaneVars *varsp = (STPTextPaneVars *) ((wxMacMLTEClassicControl*)textctrl->GetPeer())->m_macTXNvars ;
return 0 ;
TPUpdateVisibility( theControl ) ;
STPTextPaneVars *varsp = (STPTextPaneVars *) ((wxMacMLTEClassicControl*)textctrl->GetPeer())->m_macTXNvars ;
- if (textctrl->MacIsReallyShown() )
+ if (textctrl->MacIsReallyShown() )
{
if (PtInRect(where, &varsp->fRBounds))
result = kmUPTextPart;
{
if (PtInRect(where, &varsp->fRBounds))
result = kmUPTextPart;
{
// sometimes we get the coords also in control local coordinates, therefore test again
if ( textctrl->MacGetTopLevelWindow()->MacUsesCompositing() )
{
// sometimes we get the coords also in control local coordinates, therefore test again
if ( textctrl->MacGetTopLevelWindow()->MacUsesCompositing() )
}
if (PtInRect(where, &varsp->fRBounds))
result = kmUPTextPart;
}
if (PtInRect(where, &varsp->fRBounds))
result = kmUPTextPart;
over our control. This routine handles clicks in the text area
and in the scroll bar. */
static pascal ControlPartCode TPPaneTrackingProc(ControlRef theControl, Point startPt, ControlActionUPP actionProc) {
over our control. This routine handles clicks in the text area
and in the scroll bar. */
static pascal ControlPartCode TPPaneTrackingProc(ControlRef theControl, Point startPt, ControlActionUPP actionProc) {
ControlPartCode partCodeResult;
ControlPartCode partCodeResult;
- /* make sure we have some variables... */
+ /* make sure we have some variables... */
partCodeResult = 0;
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(theControl);
if ( textctrl == NULL )
return 0;
TPUpdateVisibility( theControl ) ;
STPTextPaneVars *varsp = (STPTextPaneVars *) ((wxMacMLTEClassicControl*)textctrl->GetPeer())->m_macTXNvars ;
partCodeResult = 0;
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(theControl);
if ( textctrl == NULL )
return 0;
TPUpdateVisibility( theControl ) ;
STPTextPaneVars *varsp = (STPTextPaneVars *) ((wxMacMLTEClassicControl*)textctrl->GetPeer())->m_macTXNvars ;
- if (textctrl->MacIsReallyShown() )
- {
- /* we don't do any of these functions unless we're in focus */
+ if (textctrl->MacIsReallyShown() )
+ {
+ /* we don't do any of these functions unless we're in focus */
if ( ! varsp->fInFocus) {
WindowPtr owner;
owner = GetControlOwner(theControl);
ClearKeyboardFocus(owner);
SetKeyboardFocus(owner, theControl, kUserClickedToFocusPart);
}
if ( ! varsp->fInFocus) {
WindowPtr owner;
owner = GetControlOwner(theControl);
ClearKeyboardFocus(owner);
SetKeyboardFocus(owner, theControl, kUserClickedToFocusPart);
}
- /* find the location for the click */
+ /* find the location for the click */
// for compositing, we must convert these into toplevel window coordinates, because hittesting expects them
if ( textctrl->MacGetTopLevelWindow()->MacUsesCompositing() )
{
// for compositing, we must convert these into toplevel window coordinates, because hittesting expects them
if ( textctrl->MacGetTopLevelWindow()->MacUsesCompositing() )
{
startPt.h += x ;
startPt.v += y ;
}
startPt.h += x ;
startPt.v += y ;
}
-
- switch (TPPaneHitTestProc(theControl, startPt))
+
+ switch (TPPaneHitTestProc(theControl, startPt))
-
- /* handle clicks in the text part */
+ /* handle clicks in the text part */
- {
- wxMacWindowClipper clipper( textctrl ) ;
-
- EventRecord rec ;
- ConvertEventRefToEventRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
- TXNClick( varsp->fTXNRec, &rec );
-
- }
+ {
+ wxMacWindowClipper clipper( textctrl ) ;
+
+ EventRecord rec ;
+ ConvertEventRefToEventRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
+ TXNClick( varsp->fTXNRec, &rec );
+
+ }
}
}
return partCodeResult;
}
}
return partCodeResult;
if (varsp->fIsActive) {
Rect bounds;
Point mousep;
if (varsp->fIsActive) {
Rect bounds;
Point mousep;
wxMacWindowClipper clipper( textctrl ) ;
GetMouse(&mousep);
/* there's a 'focus thing' and an 'unfocused thing' */
wxMacWindowClipper clipper( textctrl ) ;
GetMouse(&mousep);
/* there's a 'focus thing' and an 'unfocused thing' */
edit record and redraw the scroll bar and text field as appropriate. */
static pascal ControlPartCode TPPaneKeyDownProc(ControlRef theControl,
SInt16 keyCode, SInt16 charCode, SInt16 modifiers) {
edit record and redraw the scroll bar and text field as appropriate. */
static pascal ControlPartCode TPPaneKeyDownProc(ControlRef theControl,
SInt16 keyCode, SInt16 charCode, SInt16 modifiers) {
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(theControl);
if ( textctrl == NULL )
return 0;
TPUpdateVisibility( theControl ) ;
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(theControl);
if ( textctrl == NULL )
return 0;
TPUpdateVisibility( theControl ) ;
STPTextPaneVars *varsp = (STPTextPaneVars *) ((wxMacMLTEClassicControl*)textctrl->GetPeer())->m_macTXNvars ;
STPTextPaneVars *varsp = (STPTextPaneVars *) ((wxMacMLTEClassicControl*)textctrl->GetPeer())->m_macTXNvars ;
{
/* turn autoscrolling on and send the key event to text edit */
wxMacWindowClipper clipper( textctrl ) ;
{
/* turn autoscrolling on and send the key event to text edit */
wxMacWindowClipper clipper( textctrl ) ;
static pascal void TPPaneActivateProc(ControlRef theControl, Boolean activating) {
/* set up locals */
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(theControl);
static pascal void TPPaneActivateProc(ControlRef theControl, Boolean activating) {
/* set up locals */
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(theControl);
if ( textctrl == NULL )
return ;
TPUpdateVisibility( theControl ) ;
if ( textctrl == NULL )
return ;
TPUpdateVisibility( theControl ) ;
STPTextPaneVars *varsp = (STPTextPaneVars *) ((wxMacMLTEClassicControl*)textctrl->GetPeer())->m_macTXNvars ;
STPTextPaneVars *varsp = (STPTextPaneVars *) ((wxMacMLTEClassicControl*)textctrl->GetPeer())->m_macTXNvars ;
varsp->fIsActive = activating;
wxMacWindowClipper clipper( textctrl ) ;
TPActivatePaneText(varsp, varsp->fIsActive && varsp->fInFocus);
varsp->fIsActive = activating;
wxMacWindowClipper clipper( textctrl ) ;
TPActivatePaneText(varsp, varsp->fIsActive && varsp->fInFocus);
if ( textctrl->MacIsReallyShown() )
{
if ( !varsp->fNoBorders )
if ( textctrl->MacIsReallyShown() )
{
if ( !varsp->fNoBorders )
- DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
+ DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
TPRedrawFocusOutline( varsp ) ;
}
}
TPRedrawFocusOutline( varsp ) ;
}
}
necessary. */
static pascal ControlPartCode TPPaneFocusProc(ControlRef theControl, ControlFocusPart action) {
ControlPartCode focusResult;
necessary. */
static pascal ControlPartCode TPPaneFocusProc(ControlRef theControl, ControlFocusPart action) {
ControlPartCode focusResult;
focusResult = kControlFocusNoPart;
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(theControl);
if ( textctrl == NULL )
focusResult = kControlFocusNoPart;
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(theControl);
if ( textctrl == NULL )
be received. The constant kControlFocusNoPart will be received when our control
is the current focus and the user clicks in another control. In your focus routine,
you should respond to these codes as follows:
be received. The constant kControlFocusNoPart will be received when our control
is the current focus and the user clicks in another control. In your focus routine,
you should respond to these codes as follows:
kControlFocusNoPart - turn off focus and return kControlFocusNoPart. redraw
the control and the focus rectangle as necessary.
kControlFocusNoPart - turn off focus and return kControlFocusNoPart. redraw
the control and the focus rectangle as necessary.
kControlFocusPrevPart or kControlFocusNextPart - toggle focus on or off
depending on its current state. redraw the control and the focus rectangle
as appropriate for the new focus state. If the focus state is 'off', return the constant
kControlFocusPrevPart or kControlFocusNextPart - toggle focus on or off
depending on its current state. redraw the control and the focus rectangle
as appropriate for the new focus state. If the focus state is 'off', return the constant
{
wxMacWindowClipper c( textctrl ) ;
if ( !varsp->fNoBorders )
{
wxMacWindowClipper c( textctrl ) ;
if ( !varsp->fNoBorders )
- DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
+ DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
TPRedrawFocusOutline( varsp ) ;
}
return focusResult;
TPRedrawFocusOutline( varsp ) ;
}
return focusResult;
wxMacMLTEClassicControl::wxMacMLTEClassicControl( wxWindow *wxPeer,
const wxString& str,
const wxPoint& pos,
wxMacMLTEClassicControl::wxMacMLTEClassicControl( wxWindow *wxPeer,
const wxString& str,
const wxPoint& pos,
- const wxSize& size, long style )
+ const wxSize& size, long style )
{
m_font = wxPeer->GetFont() ;
m_windowStyle = style ;
{
m_font = wxPeer->GetFont() ;
m_windowStyle = style ;
- Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
+ Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
wxString st = str ;
wxMacConvertNewlines10To13( &st ) ;
wxString st = str ;
wxMacConvertNewlines10To13( &st ) ;
/* create the control */
verify_noerr( ::CreateUserPaneControl( MAC_WXHWND(wxPeer->GetParent()->MacGetTopLevelWindowRef()), &bounds, featurSet, &m_controlRef ) );
/* create the control */
verify_noerr( ::CreateUserPaneControl( MAC_WXHWND(wxPeer->GetParent()->MacGetTopLevelWindowRef()), &bounds, featurSet, &m_controlRef ) );
{
// wxMacWindowClipper c(wxPeer) ;
DoCreate();
}
{
// wxMacWindowClipper c(wxPeer) ;
DoCreate();
}
if ( wxPeer->MacIsReallyShown() )
MLTESetObjectVisibility( (STPTextPaneVars*) m_macTXNvars, true , style ) ;
{
if ( wxPeer->MacIsReallyShown() )
MLTESetObjectVisibility( (STPTextPaneVars*) m_macTXNvars, true , style ) ;
{
- // wxMacWindowClipper clipper( wxPeer ) ;
+ // wxMacWindowClipper clipper( wxPeer ) ;
TPUpdateVisibility( m_controlRef ) ;
TPUpdateVisibility( m_controlRef ) ;
TXNSetSelection( m_txn, 0, 0);
TXNShowSelection( m_txn, kTXNShowStart);
TXNSetSelection( m_txn, 0, 0);
TXNShowSelection( m_txn, kTXNShowStart);
AdjustCreationAttributes( *wxWHITE , true ) ;
}
AdjustCreationAttributes( *wxWHITE , true ) ;
}
-void wxMacMLTEClassicControl::VisibilityChanged(bool shown)
+void wxMacMLTEClassicControl::VisibilityChanged(bool shown)
{
MLTESetObjectVisibility((STPTextPaneVars*) m_macTXNvars , shown , m_windowStyle ) ;
if ( !shown )
InvalWindowRect( GetControlOwner( m_controlRef ) , &((STPTextPaneVars *)m_macTXNvars)->fRBounds ) ;
}
{
MLTESetObjectVisibility((STPTextPaneVars*) m_macTXNvars , shown , m_windowStyle ) ;
if ( !shown )
InvalWindowRect( GetControlOwner( m_controlRef ) , &((STPTextPaneVars *)m_macTXNvars)->fRBounds ) ;
}
-bool wxMacMLTEClassicControl::NeedsFocusRect() const
+bool wxMacMLTEClassicControl::NeedsFocusRect() const
WindowRef theWindow;
OSStatus err = noErr ;
WindowRef theWindow;
OSStatus err = noErr ;
/* set up our globals */
if (gTPDrawProc == NULL) gTPDrawProc = NewControlUserPaneDrawUPP(TPPaneDrawProc);
if (gTPHitProc == NULL) gTPHitProc = NewControlUserPaneHitTestUPP(TPPaneHitTestProc);
/* set up our globals */
if (gTPDrawProc == NULL) gTPDrawProc = NewControlUserPaneDrawUPP(TPPaneDrawProc);
if (gTPHitProc == NULL) gTPHitProc = NewControlUserPaneHitTestUPP(TPPaneHitTestProc);
if (gTPKeyProc == NULL) gTPKeyProc = NewControlUserPaneKeyDownUPP(TPPaneKeyDownProc);
if (gTPActivateProc == NULL) gTPActivateProc = NewControlUserPaneActivateUPP(TPPaneActivateProc);
if (gTPFocusProc == NULL) gTPFocusProc = NewControlUserPaneFocusUPP(TPPaneFocusProc);
if (gTPKeyProc == NULL) gTPKeyProc = NewControlUserPaneKeyDownUPP(TPPaneKeyDownProc);
if (gTPActivateProc == NULL) gTPActivateProc = NewControlUserPaneActivateUPP(TPPaneActivateProc);
if (gTPFocusProc == NULL) gTPFocusProc = NewControlUserPaneFocusUPP(TPPaneFocusProc);
/* allocate our private storage */
m_macTXNvars = (STPTextPaneVars *) malloc(sizeof(STPTextPaneVars));
/* allocate our private storage */
m_macTXNvars = (STPTextPaneVars *) malloc(sizeof(STPTextPaneVars));
/* set the initial settings for our private data */
m_macTXNvars->fMultiline = m_windowStyle & wxTE_MULTILINE ;
m_macTXNvars->fNoBorders = m_windowStyle & wxNO_BORDER ;
m_macTXNvars->fInFocus = false;
m_macTXNvars->fIsActive = true;
/* set the initial settings for our private data */
m_macTXNvars->fMultiline = m_windowStyle & wxTE_MULTILINE ;
m_macTXNvars->fNoBorders = m_windowStyle & wxNO_BORDER ;
m_macTXNvars->fInFocus = false;
m_macTXNvars->fIsActive = true;
- m_macTXNvars->fTXNObjectActive = false;
+ m_macTXNvars->fTXNObjectActive = false;
m_macTXNvars->fFocusDrawState = false ;
m_macTXNvars->fUserPaneRec = m_controlRef ;
m_macTXNvars->fVisible = true ;
m_macTXNvars->fFocusDrawState = false ;
m_macTXNvars->fUserPaneRec = m_controlRef ;
m_macTXNvars->fVisible = true ;
theWindow = m_macTXNvars->fOwner = GetControlOwner(m_controlRef);
theWindow = m_macTXNvars->fOwner = GetControlOwner(m_controlRef);
m_macTXNvars->fDrawingEnvironment = (GrafPtr) GetWindowPort(theWindow);
m_macTXNvars->fDrawingEnvironment = (GrafPtr) GetWindowPort(theWindow);
/* set up the user pane procedures */
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(gTPDrawProc), &gTPDrawProc);
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneHitTestProcTag, sizeof(gTPHitProc), &gTPHitProc);
/* set up the user pane procedures */
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(gTPDrawProc), &gTPDrawProc);
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneHitTestProcTag, sizeof(gTPHitProc), &gTPHitProc);
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneKeyDownProcTag, sizeof(gTPKeyProc), &gTPKeyProc);
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneActivateProcTag, sizeof(gTPActivateProc), &gTPActivateProc);
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneFocusProcTag, sizeof(gTPFocusProc), &gTPFocusProc);
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneKeyDownProcTag, sizeof(gTPKeyProc), &gTPKeyProc);
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneActivateProcTag, sizeof(gTPActivateProc), &gTPActivateProc);
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneFocusProcTag, sizeof(gTPFocusProc), &gTPFocusProc);
/* calculate the rectangles used by the control */
UMAGetControlBoundsInWindowCoords(m_controlRef, &bounds);
m_macTXNvars->fRTextOutlineRegion = NewRgn() ;
TPCalculateBounds( m_macTXNvars , bounds ) ;
/* calculate the rectangles used by the control */
UMAGetControlBoundsInWindowCoords(m_controlRef, &bounds);
m_macTXNvars->fRTextOutlineRegion = NewRgn() ;
TPCalculateBounds( m_macTXNvars , bounds ) ;
/* set up the drawing environment */
SetPort(m_macTXNvars->fDrawingEnvironment);
/* set up the drawing environment */
SetPort(m_macTXNvars->fDrawingEnvironment);
/* create the new edit field */
/* create the new edit field */
TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( m_windowStyle ) ;
TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( m_windowStyle ) ;
verify_noerr(TXNNewObject(NULL, m_macTXNvars->fOwner, &m_macTXNvars->fRTextArea,
frameOptions ,
kTXNTextEditStyleFrameType,
verify_noerr(TXNNewObject(NULL, m_macTXNvars->fOwner, &m_macTXNvars->fRTextArea,
frameOptions ,
kTXNTextEditStyleFrameType,
kTXNSystemDefaultEncoding,
&m_macTXNvars->fTXNRec, &m_macTXNvars->fTXNFrame, (TXNObjectRefcon) m_macTXNvars));
m_txn = m_macTXNvars->fTXNRec ;
kTXNSystemDefaultEncoding,
&m_macTXNvars->fTXNRec, &m_macTXNvars->fTXNFrame, (TXNObjectRefcon) m_macTXNvars));
m_txn = m_macTXNvars->fTXNRec ;
/* perform final activations and setup for our text field. Here,
we assume that the window is going to be the 'active' window. */
TPActivatePaneText(m_macTXNvars, m_macTXNvars->fIsActive && m_macTXNvars->fInFocus);
/* perform final activations and setup for our text field. Here,
we assume that the window is going to be the 'active' window. */
TPActivatePaneText(m_macTXNvars, m_macTXNvars->fIsActive && m_macTXNvars->fInFocus);
wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxWindow *wxPeer,
const wxString& str,
const wxPoint& pos,
wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxWindow *wxPeer,
const wxString& str,
const wxPoint& pos,
- const wxSize& size, long style )
+ const wxSize& size, long style )
{
m_font = wxPeer->GetFont() ;
m_windowStyle = style ;
{
m_font = wxPeer->GetFont() ;
m_windowStyle = style ;
- Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
+ Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
wxString st = str ;
wxMacConvertNewlines10To13( &st ) ;
wxString st = str ;
wxMacConvertNewlines10To13( &st ) ;
HIRect hr = { bounds.left , bounds.top , bounds.right - bounds.left , bounds.bottom- bounds.top } ;
m_scrollView = NULL ;
TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( style ) ;
if ( frameOptions & (kTXNWantVScrollBarMask|kTXNWantHScrollBarMask) )
{
HIRect hr = { bounds.left , bounds.top , bounds.right - bounds.left , bounds.bottom- bounds.top } ;
m_scrollView = NULL ;
TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( style ) ;
if ( frameOptions & (kTXNWantVScrollBarMask|kTXNWantHScrollBarMask) )
{
- HIScrollViewCreate(( frameOptions & kTXNWantHScrollBarMask ? kHIScrollViewOptionsHorizScroll : 0) |
+ HIScrollViewCreate(( frameOptions & kTXNWantHScrollBarMask ? kHIScrollViewOptionsHorizScroll : 0) |
( frameOptions & kTXNWantVScrollBarMask ? kHIScrollViewOptionsVertScroll: 0 ) , &m_scrollView ) ;
( frameOptions & kTXNWantVScrollBarMask ? kHIScrollViewOptionsVertScroll: 0 ) , &m_scrollView ) ;
-
- HIViewSetFrame( m_scrollView, &hr );
- HIViewSetVisible( m_scrollView, true );
+
+ HIViewSetFrame( m_scrollView, &hr );
+ HIViewSetVisible( m_scrollView, true );
m_textView = NULL ;
HITextViewCreate( NULL , 0, frameOptions , &m_textView ) ;
m_txn = HITextViewGetTXNObject( m_textView) ;
m_textView = NULL ;
HITextViewCreate( NULL , 0, frameOptions , &m_textView ) ;
m_txn = HITextViewGetTXNObject( m_textView) ;
- HIViewSetFrame( m_textView, &hr );
+ HIViewSetFrame( m_textView, &hr );
m_controlRef = m_textView ;
}
m_controlRef = m_textView ;
}
SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ;
TXNSetSelection( m_txn, 0, 0);
SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ;
TXNSetSelection( m_txn, 0, 0);
AdjustCreationAttributes( *wxWHITE , true ) ;
}
AdjustCreationAttributes( *wxWHITE , true ) ;
}
-OSStatus wxMacMLTEHIViewControl::SetFocus( ControlFocusPart focusPart )
+OSStatus wxMacMLTEHIViewControl::SetFocus( ControlFocusPart focusPart )
- return SetKeyboardFocus( GetControlOwner( m_textView ) ,
+ return SetKeyboardFocus( GetControlOwner( m_textView ) ,
m_textView , focusPart ) ;
}
m_textView , focusPart ) ;
}
-bool wxMacMLTEHIViewControl::HasFocus() const
+bool wxMacMLTEHIViewControl::HasFocus() const
{
ControlRef control ;
GetKeyboardFocus( GetUserFocusWindow() , &control ) ;
return control == m_textView ;
}
{
ControlRef control ;
GetKeyboardFocus( GetUserFocusWindow() , &control ) ;
return control == m_textView ;
}
-bool wxMacMLTEHIViewControl::NeedsFocusRect() const
+bool wxMacMLTEHIViewControl::NeedsFocusRect() const
{
return m_windowStyle & wxNO_BORDER ? false : true;
}
{
return m_windowStyle & wxNO_BORDER ? false : true;
}
bool wxComboBox::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
bool wxComboBox::Enable(bool enable)
{
if ( !wxControl::Enable(enable) )
}
bool wxComboBox::Show(bool show)
{
if ( !wxControl::Show(show) )
}
bool wxComboBox::Show(bool show)
{
if ( !wxControl::Show(show) )
}
void wxComboBox::SetFocus()
}
void wxComboBox::SetFocus()
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
wxDefaultValidator, name) )
{
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
wxDefaultValidator, name) )
{
}
m_choice = new wxComboBoxChoice(this, style );
}
m_choice = new wxComboBoxChoice(this, style );
m_choice->DoAppend( choices[ i ] );
}
m_choice->DoAppend( choices[ i ] );
}
}
wxString wxComboBox::GetValue() const
}
wxString wxComboBox::GetValue() const
-long wxComboBox::GetLastPosition() const
+wxTextPos wxComboBox::GetLastPosition() const
if (s > -1)
{
SetSelection (s);
if (s > -1)
{
SetSelection (s);
}
void wxComboBox::SetString(int n, const wxString& s)
}
void wxComboBox::SetString(int n, const wxString& s)
bool wxComboBox::IsEditable() const
{
bool wxComboBox::IsEditable() const
{
-
- return m_text != NULL && !HasFlag(wxCB_READONLY);
+ return m_text != NULL && !HasFlag(wxCB_READONLY);
}
void wxComboBox::Undo()
}
void wxComboBox::Undo()
else
TXNSetFrameBounds( varsp->fTXNRec, varsp->fRTextArea.top + 30000 , varsp->fRTextArea.left + 30000 ,
varsp->fRTextArea.bottom + 30000 , varsp->fRTextArea.right + 30000 , varsp->fTXNFrame);
else
TXNSetFrameBounds( varsp->fTXNRec, varsp->fRTextArea.top + 30000 , varsp->fRTextArea.left + 30000 ,
varsp->fRTextArea.bottom + 30000 , varsp->fRTextArea.right + 30000 , varsp->fTXNFrame);
}
if ( IsControlVisible( theControl ) )
}
if ( IsControlVisible( theControl ) )
/* restore the drawing environment */
/* draw the text frame and focus frame (if necessary) */
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
/* restore the drawing environment */
/* draw the text frame and focus frame (if necessary) */
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
- if ((**tpvars).fIsActive && varsp->fInFocus)
+ if ((**tpvars).fIsActive && varsp->fInFocus)
DrawThemeFocusRect(&varsp->fRFocusOutline, true);
/* release our globals */
HSetState((Handle) tpvars, state);
DrawThemeFocusRect(&varsp->fRFocusOutline, true);
/* release our globals */
HSetState((Handle) tpvars, state);
if ( IsControlVisible( theControl ) )
{
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
if ( IsControlVisible( theControl ) )
{
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive);
}
HSetState((Handle) tpvars, state);
DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive);
}
HSetState((Handle) tpvars, state);
if ( IsControlVisible( theControl ) )
{
/* save the drawing state */
if ( IsControlVisible( theControl ) )
{
/* save the drawing state */
- SetPort((**tpvars).fDrawingEnvironment);
- wxMacWindowClipper clipper( wxFindControlFromMacControl(theControl ) ) ;
+ SetPort((**tpvars).fDrawingEnvironment);
+ wxMacWindowClipper clipper( wxFindControlFromMacControl(theControl ) ) ;
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive && varsp->fInFocus);
}
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive && varsp->fInFocus);
}
{
#if wxUSE_UNICODE
#if SIZEOF_WCHAR_T == 2
{
#if wxUSE_UNICODE
#if SIZEOF_WCHAR_T == 2
- size_t len = st.Len() ;
+ size_t len = st.Len() ;
TXNSetData( txn , kTXNUnicodeTextData, (void*)st.wc_str(), len * 2,
start, end);
#else
TXNSetData( txn , kTXNUnicodeTextData, (void*)st.wc_str(), len * 2,
start, end);
#else
- wxMBConvUTF16BE converter ;
- ByteCount byteBufferLen = converter.WC2MB( NULL , st.wc_str() , 0 ) ;
- UniChar *unibuf = (UniChar*) malloc(byteBufferLen) ;
- converter.WC2MB( (char*) unibuf , st.wc_str() , byteBufferLen ) ;
+ wxMBConvUTF16BE converter ;
+ ByteCount byteBufferLen = converter.WC2MB( NULL , st.wc_str() , 0 ) ;
+ UniChar *unibuf = (UniChar*) malloc(byteBufferLen) ;
+ converter.WC2MB( (char*) unibuf , st.wc_str() , byteBufferLen ) ;
TXNSetData( txn , kTXNUnicodeTextData, (void*)unibuf, byteBufferLen ,
start, end);
TXNSetData( txn , kTXNUnicodeTextData, (void*)unibuf, byteBufferLen ,
start, end);
- wxCharBuffer text = st.mb_str(wxConvLocal) ;
+ wxCharBuffer text = st.mb_str(wxConvLocal) ;
TXNSetData( txn , kTXNTextData, (void*)text.data(), strlen( text ) ,
start, end);
TXNSetData( txn , kTXNTextData, (void*)text.data(), strlen( text ) ,
start, end);
// base initialization
if ( !wxTextCtrlBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) )
// base initialization
if ( !wxTextCtrlBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) )
wxSize mySize = size ;
if ( m_macUsesTXN )
wxSize mySize = size ;
if ( m_macUsesTXN )
if ( m_windowStyle & wxTE_READONLY)
{
if ( m_windowStyle & wxTE_READONLY)
{
- wxCharBuffer text = st.mb_str(wxConvLocal) ;
+ wxCharBuffer text = st.mb_str(wxConvLocal) ;
::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , strlen(text) , text ) ;
}
else
::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , strlen(text) , text ) ;
}
else
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
}
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
}
}
wxString wxTextCtrl::GetValue() const
}
wxString wxTextCtrl::GetValue() const
err = ::GetControlDataSize((ControlHandle) m_macControl, 0,
( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, &actualSize ) ;
err = ::GetControlDataSize((ControlHandle) m_macControl, 0,
( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, &actualSize ) ;
- if ( err )
- return wxEmptyString ;
+ if ( err )
+ return wxEmptyString ;
- if ( actualSize > 0 )
- {
- wxCharBuffer buf(actualSize) ;
+ if ( actualSize > 0 )
+ {
+ wxCharBuffer buf(actualSize) ;
::GetControlData( (ControlHandle) m_macControl, 0,
( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag,
actualSize , buf.data() , &actualSize ) ;
::GetControlData( (ControlHandle) m_macControl, 0,
( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag,
actualSize , buf.data() , &actualSize ) ;
if ( actualSize > 0 )
{
wxChar *ptr = result.GetWriteBuf(actualSize*sizeof(wxChar)) ;
if ( actualSize > 0 )
{
wxChar *ptr = result.GetWriteBuf(actualSize*sizeof(wxChar)) ;
wxStrncpy( ptr , (wxChar*) *theText , actualSize ) ;
#else
wxStrncpy( ptr , (wxChar*) *theText , actualSize ) ;
#else
- wxMBConvUTF16BE converter ;
- HLock( theText ) ;
- converter.MB2WC( ptr , (const char*)*theText , actualSize ) ;
- HUnlock( theText ) ;
+ wxMBConvUTF16BE converter ;
+ HLock( theText ) ;
+ converter.MB2WC( ptr , (const char*)*theText , actualSize ) ;
+ HUnlock( theText ) ;
#endif
ptr[actualSize] = 0 ;
result.UngetWriteBuf( actualSize *sizeof(wxChar) ) ;
#endif
ptr[actualSize] = 0 ;
result.UngetWriteBuf( actualSize *sizeof(wxChar) ) ;
wxMacConvertNewlines13To10( &st ) ;
if ( !m_macUsesTXN )
{
wxMacConvertNewlines13To10( &st ) ;
if ( !m_macUsesTXN )
{
- wxCharBuffer text = st.mb_str(wxConvLocal) ;
+ wxCharBuffer text = st.mb_str(wxConvLocal) ;
::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , strlen(text) , text ) ;
}
else
::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , strlen(text) , text ) ;
}
else
if ( !formerEditable )
SetEditable(formerEditable) ;
}
if ( !formerEditable )
SetEditable(formerEditable) ;
}
}
bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style)
{
wxTextCtrlBase::SetDefaultStyle( style ) ;
SetStyle( kTXNUseCurrentSelection , kTXNUseCurrentSelection , GetDefaultStyle() ) ;
}
bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style)
{
wxTextCtrlBase::SetDefaultStyle( style ) ;
SetStyle( kTXNUseCurrentSelection , kTXNUseCurrentSelection , GetDefaultStyle() ) ;
}
// Clipboard operations
}
// Clipboard operations
bool wxTextCtrl::CanPaste() const
{
if (!IsEditable())
bool wxTextCtrl::CanPaste() const
{
if (!IsEditable())
#if TARGET_CARBON
OSStatus err = noErr;
#if TARGET_CARBON
OSStatus err = noErr;
{
if (( err = GetScrapFlavorSize( scrapRef, 'TEXT', &byteCount )) == noErr)
{
{
if (( err = GetScrapFlavorSize( scrapRef, 'TEXT', &byteCount )) == noErr)
{
#else
long offset ;
if ( GetScrap( NULL , 'TEXT' , &offset ) > 0 )
{
#else
long offset ;
if ( GetScrap( NULL , 'TEXT' , &offset ) > 0 )
{
}
void wxTextCtrl::SetEditable(bool editable)
}
void wxTextCtrl::SetEditable(bool editable)
void wxTextCtrl::SetInsertionPointEnd()
{
void wxTextCtrl::SetInsertionPointEnd()
{
- long pos = GetLastPosition();
+ wxTextPos pos = GetLastPosition();
SetInsertionPoint(pos);
}
SetInsertionPoint(pos);
}
-long wxTextCtrl::GetLastPosition() const
+wxTextPos wxTextCtrl::GetLastPosition() const
ControlEditTextSelectionRec selection ;
if ((from == -1) && (to == -1))
{
ControlEditTextSelectionRec selection ;
if ((from == -1) && (to == -1))
{
- selection.selStart = 0 ;
- selection.selEnd = 32767 ;
- }
+ selection.selStart = 0 ;
+ selection.selEnd = 32767 ;
+ }
- selection.selStart = from ;
- selection.selEnd = to ;
- }
+ selection.selStart = from ;
+ selection.selEnd = to ;
+ }
TESetSelect( selection.selStart , selection.selEnd , ((TEHandle) m_macTE) ) ;
::SetControlData((ControlHandle) m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
TESetSelect( selection.selStart , selection.selEnd , ((TEHandle) m_macTE) ) ;
::SetControlData((ControlHandle) m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
SetPort((**tpvars).fDrawingEnvironment);
/* change the selection */
if ((from == -1) && (to == -1))
SetPort((**tpvars).fDrawingEnvironment);
/* change the selection */
if ((from == -1) && (to == -1))
- TXNSelectAll((TXNObject) m_macTXN);
+ TXNSelectAll((TXNObject) m_macTXN);
- TXNSetSelection( (**tpvars).fTXNRec, from, to);
+ TXNSetSelection( (**tpvars).fTXNRec, from, to);
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
}
}
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
}
}
{
if ( wxTextCtrlBase::LoadFile(file) )
{
{
if ( wxTextCtrlBase::LoadFile(file) )
{
}
void wxTextCtrl::WriteText(const wxString& str)
}
void wxTextCtrl::WriteText(const wxString& str)
wxMacConvertNewlines13To10( &st ) ;
if ( !m_macUsesTXN )
{
wxMacConvertNewlines13To10( &st ) ;
if ( !m_macUsesTXN )
{
- wxCharBuffer text = st.mb_str(wxConvLocal) ;
+ wxCharBuffer text = st.mb_str(wxConvLocal) ;
TEInsert( text , strlen(text) , ((TEHandle) m_macTE) ) ;
}
else
TEInsert( text , strlen(text) , ((TEHandle) m_macTE) ) ;
}
else
- TXNUndo((TXNObject)m_macTXN);
+ TXNUndo((TXNObject)m_macTXN);
- TXNRedo((TXNObject)m_macTXN);
+ TXNRedo((TXNObject)m_macTXN);
}
}
}
bool wxTextCtrl::CanUndo() const
{
}
}
}
bool wxTextCtrl::CanUndo() const
{
- return TXNCanUndo((TXNObject)m_macTXN,NULL);
+ return TXNCanUndo((TXNObject)m_macTXN,NULL);
}
bool wxTextCtrl::CanRedo() const
{
}
bool wxTextCtrl::CanRedo() const
{
- return TXNCanRedo((TXNObject)m_macTXN,NULL);
+ return TXNCanRedo((TXNObject)m_macTXN,NULL);
}
// Makes modifie or unmodified
}
// Makes modifie or unmodified
int wxTextCtrl::GetNumberOfLines() const
{
int wxTextCtrl::GetNumberOfLines() const
{
{
ItemCount lines ;
TXNGetLineCount((TXNObject)m_macTXN, &lines ) ;
return lines ;
}
else
{
ItemCount lines ;
TXNGetLineCount((TXNObject)m_macTXN, &lines ) ;
return lines ;
}
else
wxString content = GetValue() ;
int count = 1;
wxString content = GetValue() ;
int count = 1;
bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
{
bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
{
}
void wxTextCtrl::ShowPosition(long pos)
{
#if TARGET_RT_MAC_MACHO && defined(AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
}
void wxTextCtrl::ShowPosition(long pos)
{
#if TARGET_RT_MAC_MACHO && defined(AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER)
{
Point current ;
Point desired ;
{
Point current ;
Point desired ;
SInt32 dv = desired.v - current.v ;
SInt32 dh = desired.h - current.h ;
TXNShowSelection( (TXNObject) m_macTXN , true ) ;
SInt32 dv = desired.v - current.v ;
SInt32 dh = desired.h - current.h ;
TXNShowSelection( (TXNObject) m_macTXN , true ) ;
- theErr = TXNScroll( (TXNObject) m_macTXN, kTXNScrollUnitsInPixels , kTXNScrollUnitsInPixels , &dv , &dh );
+ theErr = TXNScroll( (TXNObject) m_macTXN, kTXNScrollUnitsInPixels , kTXNScrollUnitsInPixels , &dv , &dh );
wxASSERT_MSG( theErr == noErr, _T("TXNScroll returned an error!") );
}
}
wxASSERT_MSG( theErr == noErr, _T("TXNScroll returned an error!") );
}
}
// this will make wxWidgets eat the ENTER key so that
// we actually prevent line wrapping in a single line
// text control
// this will make wxWidgets eat the ENTER key so that
// we actually prevent line wrapping in a single line
// text control
#if TARGET_CARBON
if ( m_macUsesTXN && wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL )
CallNextEventHandler((EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef() , (EventRef) wxTheApp->MacGetCurrentEvent() ) ;
#if TARGET_CARBON
if ( m_macUsesTXN && wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL )
CallNextEventHandler((EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef() , (EventRef) wxTheApp->MacGetCurrentEvent() ) ;
{
EventRecord rec ;
if ( wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) )
{
EventRecord rec ;
if ( wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) )
const wxString& name)
{
if( !CreateControl( parent, id, pos, size, style, validator, name ) )
const wxString& name)
{
if( !CreateControl( parent, id, pos, size, style, validator, name ) )
XtAddCallback (buttonWidget, XmNselectionCallback, (XtCallbackProc) wxComboBoxCallback,
(XtPointer) this);
XtAddCallback (buttonWidget, XmNselectionCallback, (XtCallbackProc) wxComboBoxCallback,
(XtPointer) this);
ChangeBackgroundColour();
ChangeBackgroundColour();
}
bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
}
bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
const wxString& name)
{
wxCArrayString chs(choices);
const wxString& name)
{
wxCArrayString chs(choices);
- return Create(parent, id, value, pos, size, chs.GetCount(),
+ return Create(parent, id, value, pos, size, chs.GetCount(),
chs.GetStrings(), style, validator, name);
}
chs.GetStrings(), style, validator, name);
}
void wxComboBox::SetValue(const wxString& value)
{
void wxComboBox::SetValue(const wxString& value)
{
if( !value.empty() )
XmComboBoxSetString( (Widget)m_mainWidget,
wxConstCast(value.c_str(), char) );
if( !value.empty() )
XmComboBoxSetString( (Widget)m_mainWidget,
wxConstCast(value.c_str(), char) );
}
void wxComboBox::SetString(int n, const wxString& s)
}
void wxComboBox::SetString(int n, const wxString& s)
return (long) XmComboBoxGetInsertionPosition ((Widget) m_mainWidget);
}
return (long) XmComboBoxGetInsertionPosition ((Widget) m_mainWidget);
}
-long wxComboBox::GetLastPosition() const
+wxTextPos wxComboBox::GetLastPosition() const
- return (long) XmComboBoxGetLastPosition ((Widget) m_mainWidget);
+ return (wxTextPos) XmComboBoxGetLastPosition ((Widget) m_mainWidget);
}
void wxComboBox::Replace(long from, long to, const wxString& value)
}
void wxComboBox::Replace(long from, long to, const wxString& value)
Widget buttonWidget= XtVaCreateManagedWidget(name.c_str(),
xmComboBoxWidgetClass, parentWidget,
Widget buttonWidget= XtVaCreateManagedWidget(name.c_str(),
xmComboBoxWidgetClass, parentWidget,
- XmNcomboBoxType, cb_type,
+ XmNcomboBoxType, cb_type,
NULL);
m_mainWidget = (Widget) buttonWidget;
NULL);
m_mainWidget = (Widget) buttonWidget;
const wxString& name)
{
wxCArrayString chs(choices);
const wxString& name)
{
wxCArrayString chs(choices);
- return Create(parent, id, value, pos, size, chs.GetCount(),
+ return Create(parent, id, value, pos, size, chs.GetCount(),
chs.GetStrings(), style, validator, name);
}
chs.GetStrings(), style, validator, name);
}
#else
while(m_noStrings > 0)
{
#else
while(m_noStrings > 0)
{
- XmComboBoxDeletePos((Widget) m_mainWidget, m_noStrings--);
+ XmComboBoxDeletePos((Widget) m_mainWidget, m_noStrings--);
return (long)XmTextGetInsertionPosition( GetXmText(this) );
}
return (long)XmTextGetInsertionPosition( GetXmText(this) );
}
-long wxComboBox::GetLastPosition() const
+wxTextPos wxComboBox::GetLastPosition() const
{
XmTextPosition pos = XmTextGetLastPosition( GetXmText(this) );
return (long)pos;
{
XmTextPosition pos = XmTextGetLastPosition( GetXmText(this) );
return (long)pos;
wxTextCtrl::wxTextCtrl()
{
m_tempCallbackStruct = (void*) NULL;
wxTextCtrl::wxTextCtrl()
{
m_tempCallbackStruct = (void*) NULL;
- m_modified = FALSE;
- m_processedDefault = FALSE;
+ m_modified = false;
+ m_processedDefault = false;
}
bool wxTextCtrl::Create(wxWindow *parent,
}
bool wxTextCtrl::Create(wxWindow *parent,
return false;
m_tempCallbackStruct = (void*) NULL;
return false;
m_tempCallbackStruct = (void*) NULL;
- m_modified = FALSE;
- m_processedDefault = FALSE;
+ m_modified = false;
+ m_processedDefault = false;
m_backgroundColour = *wxWHITE;
m_backgroundColour = *wxWHITE;
XmNvalue, wxConstCast(value.c_str(), char),
NULL);
}
XmNvalue, wxConstCast(value.c_str(), char),
NULL);
}
// install callbacks
XtAddCallback((Widget) m_mainWidget, XmNvalueChangedCallback, (XtCallbackProc)wxTextWindowChangedProc, (XtPointer)this);
// install callbacks
XtAddCallback((Widget) m_mainWidget, XmNvalueChangedCallback, (XtCallbackProc)wxTextWindowChangedProc, (XtPointer)this);
XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this);
// font
XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this);
// font
wxSize best = GetBestSize();
if( size.x != -1 ) best.x = size.x;
wxSize best = GetBestSize();
if( size.x != -1 ) best.x = size.x;
ChangeBackgroundColour();
ChangeBackgroundColour();
}
WXWidget wxTextCtrl::GetTopWidget() const
}
WXWidget wxTextCtrl::GetTopWidget() const
void wxTextCtrl::SetValue(const wxString& value)
{
void wxTextCtrl::SetValue(const wxString& value)
{
// do this instead... MB
//
// do this instead... MB
//
Clear();
AppendText( value );
Clear();
AppendText( value );
}
// Clipboard operations
}
// Clipboard operations
bool wxTextCtrl::CanUndo() const
{
// No Undo in Motif
bool wxTextCtrl::CanUndo() const
{
// No Undo in Motif
}
bool wxTextCtrl::CanRedo() const
{
// No Redo in Motif
}
bool wxTextCtrl::CanRedo() const
{
// No Redo in Motif
}
// If the return values from and to are the same, there is no
}
// If the return values from and to are the same, there is no
void wxTextCtrl::SetInsertionPointEnd()
{
void wxTextCtrl::SetInsertionPointEnd()
{
- long pos = GetLastPosition();
+ wxTextPos pos = GetLastPosition();
SetInsertionPoint(pos);
}
SetInsertionPoint(pos);
}
return (long) XmTextGetInsertionPosition ((Widget) m_mainWidget);
}
return (long) XmTextGetInsertionPosition ((Widget) m_mainWidget);
}
-long wxTextCtrl::GetLastPosition() const
+wxTextPos wxTextCtrl::GetLastPosition() const
{
return (long) XmTextGetLastPosition ((Widget) m_mainWidget);
}
{
return (long) XmTextGetLastPosition ((Widget) m_mainWidget);
}
XtVaSetValues ((Widget) m_mainWidget, XmNcursorPosition, textPosition, NULL);
SetInsertionPoint(textPosition);
XmTextShowPosition ((Widget) m_mainWidget, textPosition);
XtVaSetValues ((Widget) m_mainWidget, XmNcursorPosition, textPosition, NULL);
SetInsertionPoint(textPosition);
XmTextShowPosition ((Widget) m_mainWidget, textPosition);
}
void wxTextCtrl::AppendText(const wxString& text)
{
}
void wxTextCtrl::AppendText(const wxString& text)
{
- long textPosition = GetLastPosition() + text.length();
+ wxTextPos textPosition = GetLastPosition() + text.length();
XmTextInsert ((Widget) m_mainWidget, GetLastPosition(),
wxConstCast(text.c_str(), char));
XtVaSetValues ((Widget) m_mainWidget, XmNcursorPosition, textPosition, NULL);
SetInsertionPoint(textPosition);
XmTextShowPosition ((Widget) m_mainWidget, textPosition);
XmTextInsert ((Widget) m_mainWidget, GetLastPosition(),
wxConstCast(text.c_str(), char));
XtVaSetValues ((Widget) m_mainWidget, XmNcursorPosition, textPosition, NULL);
SetInsertionPoint(textPosition);
XmTextShowPosition ((Widget) m_mainWidget, textPosition);
}
void wxTextCtrl::Clear()
{
XmTextSetString ((Widget) m_mainWidget, "");
}
void wxTextCtrl::Clear()
{
XmTextSetString ((Widget) m_mainWidget, "");
}
bool wxTextCtrl::IsModified() const
}
bool wxTextCtrl::IsModified() const
// Makes modified or unmodified
void wxTextCtrl::MarkDirty()
{
// Makes modified or unmodified
void wxTextCtrl::MarkDirty()
{
}
void wxTextCtrl::DiscardEdits()
{
}
void wxTextCtrl::DiscardEdits()
{
}
int wxTextCtrl::GetNumberOfLines() const
}
int wxTextCtrl::GetNumberOfLines() const
{
long i = 0;
int currentLine = 0;
{
long i = 0;
int currentLine = 0;
while (!finished)
{
int ch = s[i];
while (!finished)
{
int ch = s[i];
}
void wxTextCtrl::ShowPosition(long pos)
}
void wxTextCtrl::ShowPosition(long pos)
// Indicates that we should generate a normal command, because
// we're letting default behaviour happen (otherwise it's vetoed
// by virtue of overriding OnChar)
// Indicates that we should generate a normal command, because
// we're letting default behaviour happen (otherwise it's vetoed
// by virtue of overriding OnChar)
- m_processedDefault = TRUE;
+ m_processedDefault = true;
if (m_tempCallbackStruct)
{
if (m_tempCallbackStruct)
{
NULL);
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
if (hsb)
NULL);
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
if (hsb)
- wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE);
+ wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, true);
- wxDoChangeBackgroundColour((WXWidget) vsb, backgroundColour, TRUE);
+ wxDoChangeBackgroundColour((WXWidget) vsb, backgroundColour, true);
// MBN: why change parent background?
// MBN: why change parent background?
- // DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
+ // DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, true);
return wxSize( x + 2 * xmargin + 2 * highlight + 2 * shadow,
// MBN: +2 necessary: Lesstif bug or mine?
return wxSize( x + 2 * xmargin + 2 * highlight + 2 * shadow,
// MBN: +2 necessary: Lesstif bug or mine?
- y + 2 * ymargin + 2 * highlight + 2 * shadow + 2 );
+ y + 2 * ymargin + 2 * highlight + 2 * shadow + 2 );
}
wxSize wxTextCtrl::DoGetBestSize() const
}
wxSize wxTextCtrl::DoGetBestSize() const
return;
wxTextCtrl *tw = (wxTextCtrl *) clientData;
return;
wxTextCtrl *tw = (wxTextCtrl *) clientData;
}
static void
wxTextWindowModifyProc (Widget WXUNUSED(w), XtPointer clientData, XmTextVerifyCallbackStruct *cbs)
{
wxTextCtrl *tw = (wxTextCtrl *) clientData;
}
static void
wxTextWindowModifyProc (Widget WXUNUSED(w), XtPointer clientData, XmTextVerifyCallbackStruct *cbs)
{
wxTextCtrl *tw = (wxTextCtrl *) clientData;
- tw->m_processedDefault = FALSE;
+ tw->m_processedDefault = false;
// First, do some stuff if it's a password control: in this case, we need
// to store the string inside the class because GetValue() can't retrieve
// First, do some stuff if it's a password control: in this case, we need
// to store the string inside the class because GetValue() can't retrieve
// setting insertion point doesn't make sense for read only comboboxes
if ( !(GetWindowStyle() & wxCB_READONLY) )
{
// setting insertion point doesn't make sense for read only comboboxes
if ( !(GetWindowStyle() & wxCB_READONLY) )
{
- long pos = GetLastPosition();
+ wxTextPos pos = GetLastPosition();
SetInsertionPoint(pos);
}
}
SetInsertionPoint(pos);
}
}
-long wxComboBox::GetLastPosition() const
+wxTextPos wxComboBox::GetLastPosition() const
{
HWND hEditWnd = (HWND) GetEditHWND();
// Get number of characters in the last (only) line. We'll add this to the character
// index for the last line, 1st position.
{
HWND hEditWnd = (HWND) GetEditHWND();
// Get number of characters in the last (only) line. We'll add this to the character
// index for the last line, 1st position.
- int lineLength = (int)SendMessage(hEditWnd, EM_LINELENGTH, (WPARAM) 0, (LPARAM)0L);
+ wxTextPos lineLength = (wxTextPos)SendMessage(hEditWnd, EM_LINELENGTH, (WPARAM) 0, (LPARAM)0L);
- return (long)(lineLength);
}
void wxComboBox::Replace(long from, long to, const wxString& value)
}
void wxComboBox::Replace(long from, long to, const wxString& value)
-long wxTextCtrl::GetLastPosition() const
+wxTextPos wxTextCtrl::GetLastPosition() const
{
int numLines = GetNumberOfLines();
long posStartLastLine = XYToPosition(0, numLines - 1);
{
int numLines = GetNumberOfLines();
long posStartLastLine = XYToPosition(0, numLines - 1);
// Default colors for MSW text control
//
// Set default background color to the native white instead of
// Default colors for MSW text control
//
// Set default background color to the native white instead of
-// the default wxSYS_COLOUR_BTNFACE (is triggered with wxNullColour).
+// the default wxSYS_COLOUR_BTNFACE (is triggered with wxNullColour).
// ----------------------------------------------------------------------------
wxVisualAttributes wxTextCtrl::GetDefaultAttributes() const
// ----------------------------------------------------------------------------
wxVisualAttributes wxTextCtrl::GetDefaultAttributes() const
{
// we have to do this or the style wouldn't apply for the text typed by
// the user
{
// we have to do this or the style wouldn't apply for the text typed by
// the user
- long posLast = GetLastPosition();
+ wxTextPos posLast = GetLastPosition();
SetStyle(posLast, posLast, m_defaultStyle);
}
SetStyle(posLast, posLast, m_defaultStyle);
}
wxStrcpy(lf.lfFaceName, cf.szFaceName);
//NOTE: we _MUST_ set each of these values to _something_ since we
wxStrcpy(lf.lfFaceName, cf.szFaceName);
//NOTE: we _MUST_ set each of these values to _something_ since we
- //do not call wxZeroMemory on the LOGFONT lf
+ //do not call wxZeroMemory on the LOGFONT lf
if (cf.dwEffects & CFE_ITALIC)
lf.lfItalic = TRUE;
else
if (cf.dwEffects & CFE_ITALIC)
lf.lfItalic = TRUE;
else
-long wxTextCtrl::GetLastPosition() const
+wxTextPos wxTextCtrl::GetLastPosition() const
{
int numLines = GetNumberOfLines();
long posStartLastLine = XYToPosition(0, numLines - 1);
{
int numLines = GetNumberOfLines();
long posStartLastLine = XYToPosition(0, numLines - 1);
}
//
// There is no return value for the CBN_ notifications, so always return
}
//
// There is no return value for the CBN_ notifications, so always return
- // FALSE from here to pass the message to DefWindowProc()
+ // false from here to pass the message to DefWindowProc()
} // end of wxComboBox::OS2Command
bool wxComboBox::Create(
} // end of wxComboBox::OS2Command
bool wxComboBox::Create(
, const wxString& rsName
)
{
, const wxString& rsName
)
{
if (!CreateControl( pParent
,vId
if (!CreateControl( pParent
,vId
//
// Get the right style
//
// Get the right style
if (!OS2CreateControl( "COMBOBOX"
,lSstyle
))
if (!OS2CreateControl( "COMBOBOX"
,lSstyle
))
//
// A choice/combobox normally has a white background (or other, depending
//
// A choice/combobox normally has a white background (or other, depending
- if (!rsValue.IsEmpty())
,(PFNWP)wxComboEditWndProc
);
::WinSetWindowULong(GetHwnd(), QWL_USER, (ULONG)this);
,(PFNWP)wxComboEditWndProc
);
::WinSetWindowULong(GetHwnd(), QWL_USER, (ULONG)this);
- Show(TRUE);
- return TRUE;
+ Show(true);
+ return true;
} // end of wxComboBox::Create
void wxComboBox::SetValue(
} // end of wxComboBox::Create
void wxComboBox::SetValue(
void wxComboBox::SetInsertionPointEnd()
{
void wxComboBox::SetInsertionPointEnd()
{
- long lPos = GetLastPosition();
+ wxTextPos lPos = GetLastPosition();
SetInsertionPoint(lPos);
} // end of wxComboBox::SetInsertionPointEnd
SetInsertionPoint(lPos);
} // end of wxComboBox::SetInsertionPointEnd
return lPos;
} // end of wxComboBox::GetInsertionPoint
return lPos;
} // end of wxComboBox::GetInsertionPoint
-long wxComboBox::GetLastPosition() const
+wxTextPos wxComboBox::GetLastPosition() const
{
long lLineLength = 0L;
WNDPARAMS vParams;
{
long lLineLength = 0L;
WNDPARAMS vParams;
case KC_CHAR:
return (HandleChar( wParam
,lParam
case KC_CHAR:
return (HandleChar( wParam
,lParam
return(HandleKillFocus((WXHWND)(HWND)wParam));
break;
}
return(HandleKillFocus((WXHWND)(HWND)wParam));
break;
}
} // end of WinGuiBase_CComboBox::ProcessEditMsg
MRESULT EXPENTRY wxComboEditWndProc(
} // end of WinGuiBase_CComboBox::ProcessEditMsg
MRESULT EXPENTRY wxComboEditWndProc(
wxPoint vPos = rPos; // The OS/2 position
SWP vSwp;
wxPoint vPos = rPos; // The OS/2 position
SWP vSwp;
}
m_windowStyle = lStyle;
}
m_windowStyle = lStyle;
long lSstyle = WS_VISIBLE | WS_TABSTOP;
long lSstyle = WS_VISIBLE | WS_TABSTOP;
if ( m_windowStyle & wxTE_MULTILINE )
{
lSstyle |= MLS_BORDER | MLS_WORDWRAP;
if ( m_windowStyle & wxTE_MULTILINE )
{
lSstyle |= MLS_BORDER | MLS_WORDWRAP;
if ((m_windowStyle & wxTE_NO_VSCROLL) == 0)
lSstyle |= MLS_VSCROLL;
if ((m_windowStyle & wxTE_NO_VSCROLL) == 0)
lSstyle |= MLS_VSCROLL;
}
SubclassWin(GetHWND());
}
SubclassWin(GetHWND());
,wxNORMAL
);
SetFont(*pTextFont);
,wxNORMAL
);
SetFont(*pTextFont);
- if (!rsValue.IsEmpty())
,rSize.y
);
delete pTextFont;
,rSize.y
);
delete pTextFont;
} // end of wxTextCtrl::Create
//
} // end of wxTextCtrl::Create
//
bool wxTextCtrl::CanPaste() const
{
bool wxTextCtrl::CanPaste() const
{
- bool bIsTextAvailable = FALSE;
+ bool bIsTextAvailable = false;
//
// Check for straight text on clipboard
//
// Check for straight text on clipboard
void wxTextCtrl::SetInsertionPointEnd()
{
void wxTextCtrl::SetInsertionPointEnd()
{
- long lPos = GetLastPosition();
+ wxTextPos lPos = GetLastPosition();
//
// We must not do anything if the caret is already there because calling
//
// We must not do anything if the caret is already there because calling
return (dwPos & 0xFFFF);
} // end of wxTextCtrl::GetInsertionPoint
return (dwPos & 0xFFFF);
} // end of wxTextCtrl::GetInsertionPoint
-long wxTextCtrl::GetLastPosition() const
+wxTextPos wxTextCtrl::GetLastPosition() const
{
HWND hWnd = GetHwnd();
long lCharIndex;
{
HWND hWnd = GetHwnd();
long lCharIndex;
// Update the size limit if needed
//
AdjustSpaceLimit();
// Update the size limit if needed
//
AdjustSpaceLimit();
} // end of wxTextCtrl::LoadFile
bool wxTextCtrl::IsModified() const
} // end of wxTextCtrl::LoadFile
bool wxTextCtrl::IsModified() const
if (nLineNo == -1)
{
// no such line
if (nLineNo == -1)
{
// no such line
} // end of wxTextCtrl::PositionToXY
void wxTextCtrl::ShowPosition(
} // end of wxTextCtrl::PositionToXY
void wxTextCtrl::ShowPosition(
if (m_bIsMLE)
bOk = (::WinSendMsg(GetHwnd(), MLM_QUERYUNDO, 0, 0) != 0);
else
if (m_bIsMLE)
bOk = (::WinSendMsg(GetHwnd(), MLM_QUERYUNDO, 0, 0) != 0);
else
- bOk = FALSE; // can't undo regular edit fields in PM
+ bOk = false; // can't undo regular edit fields in PM
return bOk;
} // end of wxTextCtrl::CanUndo
return bOk;
} // end of wxTextCtrl::CanUndo
if (m_bIsMLE)
bOk = (::WinSendMsg(GetHwnd(), MLM_QUERYUNDO, 0, 0) != 0);
else
if (m_bIsMLE)
bOk = (::WinSendMsg(GetHwnd(), MLM_QUERYUNDO, 0, 0) != 0);
else
- bOk = FALSE; // can't undo regular edit fields in PM
+ bOk = false; // can't undo regular edit fields in PM
return bOk;
} // end of wxTextCtrl::CanRedo
return bOk;
} // end of wxTextCtrl::CanRedo
wxNavigationKeyEvent vEventNav;
vEventNav.SetDirection(!rEvent.ShiftDown());
wxNavigationKeyEvent vEventNav;
vEventNav.SetDirection(!rEvent.ShiftDown());
- vEventNav.SetWindowChange(FALSE);
+ vEventNav.SetWindowChange(false);
vEventNav.SetEventObject(this);
if ( GetEventHandler()->ProcessEvent(vEventNav) )
vEventNav.SetEventObject(this);
if ( GetEventHandler()->ProcessEvent(vEventNav) )
case EN_SCROLL:
case EN_INSERTMODETOGGLE:
case EN_MEMERROR:
case EN_SCROLL:
case EN_INSERTMODETOGGLE:
case EN_MEMERROR:
} // end of wxTextCtrl::OS2Command
void wxTextCtrl::AdjustSpaceLimit()
} // end of wxTextCtrl::OS2Command
void wxTextCtrl::AdjustSpaceLimit()
WNDPARAMS vParams;
vParams.fsStatus = WPM_CBCTLDATA;
WNDPARAMS vParams;
vParams.fsStatus = WPM_CBCTLDATA;
- vParams.pCtlData = &Efd;
+ vParams.pCtlData = &Efd;
vParams.cbCtlData = sizeof(ENTRYFDATA);
if (::WinSendMsg( GetHwnd()
vParams.cbCtlData = sizeof(ENTRYFDATA);
if (::WinSendMsg( GetHwnd()
{
if (m_bIsMLE)
::WinSendMsg(GetHwnd(), MLM_SETBACKCOLOR, (MPARAM)rColour.GetPixel(), MLE_INDEX);
{
if (m_bIsMLE)
::WinSendMsg(GetHwnd(), MLM_SETBACKCOLOR, (MPARAM)rColour.GetPixel(), MLE_INDEX);
} // end of wxTextCtrl::SetBackgroundColour
bool wxTextCtrl::SetForegroundColour(
} // end of wxTextCtrl::SetBackgroundColour
bool wxTextCtrl::SetForegroundColour(
{
if (m_bIsMLE)
::WinSendMsg(GetHwnd(), MLM_SETTEXTCOLOR, (MPARAM)rColour.GetPixel(), MLE_INDEX);
{
if (m_bIsMLE)
::WinSendMsg(GetHwnd(), MLM_SETTEXTCOLOR, (MPARAM)rColour.GetPixel(), MLE_INDEX);
} // end of wxTextCtrl::SetForegroundColour
bool wxTextCtrl::SetStyle(
} // end of wxTextCtrl::SetForegroundColour
bool wxTextCtrl::SetStyle(
//
// TODO:: finish this part
//
//
// TODO:: finish this part
//
} // end of wxTextCtrl::SetStyle
} // end of wxTextCtrl::SetStyle
-long wxComboBox::GetLastPosition() const
+wxTextPos wxComboBox::GetLastPosition() const
bool wxComboBox::IsEditable() const
{
bool wxComboBox::IsEditable() const
{
}
void wxComboBox::Undo()
}
void wxComboBox::Undo()
bool wxComboBox::CanCopy() const
{
bool wxComboBox::CanCopy() const
{
}
bool wxComboBox::CanCut() const
{
}
bool wxComboBox::CanCut() const
{
}
bool wxComboBox::CanPaste() const
{
}
bool wxComboBox::CanPaste() const
{
}
bool wxComboBox::CanUndo() const
{
}
bool wxComboBox::CanUndo() const
{
}
bool wxComboBox::CanRedo() const
{
}
bool wxComboBox::CanRedo() const
{
-long wxTextCtrl::GetLastPosition() const
+wxTextPos wxTextCtrl::GetLastPosition() const
return GetText()->GetInsertionPoint();
}
return GetText()->GetInsertionPoint();
}
-long wxComboBox::GetLastPosition() const
+wxTextPos wxComboBox::GetLastPosition() const
{
return GetText()->GetLastPosition();
}
{
return GetText()->GetLastPosition();
}
bool wxComboBox::IsEditable() const
{
bool wxComboBox::IsEditable() const
{
- return GetText() != NULL && (!HasFlag(wxCB_READONLY) || GetText()->IsEditable());
+ return GetText() != NULL && (!HasFlag(wxCB_READONLY) || GetText()->IsEditable());
}
void wxComboBox::Undo()
}
void wxComboBox::Undo()
is true in which case a single LINE may correspond to multiple ROWs.
A text position is an unsigned int (which for reasons of compatibility is
is true in which case a single LINE may correspond to multiple ROWs.
A text position is an unsigned int (which for reasons of compatibility is
- still a long) from 0 to GetLastPosition() inclusive. The positions
+ still a long as wxTextPos) from 0 to GetLastPosition() inclusive. The positions
correspond to the gaps between the letters so the position 0 is just
before the first character and the last position is the one beyond the last
character. For an empty text control GetLastPosition() returns 0.
correspond to the gaps between the letters so the position 0 is just
before the first character and the last position is the one beyond the last
character. For an empty text control GetLastPosition() returns 0.
// the value which is never used for text position, even not -1 which is
// sometimes used for some special meaning
// the value which is never used for text position, even not -1 which is
// sometimes used for some special meaning
-static const wxTextPos INVALID_POS_VALUE = -2;
+static const wxTextPos INVALID_POS_VALUE = wxInvalidTextCoord;
// overlap between pages (when using PageUp/Dn) in lines
static const size_t PAGE_OVERLAP_IN_LINES = 1;
// overlap between pages (when using PageUp/Dn) in lines
static const size_t PAGE_OVERLAP_IN_LINES = 1;
// if they are out of range
if ( IsSingleLine() )
{
// if they are out of range
if ( IsSingleLine() )
{
- return x > GetLastPosition() || y > 0 ? wxDefaultCoord : x;
+ return ( x > GetLastPosition() || y > 0 ) ? wxOutOfRangeTextCoord : x;
m_y1 = y1;
m_y2 = y2;
m_owner = owner;
m_y1 = y1;
m_y2 = y2;
m_owner = owner;
m_cursorX = m_owner->GetCursorX();
m_cursorY = m_owner->GetCursorY();
m_cursorX = m_owner->GetCursorX();
m_cursorY = m_owner->GetCursorY();
if (m_type == wxSOURCE_UNDO_LINE)
{
m_text = m_owner->m_lines[m_y1].m_text;
if (m_type == wxSOURCE_UNDO_LINE)
{
m_text = m_owner->m_lines[m_y1].m_text;
EVT_MOUSE_EVENTS(wxTextCtrl::OnMouse)
EVT_KILL_FOCUS(wxTextCtrl::OnKillFocus)
EVT_SET_FOCUS(wxTextCtrl::OnSetFocus)
EVT_MOUSE_EVENTS(wxTextCtrl::OnMouse)
EVT_KILL_FOCUS(wxTextCtrl::OnKillFocus)
EVT_SET_FOCUS(wxTextCtrl::OnSetFocus)
EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy)
EVT_MENU(wxID_PASTE, wxTextCtrl::OnPaste)
EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy)
EVT_MENU(wxID_PASTE, wxTextCtrl::OnPaste)
void wxTextCtrl::Init()
{
void wxTextCtrl::Init()
{
- m_editable = TRUE;
- m_modified = FALSE;
-
+ m_editable = true;
+ m_modified = false;
+
m_lang = wxSOURCE_LANG_NONE;
m_lang = wxSOURCE_LANG_NONE;
-
- m_capturing = FALSE;
-
+
+ m_capturing = false;
+
m_cursorX = 0;
m_cursorY = 0;
m_cursorX = 0;
m_cursorY = 0;
m_bracketX = -1;
m_bracketY = -1;
m_bracketX = -1;
m_bracketY = -1;
-
- m_overwrite = FALSE;
- m_ignoreInput = FALSE;
-
+
+ m_overwrite = false;
+ m_ignoreInput = false;
+
m_keywordColour = wxColour( 10, 140, 10 );
m_keywordColour = wxColour( 10, 140, 10 );
m_variableColour = wxColour( 50, 120, 150 );
m_variableColour = wxColour( 50, 120, 150 );
m_commentColour = wxColour( 130, 130, 130 );
m_commentColour = wxColour( 130, 130, 130 );
m_stringColour = wxColour( 10, 140, 10 );
}
m_stringColour = wxColour( 10, 140, 10 );
}
{
if ((style & wxBORDER_MASK) == 0)
style |= wxBORDER_SUNKEN;
{
if ((style & wxBORDER_MASK) == 0)
style |= wxBORDER_SUNKEN;
if ((style & wxTE_MULTILINE) != 0)
style |= wxALWAYS_SHOW_SB;
if ((style & wxTE_MULTILINE) != 0)
style |= wxALWAYS_SHOW_SB;
wxTextCtrlBase::Create( parent, id, pos /* wxDefaultPosition */, size,
style | wxVSCROLL | wxHSCROLL);
wxTextCtrlBase::Create( parent, id, pos /* wxDefaultPosition */, size,
style | wxVSCROLL | wxHSCROLL);
SetBackgroundColour( *wxWHITE );
SetBackgroundColour( *wxWHITE );
SetCursor( wxCursor( wxCURSOR_IBEAM ) );
SetCursor( wxCursor( wxCURSOR_IBEAM ) );
m_editable = ((m_windowStyle & wxTE_READONLY) == 0);
m_editable = ((m_windowStyle & wxTE_READONLY) == 0);
if (HasFlag(wxTE_PASSWORD))
m_sourceFont = wxFont( 12, wxMODERN, wxNORMAL, wxNORMAL );
else
if (HasFlag(wxTE_PASSWORD))
m_sourceFont = wxFont( 12, wxMODERN, wxNORMAL, wxNORMAL );
else
dc.SetFont( m_sourceFont );
m_lineHeight = dc.GetCharHeight();
m_charWidth = dc.GetCharWidth();
dc.SetFont( m_sourceFont );
m_lineHeight = dc.GetCharHeight();
m_charWidth = dc.GetCharWidth();
SetValue( value );
wxSize size_best( DoGetBestSize() );
SetValue( value );
wxSize size_best( DoGetBestSize() );
new_size.y = size_best.y;
if ((new_size.x != size.x) || (new_size.y != size.y))
SetSize( new_size.x, new_size.y );
new_size.y = size_best.y;
if ((new_size.x != size.x) || (new_size.y != size.y))
SetSize( new_size.x, new_size.y );
// We create an input handler since it might be useful
CreateInputHandler(wxINP_HANDLER_TEXTCTRL);
// We create an input handler since it might be useful
CreateInputHandler(wxINP_HANDLER_TEXTCTRL);
}
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
if (i+1 < m_lines.GetCount())
ret += wxT('\n');
}
if (i+1 < m_lines.GetCount())
ret += wxT('\n');
}
return ret;
}
void wxTextCtrl::SetValue(const wxString& value)
{
return ret;
}
void wxTextCtrl::SetValue(const wxString& value)
{
wxString oldValue = GetValue();
wxString oldValue = GetValue();
m_lines.Clear();
m_longestLine = 0;
m_lines.Clear();
m_longestLine = 0;
{
m_lines.Add( new wxSourceLine( wxT("") ) );
}
{
m_lines.Add( new wxSourceLine( wxT("") ) );
}
{
wxSourceLine *sl = new wxSourceLine( value.Mid( begin, value.Len()-begin ) );
m_lines.Add( sl );
{
wxSourceLine *sl = new wxSourceLine( value.Mid( begin, value.Len()-begin ) );
m_lines.Add( sl );
// if (sl->m_text.Len() > m_longestLine)
// m_longestLine = sl->m_text.Len();
int ww = 0;
// if (sl->m_text.Len() > m_longestLine)
// m_longestLine = sl->m_text.Len();
int ww = 0;
ww /= m_charWidth;
if (ww > m_longestLine)
m_longestLine = ww;
ww /= m_charWidth;
if (ww > m_longestLine)
m_longestLine = ww;
break;
}
else
{
wxSourceLine *sl = new wxSourceLine( value.Mid( begin, pos-begin ) );
m_lines.Add( sl );
break;
}
else
{
wxSourceLine *sl = new wxSourceLine( value.Mid( begin, pos-begin ) );
m_lines.Add( sl );
// if (sl->m_text.Len() > m_longestLine)
// m_longestLine = sl->m_text.Len();
int ww = 0;
// if (sl->m_text.Len() > m_longestLine)
// m_longestLine = sl->m_text.Len();
int ww = 0;
ww /= m_charWidth;
if (ww > m_longestLine)
m_longestLine = ww;
ww /= m_charWidth;
if (ww > m_longestLine)
m_longestLine = ww;
if (value == oldValue)
return;
}
if (value == oldValue)
return;
}
{
if (lineNo >= (long)m_lines.GetCount())
return 0;
{
if (lineNo >= (long)m_lines.GetCount())
return 0;
return m_lines[lineNo].m_text.Len();
}
return m_lines[lineNo].m_text.Len();
}
{
if (lineNo >= (long)m_lines.GetCount())
return wxT("");
{
if (lineNo >= (long)m_lines.GetCount())
return wxT("");
return m_lines[lineNo].m_text;
}
return m_lines[lineNo].m_text;
}
void wxTextCtrl::Clear()
{
void wxTextCtrl::Clear()
{
m_cursorX = 0;
m_cursorY = 0;
ClearSelection();
m_cursorX = 0;
m_cursorY = 0;
ClearSelection();
m_lines.Clear();
m_lines.Add( new wxSourceLine( wxT("") ) );
m_lines.Clear();
m_lines.Add( new wxSourceLine( wxT("") ) );
SetScrollbars( m_charWidth, m_lineHeight, 0, 0, 0, 0 );
Refresh();
WX_CLEAR_LIST(wxList, m_undos);
SetScrollbars( m_charWidth, m_lineHeight, 0, 0, 0, 0 );
Refresh();
WX_CLEAR_LIST(wxList, m_undos);
void wxTextCtrl::Remove(long from, long to)
{
void wxTextCtrl::Remove(long from, long to)
{
}
void wxTextCtrl::DiscardEdits()
}
void wxTextCtrl::DiscardEdits()
if (line >= (int)m_lines.GetCount()) return 0;
if (pos < 0) return 0;
if (line >= (int)m_lines.GetCount()) return 0;
if (pos < 0) return 0;
wxString text = m_lines[line].m_text;
wxString text = m_lines[line].m_text;
-
- if (text.IsEmpty()) return 0;
-
+
+ if (text.empty()) return 0;
+
if (pos < (int)text.Len())
text.Remove( pos, text.Len()-pos );
if (pos < (int)text.Len())
text.Remove( pos, text.Len()-pos );
GetTextExtent( text, &w, NULL, NULL, NULL );
return w;
GetTextExtent( text, &w, NULL, NULL, NULL );
return w;
int wxTextCtrl::PixelToPos( int line, int pixel )
{
if (pixel < 2) return 0;
int wxTextCtrl::PixelToPos( int line, int pixel )
{
if (pixel < 2) return 0;
if (line >= (int)m_lines.GetCount()) return 0;
if (line >= (int)m_lines.GetCount()) return 0;
wxString text = m_lines[line].m_text;
wxString text = m_lines[line].m_text;
int w = 0;
int res = text.Len();
while (res > 0)
{
GetTextExtent( text, &w, NULL, NULL, NULL );
int w = 0;
int res = text.Len();
while (res > 0)
{
GetTextExtent( text, &w, NULL, NULL, NULL );
if (w < pixel)
return res;
if (w < pixel)
return res;
res--;
text.Remove( res,1 );
}
res--;
text.Remove( res,1 );
}
return 0;
}
void wxTextCtrl::SetLanguage( wxSourceLanguage lang )
{
m_lang = lang;
return 0;
}
void wxTextCtrl::SetLanguage( wxSourceLanguage lang )
{
m_lang = lang;
m_keywords.Clear();
}
void wxTextCtrl::WriteText(const wxString& text2)
{
m_keywords.Clear();
}
void wxTextCtrl::WriteText(const wxString& text2)
{
- if (text2.IsEmpty()) return;
+ if (text2.empty()) return;
+
+ m_modified = true;
wxString text( text2 );
wxArrayString lines;
int pos;
wxString text( text2 );
wxArrayString lines;
int pos;
}
lines.Add( text );
int count = (int)lines.GetCount();
}
lines.Add( text );
int count = (int)lines.GetCount();
wxString tmp1( m_lines[m_cursorY].m_text );
wxString tmp2( tmp1 );
int len = (int)tmp1.Len();
wxString tmp1( m_lines[m_cursorY].m_text );
wxString tmp2( tmp1 );
int len = (int)tmp1.Len();
if (len < m_cursorX)
{
wxString tmp;
if (len < m_cursorX)
{
wxString tmp;
tmp1.Remove( m_cursorX );
tmp2.Remove( 0, m_cursorX );
tmp1.Append( lines[0] );
tmp1.Remove( m_cursorX );
tmp2.Remove( 0, m_cursorX );
tmp1.Append( lines[0] );
if (count == 1)
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, m_cursorY, m_cursorY, this ) );
if (count == 1)
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, m_cursorY, m_cursorY, this ) );
tmp1.Append( tmp2 );
m_lines[m_cursorY].m_text = tmp1;
RefreshLine( m_cursorY );
tmp1.Append( tmp2 );
m_lines[m_cursorY].m_text = tmp1;
RefreshLine( m_cursorY );
else
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_PASTE, m_cursorY, m_cursorY+count-1, this ) );
else
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_PASTE, m_cursorY, m_cursorY+count-1, this ) );
m_lines[m_cursorY].m_text = tmp1;
int i;
for (i = 1; i < count; i++)
m_lines.Insert( new wxSourceLine( lines[i] ), m_cursorY+i );
m_lines[m_cursorY+i-1].m_text.Append( tmp2 );
m_lines[m_cursorY].m_text = tmp1;
int i;
for (i = 1; i < count; i++)
m_lines.Insert( new wxSourceLine( lines[i] ), m_cursorY+i );
m_lines[m_cursorY+i-1].m_text.Append( tmp2 );
MyAdjustScrollbars();
RefreshDown( m_cursorY );
}
MyAdjustScrollbars();
RefreshDown( m_cursorY );
}
void wxTextCtrl::AppendText(const wxString& text2)
{
void wxTextCtrl::AppendText(const wxString& text2)
{
- if (text2.IsEmpty()) return;
+ if (text2.empty()) return;
+
+ m_modified = true;
wxString text( text2 );
wxArrayString lines;
int pos;
wxString text( text2 );
wxArrayString lines;
int pos;
}
lines.Add( text );
int count = (int)lines.GetCount();
}
lines.Add( text );
int count = (int)lines.GetCount();
size_t y = m_lines.GetCount()-1;
wxString tmp( m_lines[y].m_text );
tmp.Append( lines[0] );
size_t y = m_lines.GetCount()-1;
wxString tmp( m_lines[y].m_text );
tmp.Append( lines[0] );
if (count == 1)
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, y, y, this ) );
if (count == 1)
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, y, y, this ) );
m_lines[y].m_text = tmp;
RefreshLine( y );
}
else
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_PASTE, y, y+count-1, this ) );
m_lines[y].m_text = tmp;
RefreshLine( y );
}
else
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_PASTE, y, y+count-1, this ) );
m_lines[y].m_text = tmp;
int i;
for (i = 1; i < count; i++)
m_lines.Insert( new wxSourceLine( lines[i] ), y+i );
m_lines[y].m_text = tmp;
int i;
for (i = 1; i < count; i++)
m_lines.Insert( new wxSourceLine( lines[i] ), y+i );
MyAdjustScrollbars();
RefreshDown( y );
}
MyAdjustScrollbars();
RefreshDown( y );
}
bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
{
bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
{
}
long wxTextCtrl::XYToPosition(long x, long y) const
{
long ret = 0;
}
long wxTextCtrl::XYToPosition(long x, long y) const
{
long ret = 0;
for (size_t i = 0; i < m_lines.GetCount(); i++)
{
if (i < (size_t)y)
for (size_t i = 0; i < m_lines.GetCount(); i++)
{
if (i < (size_t)y)
ret += m_lines[i].m_text.Len() + 1;
continue;
}
ret += m_lines[i].m_text.Len() + 1;
continue;
}
if ((size_t)x < (m_lines[i].m_text.Len()+1))
return (ret + x);
else
return (ret + m_lines[i].m_text.Len() + 1);
}
if ((size_t)x < (m_lines[i].m_text.Len()+1))
return (ret + x);
else
return (ret + m_lines[i].m_text.Len() + 1);
}
long xx = 0;
long yy = 0;
long xx = 0;
long yy = 0;
for (size_t i = 0; i < m_lines.GetCount(); i++)
{
//pos -= m_lines[i].m_text.Len();
for (size_t i = 0; i < m_lines.GetCount(); i++)
{
//pos -= m_lines[i].m_text.Len();
xx = pos;
if (x) *x = xx;
if (y) *y = yy;
xx = pos;
if (x) *x = xx;
if (y) *y = yy;
}
pos -= (m_lines[i].m_text.Len() + 1);
yy++;
}
}
pos -= (m_lines[i].m_text.Len() + 1);
yy++;
}
// Last pos
//xx = m_lines[ m_lines.GetCount()-1 ].m_text.Len();
xx = pos;
if (x) *x = xx;
if (y) *y = yy;
// Last pos
//xx = m_lines[ m_lines.GetCount()-1 ].m_text.Len();
xx = pos;
if (x) *x = xx;
if (y) *y = yy;
}
void wxTextCtrl::ShowPosition(long pos)
}
void wxTextCtrl::ShowPosition(long pos)
void wxTextCtrl::Copy()
{
if (!HasSelection()) return;
void wxTextCtrl::Copy()
{
if (!HasSelection()) return;
int selStartY = m_selStartY;
int selEndY = m_selEndY;
int selStartX = m_selStartX;
int selEndX = m_selEndX;
int selStartY = m_selStartY;
int selEndY = m_selEndY;
int selStartX = m_selStartX;
int selEndX = m_selEndX;
if ((selStartY > selEndY) ||
((selStartY == selEndY) && (selStartX > selEndX)))
{
if ((selStartY > selEndY) ||
((selStartY == selEndY) && (selStartX > selEndX)))
{
selStartY = selEndY;
selEndY = tmp;
}
selStartY = selEndY;
selEndY = tmp;
}
if (selStartY == selEndY)
{
sel = m_lines[selStartY].m_text;
if (selStartY == selEndY)
{
sel = m_lines[selStartY].m_text;
if (selStartX >= (int)sel.Len()) return;
if (selEndX > (int)sel.Len())
selEndX = sel.Len();
if (selStartX >= (int)sel.Len()) return;
if (selEndX > (int)sel.Len())
selEndX = sel.Len();
sel.Remove( selEndX, sel.Len()-selEndX );
sel.Remove( 0, selStartX );
}
else
{
wxString tmp( m_lines[selStartY].m_text );
sel.Remove( selEndX, sel.Len()-selEndX );
sel.Remove( 0, selStartX );
}
else
{
wxString tmp( m_lines[selStartY].m_text );
if (selStartX < (int)tmp.Len())
{
tmp.Remove( 0, selStartX );
if (selStartX < (int)tmp.Len())
{
tmp.Remove( 0, selStartX );
if (wxTheClipboard->Open())
{
wxTheClipboard->SetData( new wxTextDataObject( sel ) );
if (wxTheClipboard->Open())
{
wxTheClipboard->SetData( new wxTextDataObject( sel ) );
}
void wxTextCtrl::Paste()
{
Delete();
}
void wxTextCtrl::Paste()
{
Delete();
if (!wxTheClipboard->Open()) return;
if (!wxTheClipboard->Open()) return;
if (!wxTheClipboard->IsSupported( wxDF_TEXT ))
{
wxTheClipboard->Close();
if (!wxTheClipboard->IsSupported( wxDF_TEXT ))
{
wxTheClipboard->Close();
bool ret = wxTheClipboard->GetData( data );
bool ret = wxTheClipboard->GetData( data );
wxString text( data.GetText() );
wxArrayString lines;
int pos;
wxString text( data.GetText() );
wxArrayString lines;
int pos;
}
lines.Add( text );
int count = (int)lines.GetCount();
}
lines.Add( text );
int count = (int)lines.GetCount();
wxString tmp1( m_lines[m_cursorY].m_text );
wxString tmp2( tmp1 );
int len = (int)tmp1.Len();
wxString tmp1( m_lines[m_cursorY].m_text );
wxString tmp2( tmp1 );
int len = (int)tmp1.Len();
if (len < m_cursorX)
{
wxString tmp;
if (len < m_cursorX)
{
wxString tmp;
tmp1.Remove( m_cursorX );
tmp2.Remove( 0, m_cursorX );
tmp1.Append( lines[0] );
tmp1.Remove( m_cursorX );
tmp2.Remove( 0, m_cursorX );
tmp1.Append( lines[0] );
if (count == 1)
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, m_cursorY, m_cursorY, this ) );
if (count == 1)
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, m_cursorY, m_cursorY, this ) );
tmp1.Append( tmp2 );
m_lines[m_cursorY].m_text = tmp1;
RefreshLine( m_cursorY );
tmp1.Append( tmp2 );
m_lines[m_cursorY].m_text = tmp1;
RefreshLine( m_cursorY );
else
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_PASTE, m_cursorY, m_cursorY+count-1, this ) );
else
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_PASTE, m_cursorY, m_cursorY+count-1, this ) );
m_lines[m_cursorY].m_text = tmp1;
int i;
for (i = 1; i < count; i++)
m_lines.Insert( new wxSourceLine( lines[i] ), m_cursorY+i );
m_lines[m_cursorY+i-1].m_text.Append( tmp2 );
m_lines[m_cursorY].m_text = tmp1;
int i;
for (i = 1; i < count; i++)
m_lines.Insert( new wxSourceLine( lines[i] ), m_cursorY+i );
m_lines[m_cursorY+i-1].m_text.Append( tmp2 );
MyAdjustScrollbars();
RefreshDown( m_cursorY );
}
MyAdjustScrollbars();
RefreshDown( m_cursorY );
}
void wxTextCtrl::Undo()
{
if (m_undos.GetCount() == 0) return;
void wxTextCtrl::Undo()
{
if (m_undos.GetCount() == 0) return;
wxList::compatibility_iterator node = m_undos.Item( m_undos.GetCount()-1 );
wxSourceUndoStep *undo = (wxSourceUndoStep*) node->GetData();
wxList::compatibility_iterator node = m_undos.Item( m_undos.GetCount()-1 );
wxSourceUndoStep *undo = (wxSourceUndoStep*) node->GetData();
undo->Undo();
delete undo;
m_undos.Erase( node );
undo->Undo();
delete undo;
m_undos.Erase( node );
}
void wxTextCtrl::SetInsertionPoint(long pos)
}
void wxTextCtrl::SetInsertionPoint(long pos)
return XYToPosition( m_cursorX, m_cursorY );
}
return XYToPosition( m_cursorX, m_cursorY );
}
-long wxTextCtrl::GetLastPosition() const
+wxTextPos wxTextCtrl::GetLastPosition() const
{
size_t lineCount = m_lines.GetCount() - 1;
// It's the length of the line, not the length - 1,
{
size_t lineCount = m_lines.GetCount() - 1;
// It's the length of the line, not the length - 1,
bool wxTextCtrl::Enable( bool enable )
{
bool wxTextCtrl::Enable( bool enable )
{
}
bool wxTextCtrl::SetFont(const wxFont& font)
{
wxTextCtrlBase::SetFont( font );
}
bool wxTextCtrl::SetFont(const wxFont& font)
{
wxTextCtrlBase::SetFont( font );
wxClientDC dc(this);
dc.SetFont( m_sourceFont );
m_lineHeight = dc.GetCharHeight();
m_charWidth = dc.GetCharWidth();
wxClientDC dc(this);
dc.SetFont( m_sourceFont );
m_lineHeight = dc.GetCharHeight();
m_charWidth = dc.GetCharWidth();
// TODO: recalc longest lines
// TODO: recalc longest lines
}
bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
}
bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
{
int oldBracketY = m_bracketY;
int oldBracketX = m_bracketX;
{
int oldBracketY = m_bracketY;
int oldBracketX = m_bracketX;
if (m_cursorY < 0 || m_cursorY >= (int)m_lines.GetCount()) return;
if (m_cursorY < 0 || m_cursorY >= (int)m_lines.GetCount()) return;
wxString current = m_lines[m_cursorY].m_text;
wxString current = m_lines[m_cursorY].m_text;
// reverse search first
char bracket = ' ';
// reverse search first
char bracket = ' ';
if (m_cursorX > 0)
bracket = current[(size_t) (m_cursorX-1)];
if (m_cursorX > 0)
bracket = current[(size_t) (m_cursorX-1)];
if (bracket == ')' || bracket == ']' || bracket == '}')
{
char antibracket = '(';
if (bracket == ']') antibracket = '[';
if (bracket == '}') antibracket = '{';
if (bracket == ')' || bracket == ']' || bracket == '}')
{
char antibracket = '(';
if (bracket == ']') antibracket = '[';
if (bracket == '}') antibracket = '{';
int endY = m_cursorY-60;
if (endY < 0) endY = 0;
for (int y = m_cursorY; y >= endY; y--)
int endY = m_cursorY-60;
if (endY < 0) endY = 0;
for (int y = m_cursorY; y >= endY; y--)
current = m_lines[y].m_text;
if (y == m_cursorY)
current.erase(m_cursorX-1,current.Len()-m_cursorX+1);
current = m_lines[y].m_text;
if (y == m_cursorY)
current.erase(m_cursorX-1,current.Len()-m_cursorX+1);
for (int n = current.Len()-1; n >= 0; n--)
{
// ignore chars
for (int n = current.Len()-1; n >= 0; n--)
{
// ignore chars
// ignore strings
if (current[(size_t) (n)] == '\"')
{
// ignore strings
if (current[(size_t) (n)] == '\"')
{
if (current[(size_t) (n)] == antibracket)
{
count--;
if (current[(size_t) (n)] == antibracket)
{
count--;
// then forward
bracket = ' ';
// then forward
bracket = ' ';
char antibracket = ')';
if (bracket == '[') antibracket = ']';
if (bracket == '{') antibracket = '}';
char antibracket = ')';
if (bracket == '[') antibracket = ']';
if (bracket == '{') antibracket = '}';
int endY = m_cursorY+60;
if (endY > (int)(m_lines.GetCount()-1)) endY = m_lines.GetCount()-1;
for (int y = m_cursorY; y <= endY; y++)
int endY = m_cursorY+60;
if (endY > (int)(m_lines.GetCount()-1)) endY = m_lines.GetCount()-1;
for (int y = m_cursorY; y <= endY; y++)
int start = 0;
if (y == m_cursorY)
start = m_cursorX+1;
int start = 0;
if (y == m_cursorY)
start = m_cursorX+1;
for (int n = start; n < (int)current.Len(); n++)
{
// ignore chars
for (int n = start; n < (int)current.Len(); n++)
{
// ignore chars
// ignore strings
if (current[(size_t) (n)] == '\"')
{
// ignore strings
if (current[(size_t) (n)] == '\"')
{
if (current[(size_t) (n)] == antibracket)
{
count--;
if (current[(size_t) (n)] == antibracket)
{
count--;
if (oldBracketY != -1)
{
m_bracketY = -1;
if (oldBracketY != -1)
{
m_bracketY = -1;
void wxTextCtrl::Delete()
{
if (!HasSelection()) return;
void wxTextCtrl::Delete()
{
if (!HasSelection()) return;
int selStartY = m_selStartY;
int selEndY = m_selEndY;
int selStartX = m_selStartX;
int selEndX = m_selEndX;
int selStartY = m_selStartY;
int selEndY = m_selEndY;
int selStartX = m_selStartX;
int selEndX = m_selEndX;
if ((selStartY > selEndY) ||
((selStartY == selEndY) && (selStartX > selEndX)))
{
if ((selStartY > selEndY) ||
((selStartY == selEndY) && (selStartX > selEndX)))
{
selStartY = selEndY;
selEndY = tmp;
}
selStartY = selEndY;
selEndY = tmp;
}
int len = (int)m_lines[selStartY].m_text.Len();
int len = (int)m_lines[selStartY].m_text.Len();
if (selStartY == selEndY)
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, selStartY, selStartY, this ) );
if (selStartY == selEndY)
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, selStartY, selStartY, this ) );
wxString tmp( m_lines[selStartY].m_text );
if (selStartX < len)
{
wxString tmp( m_lines[selStartY].m_text );
if (selStartX < len)
{
else
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_DELETE, selStartY, selEndY, this ) );
else
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_DELETE, selStartY, selEndY, this ) );
if (selStartX < len)
m_lines[selStartY].m_text.Remove( selStartX );
if (selStartX < len)
m_lines[selStartY].m_text.Remove( selStartX );
for (int i = 0; i < selEndY-selStartY-1; i++)
m_lines.RemoveAt( selStartY+1 );
for (int i = 0; i < selEndY-selStartY-1; i++)
m_lines.RemoveAt( selStartY+1 );
if (selEndX < (int)m_lines[selStartY+1].m_text.Len())
m_lines[selStartY+1].m_text.Remove( 0, selEndX );
else
m_lines[selStartY+1].m_text.Remove( 0 );
if (selEndX < (int)m_lines[selStartY+1].m_text.Len())
m_lines[selStartY+1].m_text.Remove( 0, selEndX );
else
m_lines[selStartY+1].m_text.Remove( 0 );
m_lines[selStartY].m_text.Append( m_lines[selStartY+1].m_text );
m_lines.RemoveAt( selStartY+1 );
m_lines[selStartY].m_text.Append( m_lines[selStartY+1].m_text );
m_lines.RemoveAt( selStartY+1 );
ClearSelection();
MoveCursor( selStartX, selStartY );
MyAdjustScrollbars();
ClearSelection();
MoveCursor( selStartX, selStartY );
MyAdjustScrollbars();
RefreshDown( selStartY );
}
}
RefreshDown( selStartY );
}
}
void wxTextCtrl::DeleteLine()
{
if (HasSelection()) return;
void wxTextCtrl::DeleteLine()
{
if (HasSelection()) return;
if (m_cursorY < 0 || m_cursorY >= (int)m_lines.GetCount()-1) return; // TODO
if (m_cursorY < 0 || m_cursorY >= (int)m_lines.GetCount()-1) return; // TODO
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_DELETE, m_cursorY, m_cursorY+1, this ) );
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_DELETE, m_cursorY, m_cursorY+1, this ) );
m_lines.RemoveAt( m_cursorY );
m_cursorX = 0;
if (m_cursorY >= (int)m_lines.GetCount()) m_cursorY--;
m_lines.RemoveAt( m_cursorY );
m_cursorX = 0;
if (m_cursorY >= (int)m_lines.GetCount()) m_cursorY--;
MyAdjustScrollbars();
RefreshDown( m_cursorY );
}
void wxTextCtrl::DoChar( char c )
{
MyAdjustScrollbars();
RefreshDown( m_cursorY );
}
void wxTextCtrl::DoChar( char c )
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, m_cursorY, m_cursorY, this ) );
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, m_cursorY, m_cursorY, this ) );
wxString tmp( m_lines[m_cursorY].m_text );
tmp.Trim();
if (m_cursorX >= (int)tmp.Len())
wxString tmp( m_lines[m_cursorY].m_text );
tmp.Trim();
if (m_cursorX >= (int)tmp.Len())
else
tmp.insert( m_cursorX, 1, c );
}
else
tmp.insert( m_cursorX, 1, c );
}
m_lines[m_cursorY].m_text = tmp;
m_lines[m_cursorY].m_text = tmp;
// if (tmp.Len() > m_longestLine)
// {
// m_longestLine = tmp.Len();
// MyAdjustScrollbars();
// }
// if (tmp.Len() > m_longestLine)
// {
// m_longestLine = tmp.Len();
// MyAdjustScrollbars();
// }
int ww = 0;
GetTextExtent( tmp, &ww, NULL, NULL, NULL );
ww /= m_charWidth;
int ww = 0;
GetTextExtent( tmp, &ww, NULL, NULL, NULL );
ww /= m_charWidth;
int y = m_cursorY*m_lineHeight;
// int x = (m_cursorX-1)*m_charWidth;
int x = PosToPixel( m_cursorY, m_cursorX-1 );
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( x+2, y+2, 10000, m_lineHeight );
int y = m_cursorY*m_lineHeight;
// int x = (m_cursorX-1)*m_charWidth;
int x = PosToPixel( m_cursorY, m_cursorX-1 );
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( x+2, y+2, 10000, m_lineHeight );
- Refresh( TRUE, &rect );
+ Refresh( true, &rect );
// refresh whole line for syntax colour highlighting
rect.x = 0;
// refresh whole line for syntax colour highlighting
rect.x = 0;
- Refresh( FALSE, &rect );
-
+ Refresh( false, &rect );
+
int size_x = 0;
int size_y = 0;
GetClientSize( &size_x, &size_y );
size_x /= m_charWidth;
int size_x = 0;
int size_y = 0;
GetClientSize( &size_x, &size_y );
size_x /= m_charWidth;
int view_x = 0;
int view_y = 0;
GetViewStart( &view_x, &view_y );
int view_x = 0;
int view_y = 0;
GetViewStart( &view_x, &view_y );
//int xx = m_cursorX;
int xx = PosToPixel( m_cursorY, m_cursorX ) / m_charWidth;
//int xx = m_cursorX;
int xx = PosToPixel( m_cursorY, m_cursorX ) / m_charWidth;
if (xx < view_x)
Scroll( xx, -1 );
else if (xx > view_x+size_x-1)
if (xx < view_x)
Scroll( xx, -1 );
else if (xx > view_x+size_x-1)
void wxTextCtrl::DoBack()
{
void wxTextCtrl::DoBack()
{
if (m_cursorX == 0)
{
if (m_cursorY == 0) return;
if (m_cursorX == 0)
{
if (m_cursorY == 0) return;
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_BACK, m_cursorY-1, m_cursorY, this ) );
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_BACK, m_cursorY-1, m_cursorY, this ) );
wxString tmp1( m_lines[m_cursorY-1].m_text );
tmp1.Trim();
wxString tmp2( m_lines[m_cursorY].m_text );
wxString tmp1( m_lines[m_cursorY-1].m_text );
tmp1.Trim();
wxString tmp2( m_lines[m_cursorY].m_text );
tmp1.Append( tmp2 );
m_lines[m_cursorY].m_text = tmp1;
m_lines.RemoveAt( m_cursorY+1 );
tmp1.Append( tmp2 );
m_lines[m_cursorY].m_text = tmp1;
m_lines.RemoveAt( m_cursorY+1 );
MyAdjustScrollbars();
RefreshDown( m_cursorY-1 );
}
else
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, m_cursorY, m_cursorY, this ) );
MyAdjustScrollbars();
RefreshDown( m_cursorY-1 );
}
else
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, m_cursorY, m_cursorY, this ) );
if (m_cursorX <= (int)m_lines[m_cursorY].m_text.Len())
m_lines[m_cursorY].m_text.Remove( m_cursorX-1, 1 );
m_cursorX--;
if (m_cursorX <= (int)m_lines[m_cursorY].m_text.Len())
m_lines[m_cursorY].m_text.Remove( m_cursorX-1, 1 );
m_cursorX--;
int y = m_cursorY*m_lineHeight;
// int x = m_cursorX*m_charWidth;
int x = PosToPixel( m_cursorY, m_cursorX );
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( x+2, y+2, 10000, m_lineHeight );
int y = m_cursorY*m_lineHeight;
// int x = m_cursorX*m_charWidth;
int x = PosToPixel( m_cursorY, m_cursorX );
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( x+2, y+2, 10000, m_lineHeight );
- Refresh( TRUE, &rect );
+ Refresh( true, &rect );
// refresh whole line for syntax colour highlighting
rect.x = 0;
// refresh whole line for syntax colour highlighting
rect.x = 0;
- Refresh( FALSE, &rect );
+ Refresh( false, &rect );
}
}
void wxTextCtrl::DoDelete()
{
}
}
void wxTextCtrl::DoDelete()
{
wxString tmp( m_lines[m_cursorY].m_text );
tmp.Trim();
int len = (int)tmp.Len();
wxString tmp( m_lines[m_cursorY].m_text );
tmp.Trim();
int len = (int)tmp.Len();
if (m_cursorY == (int)m_lines.GetCount()-1) return;
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_DELETE, m_cursorY, m_cursorY+1, this ) );
if (m_cursorY == (int)m_lines.GetCount()-1) return;
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_DELETE, m_cursorY, m_cursorY+1, this ) );
for (int i = 0; i < (m_cursorX-len); i++)
tmp += ' ';
for (int i = 0; i < (m_cursorX-len); i++)
tmp += ' ';
tmp += m_lines[m_cursorY+1].m_text;
tmp += m_lines[m_cursorY+1].m_text;
m_lines[m_cursorY] = tmp;
m_lines.RemoveAt( m_cursorY+1 );
m_lines[m_cursorY] = tmp;
m_lines.RemoveAt( m_cursorY+1 );
MyAdjustScrollbars();
RefreshDown( m_cursorY );
}
else
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, m_cursorY, m_cursorY, this ) );
MyAdjustScrollbars();
RefreshDown( m_cursorY );
}
else
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, m_cursorY, m_cursorY, this ) );
tmp.Remove( m_cursorX, 1 );
m_lines[m_cursorY].m_text = tmp;
tmp.Remove( m_cursorX, 1 );
m_lines[m_cursorY].m_text = tmp;
int y = m_cursorY*m_lineHeight;
// int x = m_cursorX*m_charWidth;
int x = PosToPixel( m_cursorY, m_cursorX );
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( x+2, y+2, 10000, m_lineHeight );
int y = m_cursorY*m_lineHeight;
// int x = m_cursorX*m_charWidth;
int x = PosToPixel( m_cursorY, m_cursorX );
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( x+2, y+2, 10000, m_lineHeight );
- Refresh( TRUE, &rect );
+ Refresh( true, &rect );
// refresh whole line for syntax colour highlighting
rect.x = 0;
// refresh whole line for syntax colour highlighting
rect.x = 0;
- Refresh( FALSE, &rect );
+ Refresh( false, &rect );
}
}
void wxTextCtrl::DoReturn()
{
}
}
void wxTextCtrl::DoReturn()
{
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_ENTER, m_cursorY, m_cursorY, this ) );
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_ENTER, m_cursorY, m_cursorY, this ) );
wxString tmp( m_lines[m_cursorY].m_text );
size_t indent = tmp.find_first_not_of( ' ' );
if (indent == wxSTRING_MAXLEN) indent = 0;
wxString tmp( m_lines[m_cursorY].m_text );
size_t indent = tmp.find_first_not_of( ' ' );
if (indent == wxSTRING_MAXLEN) indent = 0;
{
int cursorX = indent;
int cursorY = m_cursorY + 1;
{
int cursorX = indent;
int cursorY = m_cursorY + 1;
wxString new_tmp;
for (size_t i = 0; i < indent; i++) new_tmp.Append( ' ' );
m_lines.Insert( new wxSourceLine( new_tmp ), cursorY );
wxString new_tmp;
for (size_t i = 0; i < indent; i++) new_tmp.Append( ' ' );
m_lines.Insert( new wxSourceLine( new_tmp ), cursorY );
MyAdjustScrollbars();
MoveCursor( cursorX, cursorY );
RefreshDown( m_cursorY );
MyAdjustScrollbars();
MoveCursor( cursorX, cursorY );
RefreshDown( m_cursorY );
wxString tmp1( tmp );
tmp1.Remove( m_cursorX, tmp.Len()-m_cursorX );
m_lines[m_cursorY].m_text = tmp1;
wxString tmp1( tmp );
tmp1.Remove( m_cursorX, tmp.Len()-m_cursorX );
m_lines[m_cursorY].m_text = tmp1;
wxString tmp2( tmp );
tmp2.Remove( 0, m_cursorX );
wxString tmp2( tmp );
tmp2.Remove( 0, m_cursorX );
int cursorX = indent;
int cursorY = m_cursorY + 1;
int cursorX = indent;
int cursorY = m_cursorY + 1;
wxString new_tmp;
for (size_t i = 0; i < indent; i++) new_tmp.Append( ' ' );
new_tmp.Append( tmp2 );
m_lines.Insert( new wxSourceLine( new_tmp ), cursorY );
wxString new_tmp;
for (size_t i = 0; i < indent; i++) new_tmp.Append( ' ' );
new_tmp.Append( tmp2 );
m_lines.Insert( new wxSourceLine( new_tmp ), cursorY );
MyAdjustScrollbars();
MoveCursor( cursorX, cursorY );
RefreshDown( m_cursorY-1 );
MyAdjustScrollbars();
MoveCursor( cursorX, cursorY );
RefreshDown( m_cursorY-1 );
p = m_cursorX;
if (p < (int)line.Len())
{
p = m_cursorX;
if (p < (int)line.Len())
{
if (line[p] == '"')
{
ret.Append( line[p] );
if (line[p] == '"')
{
ret.Append( line[p] );
if (line[p] == '\'')
{
ret.Append( line[p] );
if (line[p] == '\'')
{
ret.Append( line[p] );
if (((line[p] >= 'a') && (line[p] <= 'z')) ||
((line[p] >= 'A') && (line[p] <= 'Z')) ||
(line[p] == '_') ||
if (((line[p] >= 'a') && (line[p] <= 'z')) ||
((line[p] >= 'A') && (line[p] <= 'Z')) ||
(line[p] == '_') ||
pos++;
if (pos == len) return;
}
pos++;
if (pos == len) return;
}
wxString current;
current += toDraw[pos];
pos++;
wxString current;
current += toDraw[pos];
pos++;
current += toDraw[pos];
pos++;
}
current += toDraw[pos];
pos++;
}
int xx = 0;
wxString tmp = origin.Left( start );
GetTextExtent( tmp, &xx, NULL, NULL, NULL );
int xx = 0;
wxString tmp = origin.Left( start );
GetTextExtent( tmp, &xx, NULL, NULL, NULL );
int selEndY = m_selEndY;
int selStartX = m_selStartX;
int selEndX = m_selEndX;
int selEndY = m_selEndY;
int selStartX = m_selStartX;
int selEndX = m_selEndX;
if ((selStartY > selEndY) ||
((selStartY == selEndY) && (selStartX > selEndX)))
{
if ((selStartY > selEndY) ||
((selStartY == selEndY) && (selStartX > selEndX)))
{
wxString comment( ' ', line.Len() );
wxString my_string( ' ', line.Len() );
wxString selection( ' ', line.Len() );
wxString comment( ' ', line.Len() );
wxString my_string( ' ', line.Len() );
wxString selection( ' ', line.Len() );
if (m_lang != wxSOURCE_LANG_NONE)
{
if (lineNum == m_bracketY)
if (m_lang != wxSOURCE_LANG_NONE)
{
if (lineNum == m_bracketY)
dc.SetTextForeground( *wxBLACK );
}
}
dc.SetTextForeground( *wxBLACK );
}
}
size_t pos = 0;
wxString token( GetNextToken( line, pos ) );
while (!token.IsNull())
size_t pos = 0;
wxString token( GetNextToken( line, pos ) );
while (!token.IsNull())
DrawLinePart( dc, x, y, my_string, line2, m_stringColour );
return;
}
DrawLinePart( dc, x, y, my_string, line2, m_stringColour );
return;
}
if (selStartY == selEndY)
{
// int xx = selStartX*m_charWidth;
if (selStartY == selEndY)
{
// int xx = selStartX*m_charWidth;
// int ww = (selEndX-selStartX)*m_charWidth;
int ww = PosToPixel( lineNum, selEndX ) - xx;
dc.DrawRectangle( xx+2, lineNum*m_lineHeight+2, ww, m_lineHeight );
// int ww = (selEndX-selStartX)*m_charWidth;
int ww = PosToPixel( lineNum, selEndX ) - xx;
dc.DrawRectangle( xx+2, lineNum*m_lineHeight+2, ww, m_lineHeight );
for (size_t i = (size_t)selStartX; i < (size_t)selEndX; i++)
{
selection[i] = line[i];
for (size_t i = (size_t)selStartX; i < (size_t)selEndX; i++)
{
selection[i] = line[i];
if ((lineNum > selStartY) && (lineNum < selEndY))
{
dc.DrawRectangle( 0+2, lineNum*m_lineHeight+2, 10000, m_lineHeight );
if ((lineNum > selStartY) && (lineNum < selEndY))
{
dc.DrawRectangle( 0+2, lineNum*m_lineHeight+2, 10000, m_lineHeight );
for (size_t i = 0; i < line.Len(); i++)
{
selection[i] = line[i];
for (size_t i = 0; i < line.Len(); i++)
{
selection[i] = line[i];
// int xx = selStartX*m_charWidth;
int xx = PosToPixel( lineNum, selStartX );
dc.DrawRectangle( xx+2, lineNum*m_lineHeight+2, 10000, m_lineHeight );
// int xx = selStartX*m_charWidth;
int xx = PosToPixel( lineNum, selStartX );
dc.DrawRectangle( xx+2, lineNum*m_lineHeight+2, 10000, m_lineHeight );
for (size_t i = (size_t)selStartX; i < line.Len(); i++)
{
selection[i] = line[i];
for (size_t i = (size_t)selStartX; i < line.Len(); i++)
{
selection[i] = line[i];
// int ww = selEndX*m_charWidth;
int ww = PosToPixel( lineNum, selEndX );
dc.DrawRectangle( 0+2, lineNum*m_lineHeight+2, ww, m_lineHeight );
// int ww = selEndX*m_charWidth;
int ww = PosToPixel( lineNum, selEndX );
dc.DrawRectangle( 0+2, lineNum*m_lineHeight+2, ww, m_lineHeight );
for (size_t i = 0; i < (size_t)selEndX; i++)
{
selection[i] = line[i];
line[i] = ' ';
}
}
for (size_t i = 0; i < (size_t)selEndX; i++)
{
selection[i] = line[i];
line[i] = ' ';
}
}
DrawLinePart( dc, x, y, line, line2, *wxBLACK );
DrawLinePart( dc, x, y, selection, line2, *wxWHITE );
DrawLinePart( dc, x, y, keyword, line2, m_keywordColour );
DrawLinePart( dc, x, y, line, line2, *wxBLACK );
DrawLinePart( dc, x, y, selection, line2, *wxWHITE );
DrawLinePart( dc, x, y, keyword, line2, m_keywordColour );
void wxTextCtrl::OnPaint( wxPaintEvent &event )
{
wxPaintDC dc(this);
void wxTextCtrl::OnPaint( wxPaintEvent &event )
{
wxPaintDC dc(this);
if (m_lines.GetCount() == 0) return;
if (m_lines.GetCount() == 0) return;
dc.SetFont( m_sourceFont );
dc.SetFont( m_sourceFont );
int scroll_y = 0;
GetViewStart( NULL, &scroll_y );
int scroll_y = 0;
GetViewStart( NULL, &scroll_y );
// We have a inner border of two pixels
// around the text, so scroll units do
// not correspond to lines.
if (scroll_y > 0) scroll_y--;
// We have a inner border of two pixels
// around the text, so scroll units do
// not correspond to lines.
if (scroll_y > 0) scroll_y--;
int size_x = 0;
int size_y = 0;
GetClientSize( &size_x, &size_y );
int size_x = 0;
int size_y = 0;
GetClientSize( &size_x, &size_y );
dc.SetPen( *wxTRANSPARENT_PEN );
dc.SetBrush( wxBrush( wxTHEME_COLOUR(HIGHLIGHT), wxSOLID ) );
int upper = wxMin( (int)m_lines.GetCount(), scroll_y+(size_y/m_lineHeight)+2 );
dc.SetPen( *wxTRANSPARENT_PEN );
dc.SetBrush( wxBrush( wxTHEME_COLOUR(HIGHLIGHT), wxSOLID ) );
int upper = wxMin( (int)m_lines.GetCount(), scroll_y+(size_y/m_lineHeight)+2 );
if (IsExposed(x,y,w,h))
DrawLine( dc, 0+2, i*m_lineHeight+2, m_lines[i].m_text, i );
}
if (IsExposed(x,y,w,h))
DrawLine( dc, 0+2, i*m_lineHeight+2, m_lines[i].m_text, i );
}
if (m_editable && (FindFocus() == this))
{
///dc.SetBrush( *wxRED_BRUSH );
if (m_editable && (FindFocus() == this))
{
///dc.SetBrush( *wxRED_BRUSH );
{
if (m_lines.GetCount() == 0) return;
{
if (m_lines.GetCount() == 0) return;
#if 0 // there is no middle button on iPAQs
if (event.MiddleDown())
{
#if 0 // there is no middle button on iPAQs
if (event.MiddleDown())
{
if (event.LeftDClick())
{
DoDClick();
return;
}
if (event.LeftDClick())
{
DoDClick();
return;
}
- {
- m_capturing = TRUE;
+ {
+ m_capturing = true;
- {
- m_capturing = FALSE;
+ {
+ m_capturing = false;
- if (event.LeftDown() ||
+ if (event.LeftDown() ||
(event.LeftIsDown() && m_capturing))
{
int x = event.GetX();
(event.LeftIsDown() && m_capturing))
{
int x = event.GetX();
y /= m_lineHeight;
// x /= m_charWidth;
x = PixelToPos( y, x );
y /= m_lineHeight;
// x /= m_charWidth;
x = PixelToPos( y, x );
- MoveCursor(
- wxMin( 1000, wxMax( 0, x ) ),
+ MoveCursor(
+ wxMin( 1000, wxMax( 0, x ) ),
wxMin( (int)m_lines.GetCount()-1, wxMax( 0, y ) ),
event.ShiftDown() || !event.LeftDown() );
}
wxMin( (int)m_lines.GetCount()-1, wxMax( 0, y ) ),
event.ShiftDown() || !event.LeftDown() );
}
if (m_lines.GetCount() == 0) return;
if (!m_editable) return;
if (m_lines.GetCount() == 0) return;
if (!m_editable) return;
int size_x = 0;
int size_y = 0;
GetClientSize( &size_x, &size_y );
size_x /= m_charWidth;
size_y /= m_lineHeight;
size_y--;
int size_x = 0;
int size_y = 0;
GetClientSize( &size_x, &size_y );
size_x /= m_charWidth;
size_y /= m_lineHeight;
size_y--;
if (event.ShiftDown())
{
switch (event.GetKeyCode())
if (event.ShiftDown())
{
switch (event.GetKeyCode())
case '0': event.m_keyCode = WXK_INSERT; break;
}
}
case '0': event.m_keyCode = WXK_INSERT; break;
}
}
switch (event.GetKeyCode())
{
case WXK_UP:
switch (event.GetKeyCode())
{
case WXK_UP:
if (m_ignoreInput) return;
if (m_cursorY > 0)
MoveCursor( m_cursorX, m_cursorY-1, event.ShiftDown() );
if (m_ignoreInput) return;
if (m_cursorY > 0)
MoveCursor( m_cursorX, m_cursorY-1, event.ShiftDown() );
if (m_ignoreInput) return;
if (m_cursorY < (int)(m_lines.GetCount()-1))
MoveCursor( m_cursorX, m_cursorY+1, event.ShiftDown() );
if (m_ignoreInput) return;
if (m_cursorY < (int)(m_lines.GetCount()-1))
MoveCursor( m_cursorX, m_cursorY+1, event.ShiftDown() );
if (m_cursorY > 0)
MoveCursor( m_lines[m_cursorY-1].m_text.Len(), m_cursorY-1, event.ShiftDown() );
}
if (m_cursorY > 0)
MoveCursor( m_lines[m_cursorY-1].m_text.Len(), m_cursorY-1, event.ShiftDown() );
}
return;
}
case WXK_RIGHT:
return;
}
case WXK_RIGHT:
if (m_ignoreInput) return;
if (m_cursorX < 1000)
MoveCursor( m_cursorX+1, m_cursorY, event.ShiftDown() );
if (m_ignoreInput) return;
if (m_cursorX < 1000)
MoveCursor( m_cursorX+1, m_cursorY, event.ShiftDown() );
{
if (m_ignoreInput) return;
MoveCursor( m_cursorX, wxMin( (int)(m_lines.GetCount()-1), m_cursorY+size_y ), event.ShiftDown() );
{
if (m_ignoreInput) return;
MoveCursor( m_cursorX, wxMin( (int)(m_lines.GetCount()-1), m_cursorY+size_y ), event.ShiftDown() );
return;
}
case WXK_PRIOR:
{
if (m_ignoreInput) return;
MoveCursor( m_cursorX, wxMax( 0, m_cursorY-size_y ), event.ShiftDown() );
return;
}
case WXK_PRIOR:
{
if (m_ignoreInput) return;
MoveCursor( m_cursorX, wxMax( 0, m_cursorY-size_y ), event.ShiftDown() );
return;
}
case WXK_INSERT:
return;
}
case WXK_INSERT:
event.SetString(GetValue());
if (GetEventHandler()->ProcessEvent(event)) return;
}
event.SetString(GetValue());
if (GetEventHandler()->ProcessEvent(event)) return;
}
if (IsSingleLine())
{
event.Skip();
return;
}
if (IsSingleLine())
{
event.Skip();
return;
}
if (HasSelection())
Delete();
DoReturn();
if (HasSelection())
Delete();
DoReturn();
if (HasSelection())
Delete();
bool save_overwrite = m_overwrite;
if (HasSelection())
Delete();
bool save_overwrite = m_overwrite;
int i = 4-(m_cursorX % 4);
if (i == 0) i = 4;
for (int c = 0; c < i; c++)
int i = 4-(m_cursorX % 4);
if (i == 0) i = 4;
for (int c = 0; c < i; c++)
{
if ( (event.GetKeyCode() >= 'a') &&
(event.GetKeyCode() <= 'z') &&
{
if ( (event.GetKeyCode() >= 'a') &&
(event.GetKeyCode() <= 'z') &&
-
- if ( (event.GetKeyCode() >= 32) &&
+
+ if ( (event.GetKeyCode() >= 32) &&
(event.GetKeyCode() <= 255) &&
!(event.ControlDown() && !event.AltDown()) ) // filters out Ctrl-X but leaves Alt-Gr
{
(event.GetKeyCode() <= 255) &&
!(event.ControlDown() && !event.AltDown()) ) // filters out Ctrl-X but leaves Alt-Gr
{
event.Skip();
}
void wxTextCtrl::OnInternalIdle()
{
wxControl::OnInternalIdle();
event.Skip();
}
void wxTextCtrl::OnInternalIdle()
{
wxControl::OnInternalIdle();
-
- m_ignoreInput = FALSE;
-
+
+ m_ignoreInput = false;
+
if (m_lang != wxSOURCE_LANG_NONE)
SearchForBrackets();
}
if (m_lang != wxSOURCE_LANG_NONE)
SearchForBrackets();
}
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, startY, endY, this ) );
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, startY, endY, this ) );
for (int i = startY; i <= endY; i++)
{
m_lines[i].m_text.insert( 0u, wxT(" ") );
for (int i = startY; i <= endY; i++)
{
m_lines[i].m_text.insert( 0u, wxT(" ") );
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, startY, endY, this ) );
m_undos.Append( new wxSourceUndoStep( wxSOURCE_UNDO_LINE, startY, endY, this ) );
for (int i = startY; i <= endY; i++)
{
for (int n = 0; n < 4; n++)
for (int i = startY; i <= endY; i++)
{
for (int n = 0; n < 4; n++)
int x = 0;
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( 0+2, y+2, 10000, m_lineHeight );
int x = 0;
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( 0+2, y+2, 10000, m_lineHeight );
- Refresh( TRUE, &rect );
+ Refresh( true, &rect );
}
void wxTextCtrl::RefreshDown( int n )
}
void wxTextCtrl::RefreshDown( int n )
int y = n*m_lineHeight;
int x = 0;
CalcScrolledPosition( x, y, &x, &y );
int y = n*m_lineHeight;
int x = 0;
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( 0+2, y+2, 10000, size_y );
wxRect rect( 0+2, y+2, 10000, size_y );
- Refresh( TRUE, &rect );
+ Refresh( true, &rect );
if ((new_x == m_cursorX) && (new_y == m_cursorY)) return;
if ((new_x == m_cursorX) && (new_y == m_cursorY)) return;
- bool no_cursor_refresh = FALSE;
+ bool no_cursor_refresh = false;
bool has_selection = HasSelection();
if (shift)
{
int x,y,w,h;
bool has_selection = HasSelection();
if (shift)
{
int x,y,w,h;
- bool erase_background = TRUE;
-
+ bool erase_background = true;
+
if (!has_selection)
{
m_selStartX = m_cursorX;
m_selStartY = m_cursorY;
if (!has_selection)
{
m_selStartX = m_cursorX;
m_selStartY = m_cursorY;
x = 0;
w = 10000;
if (new_y > m_selStartY)
x = 0;
w = 10000;
if (new_y > m_selStartY)
y = new_y*m_lineHeight;
h = (-new_y+m_selStartY+1)*m_lineHeight;
}
y = new_y*m_lineHeight;
h = (-new_y+m_selStartY+1)*m_lineHeight;
}
-
- no_cursor_refresh = TRUE;
+
+ no_cursor_refresh = true;
m_cursorX = new_x;
m_cursorY = new_y;
}
m_cursorX = new_x;
m_cursorY = new_y;
}
{
y = m_selEndY*m_lineHeight;
h = (new_y-m_selEndY+1) * m_lineHeight;
{
y = m_selEndY*m_lineHeight;
h = (new_y-m_selEndY+1) * m_lineHeight;
erase_background = ((m_selEndY < m_selStartY) ||
((m_selEndY == m_selStartY) && (m_selEndX < m_selStartX)));
}
erase_background = ((m_selEndY < m_selStartY) ||
((m_selEndY == m_selStartY) && (m_selEndX < m_selStartX)));
}
{
y = new_y*m_lineHeight;
h = (-new_y+m_selEndY+1) * m_lineHeight;
{
y = new_y*m_lineHeight;
h = (-new_y+m_selEndY+1) * m_lineHeight;
erase_background = ((m_selEndY > m_selStartY) ||
((m_selEndY == m_selStartY) && (m_selEndX > m_selStartX)));
}
erase_background = ((m_selEndY > m_selStartY) ||
((m_selEndY == m_selStartY) && (m_selEndX > m_selStartX)));
}
- no_cursor_refresh = TRUE;
+ no_cursor_refresh = true;
m_cursorX = new_x;
m_cursorY = new_y;
}
}
m_cursorX = new_x;
m_cursorY = new_y;
}
}
m_selEndX = new_x;
m_selEndY = new_y;
m_selEndX = new_x;
m_selEndY = new_y;
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( x+2, y+2, w, h );
Refresh( erase_background, &rect );
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( x+2, y+2, w, h );
Refresh( erase_background, &rect );
m_selEndY = -1;
m_selStartX = -1;
m_selStartY = -1;
m_selEndY = -1;
m_selStartX = -1;
m_selStartY = -1;
if (ry1 > ry2)
{
int tmp = ry2;
ry2 = ry1;
ry1 = tmp;
}
if (ry1 > ry2)
{
int tmp = ry2;
ry2 = ry1;
ry1 = tmp;
}
int x = 0;
int y = ry1*m_lineHeight;
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( 0, y+2, 10000, (ry2-ry1+1)*m_lineHeight );
int x = 0;
int y = ry1*m_lineHeight;
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( 0, y+2, 10000, (ry2-ry1+1)*m_lineHeight );
-
- Refresh( TRUE, &rect );
+
+ Refresh( true, &rect );
- printf( "startx %d starty %d endx %d endy %d\n",
+ printf( "startx %d starty %d endx %d endy %d\n",
m_selStartX, m_selStartY, m_selEndX, m_selEndY );
m_selStartX, m_selStartY, m_selEndX, m_selEndY );
printf( "has %d\n", (int)HasSelection() );
*/
printf( "has %d\n", (int)HasSelection() );
*/
int y = m_cursorY*m_lineHeight;
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( x+2, y+2, 4, m_lineHeight+2 );
int y = m_cursorY*m_lineHeight;
CalcScrolledPosition( x, y, &x, &y );
wxRect rect( x+2, y+2, 4, m_lineHeight+2 );
m_cursorX = new_x;
m_cursorY = new_y;
m_cursorX = new_x;
m_cursorY = new_y;
-
- Refresh( TRUE, &rect );
+
+ Refresh( true, &rect );
if (FindFocus() == this)
{
if (FindFocus() == this)
{
dc.DrawRectangle( xx+2, m_cursorY*m_lineHeight+2, 2, m_lineHeight );
}
}
dc.DrawRectangle( xx+2, m_cursorY*m_lineHeight+2, 2, m_lineHeight );
}
}
int size_x = 0;
int size_y = 0;
GetClientSize( &size_x, &size_y );
size_x /= m_charWidth;
size_y /= m_lineHeight;
int size_x = 0;
int size_y = 0;
GetClientSize( &size_x, &size_y );
size_x /= m_charWidth;
size_y /= m_lineHeight;
int view_x = 0;
int view_y = 0;
GetViewStart( &view_x, &view_y );
int view_x = 0;
int view_y = 0;
GetViewStart( &view_x, &view_y );
if (centre)
{
int sy = m_cursorY - (size_y/2);
if (centre)
{
int sy = m_cursorY - (size_y/2);
else if (m_cursorY > view_y+size_y-1)
Scroll( -1, m_cursorY-size_y+1 );
}
else if (m_cursorY > view_y+size_y-1)
Scroll( -1, m_cursorY-size_y+1 );
}
//int xx = m_cursorX;
int xx = PosToPixel( m_cursorY, m_cursorX ) / m_charWidth;
//int xx = m_cursorX;
int xx = PosToPixel( m_cursorY, m_cursorX ) / m_charWidth;
if (xx < view_x)
Scroll( xx, -1 );
else if (xx > view_x+size_x-1)
if (xx < view_x)
Scroll( xx, -1 );
else if (xx > view_x+size_x-1)
height -= 4;
if (height >= (int)m_lines.GetCount() *m_lineHeight)
y_range = 0;
height -= 4;
if (height >= (int)m_lines.GetCount() *m_lineHeight)
y_range = 0;
int view_x = 0;
int view_y = 0;
GetViewStart( &view_x, &view_y );
int view_x = 0;
int view_y = 0;
GetViewStart( &view_x, &view_y );
SetScrollbars( m_charWidth, m_lineHeight, m_longestLine+2, y_range, view_x, view_y );
}
SetScrollbars( m_charWidth, m_lineHeight, m_longestLine+2, y_range, view_x, view_y );
}
if (IsSingleLine())
{
wxSize ret(80, m_lineHeight + 4);
if (IsSingleLine())
{
wxSize ret(80, m_lineHeight + 4);
if (HasFlag(wxBORDER_SUNKEN) || HasFlag(wxBORDER_RAISED))
ret.y += 4;
if (HasFlag(wxBORDER_SUNKEN) || HasFlag(wxBORDER_RAISED))
ret.y += 4;
if (HasFlag(wxBORDER_SIMPLE))
ret.y += 2;
if (HasFlag(wxBORDER_SIMPLE))
ret.y += 2;
{
wxFAIL_MSG( "wxTextCtrl::ScrollLines not implemented");
{
wxFAIL_MSG( "wxTextCtrl::ScrollLines not implemented");
}
bool wxTextCtrl::ScrollPages(int pages)
{
wxFAIL_MSG( "wxTextCtrl::ScrollPages not implemented");
}
bool wxTextCtrl::ScrollPages(int pages)
{
wxFAIL_MSG( "wxTextCtrl::ScrollPages not implemented");