wxTextPos for all GetLastPosition with constants for special cases. Make it virtual everywhere. Avoid doubling typedefs. Always include textctrl.h for combobox.h. Source cleaning.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31497 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-01-19 16:25:34 +00:00
parent 4b134bb2ce
commit 7d8268a1d6
50 changed files with 1084 additions and 1101 deletions

View File

@@ -36,7 +36,7 @@ See also \helpref{window styles overview}{windowstyles}.
\twocolwidtha{7cm} \twocolwidtha{7cm}
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_COMBOBOX(id, func)}}{Process a wxEVT\_COMMAND\_COMBOBOX\_SELECTED event, \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.} \helpref{GetValue}{wxcomboboxgetvalue} returns the new value of selection.}
\twocolitem{{\bf EVT\_TEXT(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_UPDATED event, \twocolitem{{\bf EVT\_TEXT(id, func)}}{Process a wxEVT\_COMMAND\_TEXT\_UPDATED event,
when the combobox text changes.} when the combobox text changes.}
@@ -152,14 +152,14 @@ text field. Only available on Windows.
Returns true if the combobox is editable and the last undo can be redone. Returns true if the combobox is editable and the last undo can be redone.
Only available on Windows. Only available on Windows.
\membersection{wxComboBox::CanUndo}\label{wxcomboboxcanundo} \membersection{wxComboBox::CanUndo}\label{wxcomboboxcanundo}
\constfunc{bool}{CanUndo}{\void} \constfunc{bool}{CanUndo}{\void}
Returns true if the combobox is editable and the last edit can be undone. Returns true if the combobox is editable and the last edit can be undone.
Only available on Windows. Only available on Windows.
\membersection{wxComboBox::Copy}\label{wxcomboboxcopy} \membersection{wxComboBox::Copy}\label{wxcomboboxcopy}
\func{void}{Copy}{\void} \func{void}{Copy}{\void}
@@ -180,7 +180,7 @@ Returns the insertion point for the combobox's text field.
\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.
@@ -257,7 +257,7 @@ Selects the text between the two positions, in the combobox text field.
\docparam{to}{The second position.} \docparam{to}{The second position.}
\pythonnote{This method is called {\tt SetMark} in wxPython, {\tt SetSelection} \pythonnote{This method is called {\tt SetMark} in wxPython, {\tt SetSelection}
name is kept for name is kept for
\helpref{wxControlWithItems::SetSelection}{wxcontrolwithitemssetselection}.} \helpref{wxControlWithItems::SetSelection}{wxcontrolwithitemssetselection}.}
\membersection{wxComboBox::SetValue}\label{wxcomboboxsetvalue} \membersection{wxComboBox::SetValue}\label{wxcomboboxsetvalue}

View File

@@ -70,7 +70,7 @@ for a text control.
\end{verbatim} \end{verbatim}
} }
The values below are the possible return codes of the The values below are the possible return codes of the
\helpref{HitTest}{wxtextctrlhittest} method: \helpref{HitTest}{wxtextctrlhittest} method:
{\small {\small
\begin{verbatim} \begin{verbatim}
@@ -230,7 +230,7 @@ Sets the text font.
\func{void}{SetLeftIndent}{\param{int }{indent}, \param{int }{subIndent = 0}} \func{void}{SetLeftIndent}{\param{int }{indent}, \param{int }{subIndent = 0}}
Sets the left indent in tenths of a millimetre. 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.
@@ -320,17 +320,17 @@ The multiline text controls always store the text as a sequence of lines
separated by {\tt $\backslash$n} characters, i.e. in the Unix text format even 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 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 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 \helpref{GetSelection}{wxtextctrlgetselection} can {\bf not} be used as
indices into the string returned by \helpref{GetValue}{wxtextctrlgetvalue} 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. {\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 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 from the control with the help of the functions mentioned above, you should
use \helpref{GetRange}{wxtextctrlgetrange}. And the indices themselves can use \helpref{GetRange}{wxtextctrlgetrange}. And the indices themselves can
only be passed to other methods, for example only be passed to other methods, for example
\helpref{SetInsertionPoint}{wxtextctrlsetinsertionpoint} or \helpref{SetInsertionPoint}{wxtextctrlsetinsertionpoint} or
\helpref{SetSelection}{wxtextctrlsetselection}. \helpref{SetSelection}{wxtextctrlsetselection}.
To summarize: never use the indices returned by (multiline) wxTextCtrl as To summarize: never use the indices returned by (multiline) wxTextCtrl as
@@ -633,7 +633,7 @@ Resets the internal `modified' flag as if the current edits had been saved.
\func{bool}{EmulateKeyPress}{\param{const wxKeyEvent\& }{event}} \func{bool}{EmulateKeyPress}{\param{const wxKeyEvent\& }{event}}
This functions inserts into the control the character which would have been 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} {\it event} object should be the same as the one passed to {\tt EVT\_KEY\_DOWN}
handler previously by wxWidgets. handler previously by wxWidgets.
@@ -683,7 +683,7 @@ point or the zero character if the point is at the end of the control.
\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, Returns the zero based index of the last position in the text control,
which is equal to the number of characters in the control. which is equal to the number of characters in the control.
@@ -747,7 +747,7 @@ up to {\it to} in the control. The positions must have been returned by another
wxTextCtrl method. wxTextCtrl method.
Please note that the positions in a multiline wxTextCtrl do {\bf not} 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 \helpref{GetValue}{wxtextctrlgetvalue} because of the different new line
representations ({\tt CR} or {\tt CR LF}) and so this method should be used to 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 obtain the correct results instead of extracting parts of the entire value. It
@@ -822,7 +822,7 @@ sequence in the native control.
This function finds the character at the specified position expressed in 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 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). \arg{row} parameters (unless the pointers are {\tt NULL} which is allowed).
Please note that this function is currently only implemented in wxUniv, Please note that this function is currently only implemented in wxUniv,
@@ -841,7 +841,7 @@ returns a 3-element list \texttt{(result, col, row)}}.
Returns {\tt true} if the controls contents may be edited by user (note that it 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 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}.
@@ -849,7 +849,7 @@ read-only mode by a previous call to
\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.
@@ -894,20 +894,20 @@ Loads and displays the named file, if it exists.
% VZ: commenting this out as: (a) the docs are wrong (you can't replace % VZ: commenting this out as: (a) the docs are wrong (you can't replace
% anything), (b) wxTextCtrl doesn't have any OnChar() anyhow % anything), (b) wxTextCtrl doesn't have any OnChar() anyhow
%% \membersection{wxTextCtrl::OnChar}\label{wxtextctrlonchar} %% \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.
%% %%
%% \wxheading{Remarks} %% \wxheading{Remarks}
%% %%
%% It is possible to intercept character %% It is possible to intercept character
%% input by overriding this member. Call this function %% input by overriding this member. Call this function
%% to let the default behaviour take place; not calling %% to let the default behaviour take place; not calling
%% it results in the character being ignored. You can %% it results in the character being ignored. You can
%% replace the {\it keyCode} member of {\it event} to %% replace the {\it keyCode} member of {\it event} to
%% translate keystrokes. %% translate keystrokes.
%% %%
%% Note that Windows and Motif have different ways %% Note that Windows and Motif have different ways
%% of implementing the default behaviour. In Windows, %% of implementing the default behaviour. In Windows,
%% calling wxTextCtrl::OnChar immediately %% calling wxTextCtrl::OnChar immediately
@@ -916,9 +916,9 @@ Loads and displays the named file, if it exists.
%% to let default processing happen. This might affect %% to let default processing happen. This might affect
%% the way in which you write your OnChar function %% the way in which you write your OnChar function
%% on different platforms. %% on different platforms.
%% %%
%% \wxheading{See also} %% \wxheading{See also}
%% %%
%% \helpref{wxKeyEvent}{wxkeyevent} %% \helpref{wxKeyEvent}{wxkeyevent}
@@ -1167,7 +1167,7 @@ the styles are not supported under this platform.
\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 \helpref{IsModified}{wxtextctrlismodified} would return {\tt false} immediately
after the call to SetValue). after the call to SetValue).

View File

@@ -6,14 +6,12 @@
// Created: 2003/07/14 // Created: 2003/07/14
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) 2003 David Elliott // Copyright: (c) 2003 David Elliott
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef __WX_COCOA_COMBOBOX_H__ #ifndef __WX_COCOA_COMBOBOX_H__
#define __WX_COCOA_COMBOBOX_H__ #define __WX_COCOA_COMBOBOX_H__
#include "wx/textctrl.h"
//#include "wx/cocoa/NSTableView.h" //#include "wx/cocoa/NSTableView.h"
// ======================================================================== // ========================================================================
@@ -114,7 +112,7 @@ public:
{ wxTextCtrl::SetInsertionPointEnd(); } { wxTextCtrl::SetInsertionPointEnd(); }
virtual long GetInsertionPoint() const virtual long GetInsertionPoint() const
{ return wxTextCtrl::GetInsertionPoint(); } { return wxTextCtrl::GetInsertionPoint(); }
virtual long GetLastPosition() const virtual wxTextPos GetLastPosition() const
{ return wxTextCtrl::GetLastPosition(); } { return wxTextCtrl::GetLastPosition(); }
virtual void Replace(long from, long to, const wxString& value) virtual void Replace(long from, long to, const wxString& value)
{ wxTextCtrl::Replace(from,to,value); } { wxTextCtrl::Replace(from,to,value); }

View File

@@ -4,9 +4,9 @@
// Author: David Elliott // Author: David Elliott
// Modified by: // Modified by:
// Created: 2003/03/16 // Created: 2003/03/16
// RCS-ID: $Id: // RCS-ID: $Id:
// 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__
@@ -108,7 +108,7 @@ public:
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const; virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);
// virtual void SelectAll(); // virtual void SelectAll();

View File

@@ -22,6 +22,7 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr;
// 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" #include "wx/ctrlsub.h"
class WXDLLEXPORT wxComboBoxBase : public wxItemContainer class WXDLLEXPORT wxComboBoxBase : public wxItemContainer
@@ -36,7 +37,7 @@ public:
virtual void Paste() = 0; virtual void Paste() = 0;
virtual void SetInsertionPoint(long pos) = 0; virtual void SetInsertionPoint(long pos) = 0;
virtual long GetInsertionPoint() const = 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 Replace(long from, long to, const wxString& value) = 0;
virtual void SetSelection(long from, long to) = 0; virtual void SetSelection(long from, long to) = 0;
virtual void SetEditable(bool editable) = 0; virtual void SetEditable(bool editable) = 0;

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -111,7 +111,7 @@ public:
void SetInsertionPoint( long pos ); void SetInsertionPoint( long pos );
void SetInsertionPointEnd() { SetInsertionPoint( -1 ); } void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
long GetInsertionPoint() const; long GetInsertionPoint() const;
long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
void Remove(long from, long to) { Replace(from, to, wxEmptyString); } void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
void Replace( long from, long to, const wxString& value ); void Replace( long from, long to, const wxString& value );
void SetSelection( long from, long to ); void SetSelection( long from, long to );

View File

@@ -114,12 +114,12 @@ public:
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const; virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable); virtual void SetEditable(bool editable);
virtual bool Enable( bool enable = TRUE ); virtual bool Enable( bool enable = true );
// Implementation from now on // Implementation from now on
void OnDropFiles( wxDropFilesEvent &event ); void OnDropFiles( wxDropFilesEvent &event );
@@ -154,13 +154,13 @@ public:
void UpdateFontIfNeeded(); void UpdateFontIfNeeded();
#endif // __WXGTK20__/!__WXGTK20__ #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 // GTK+ textctrl is so dumb that you need to freeze/thaw it manually to
// avoid horrible flicker/scrolling back and forth // avoid horrible flicker/scrolling back and forth
virtual void Freeze(); virtual void Freeze();
virtual void Thaw(); virtual void Thaw();
// textctrl specific scrolling // textctrl specific scrolling
virtual bool ScrollLines(int lines); virtual bool ScrollLines(int lines);
virtual bool ScrollPages(int pages); virtual bool ScrollPages(int pages);
@@ -180,7 +180,7 @@ public:
static wxVisualAttributes static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
protected: protected:
virtual wxSize DoGetBestSize() const; virtual wxSize DoGetBestSize() const;
@@ -202,7 +202,7 @@ protected:
// has the control been frozen by Freeze()? // has the control been frozen by Freeze()?
bool IsFrozen() const { return m_frozenness > 0; } bool IsFrozen() const { return m_frozenness > 0; }
#endif #endif
private: private:
// change the font for everything in this control // change the font for everything in this control
void ChangeFontGlobally(); void ChangeFontGlobally();
@@ -224,7 +224,7 @@ private:
// number of calls to Freeze() minus number of calls to Thaw() // number of calls to Freeze() minus number of calls to Thaw()
unsigned int m_frozenness; unsigned int m_frozenness;
#endif #endif
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxTextCtrl); DECLARE_DYNAMIC_CLASS(wxTextCtrl);

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -111,7 +111,7 @@ public:
void SetInsertionPoint( long pos ); void SetInsertionPoint( long pos );
void SetInsertionPointEnd() { SetInsertionPoint( -1 ); } void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
long GetInsertionPoint() const; long GetInsertionPoint() const;
long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
void Remove(long from, long to) { Replace(from, to, wxEmptyString); } void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
void Replace( long from, long to, const wxString& value ); void Replace( long from, long to, const wxString& value );
void SetSelection( long from, long to ); void SetSelection( long from, long to );

View File

@@ -114,12 +114,12 @@ public:
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const; virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable); virtual void SetEditable(bool editable);
virtual bool Enable( bool enable = TRUE ); virtual bool Enable( bool enable = true );
// Implementation from now on // Implementation from now on
void OnDropFiles( wxDropFilesEvent &event ); void OnDropFiles( wxDropFilesEvent &event );
@@ -154,13 +154,13 @@ public:
void UpdateFontIfNeeded(); void UpdateFontIfNeeded();
#endif // __WXGTK20__/!__WXGTK20__ #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 // GTK+ textctrl is so dumb that you need to freeze/thaw it manually to
// avoid horrible flicker/scrolling back and forth // avoid horrible flicker/scrolling back and forth
virtual void Freeze(); virtual void Freeze();
virtual void Thaw(); virtual void Thaw();
// textctrl specific scrolling // textctrl specific scrolling
virtual bool ScrollLines(int lines); virtual bool ScrollLines(int lines);
virtual bool ScrollPages(int pages); virtual bool ScrollPages(int pages);
@@ -180,7 +180,7 @@ public:
static wxVisualAttributes static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
protected: protected:
virtual wxSize DoGetBestSize() const; virtual wxSize DoGetBestSize() const;
@@ -202,7 +202,7 @@ protected:
// has the control been frozen by Freeze()? // has the control been frozen by Freeze()?
bool IsFrozen() const { return m_frozenness > 0; } bool IsFrozen() const { return m_frozenness > 0; }
#endif #endif
private: private:
// change the font for everything in this control // change the font for everything in this control
void ChangeFontGlobally(); void ChangeFontGlobally();
@@ -224,7 +224,7 @@ private:
// number of calls to Freeze() minus number of calls to Thaw() // number of calls to Freeze() minus number of calls to Thaw()
unsigned int m_frozenness; unsigned int m_frozenness;
#endif #endif
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxTextCtrl); DECLARE_DYNAMIC_CLASS(wxTextCtrl);

View File

@@ -16,7 +16,6 @@
#pragma interface "combobox.h" #pragma interface "combobox.h"
#endif #endif
#include "wx/textctrl.h"
#include "wx/choice.h" #include "wx/choice.h"
WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr; WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr;
@@ -39,8 +38,8 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
virtual void DoMoveWindow(int x, int y, int width, int height); virtual void DoMoveWindow(int x, int y, int width, int height);
// forward these functions to all subcontrols // forward these functions to all subcontrols
virtual bool Enable(bool enable = TRUE); virtual bool Enable(bool enable = true);
virtual bool Show(bool show = TRUE); virtual bool Show(bool show = true);
virtual void SetFocus(); virtual void SetFocus();
// callback functions // callback functions
@@ -111,7 +110,7 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const ; virtual long GetInsertionPoint() const ;
virtual long GetLastPosition() const ; virtual wxTextPos GetLastPosition() const ;
virtual void Replace(long from, long to, const wxString& value); virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to); virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);

View File

@@ -26,7 +26,7 @@ class wxMacTextControl ;
class WXDLLEXPORT wxTextCtrl: public wxTextCtrlBase class WXDLLEXPORT wxTextCtrl: public wxTextCtrlBase
{ {
DECLARE_DYNAMIC_CLASS(wxTextCtrl) DECLARE_DYNAMIC_CLASS(wxTextCtrl)
public: public:
// creation // creation
// -------- // --------
@@ -43,14 +43,14 @@ public:
Create(parent, id, value, pos, size, style, validator, name); Create(parent, id, value, pos, size, style, validator, name);
} }
bool Create(wxWindow *parent, wxWindowID id, bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTextCtrlNameStr); const wxString& name = wxTextCtrlNameStr);
// accessors // accessors
// --------- // ---------
virtual wxString GetValue() const ; virtual wxString GetValue() const ;
@@ -110,7 +110,7 @@ public:
virtual void Copy(); virtual void Copy();
virtual void Cut(); virtual void Cut();
virtual void Paste(); virtual void Paste();
virtual bool CanCopy() const; virtual bool CanCopy() const;
virtual bool CanCut() const; virtual bool CanCut() const;
virtual bool CanPaste() const; virtual bool CanPaste() const;
@@ -126,7 +126,7 @@ public:
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const; virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable); virtual void SetEditable(bool editable);
@@ -155,7 +155,7 @@ public:
void OnUpdatePaste(wxUpdateUIEvent& event); void OnUpdatePaste(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event); void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event); void OnUpdateRedo(wxUpdateUIEvent& event);
void OnEraseBackground(wxEraseEvent& event) ; void OnEraseBackground(wxEraseEvent& event) ;
virtual bool MacCanFocus() const { return true ; } virtual bool MacCanFocus() const { return true ; }

View File

@@ -16,7 +16,6 @@
#pragma interface "combobox.h" #pragma interface "combobox.h"
#endif #endif
#include "wx/textctrl.h"
#include "wx/choice.h" #include "wx/choice.h"
WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr; WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr;
@@ -34,8 +33,8 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
virtual void DoMoveWindow(int x, int y, int width, int height); virtual void DoMoveWindow(int x, int y, int width, int height);
// forward these functions to all subcontrols // forward these functions to all subcontrols
virtual bool Enable(bool enable = TRUE); virtual bool Enable(bool enable = true);
virtual bool Show(bool show = TRUE); virtual bool Show(bool show = true);
virtual void SetFocus(); virtual void SetFocus();
// callback functions // callback functions
@@ -106,7 +105,7 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const ; virtual long GetInsertionPoint() const ;
virtual long GetLastPosition() const ; virtual wxTextPos GetLastPosition() const ;
virtual void Replace(long from, long to, const wxString& value); virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to); virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);

View File

@@ -24,7 +24,7 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxTextCtrlNameStr;
class WXDLLEXPORT wxTextCtrl: public wxTextCtrlBase class WXDLLEXPORT wxTextCtrl: public wxTextCtrlBase
{ {
DECLARE_DYNAMIC_CLASS(wxTextCtrl) DECLARE_DYNAMIC_CLASS(wxTextCtrl)
public: public:
// creation // creation
// -------- // --------
@@ -41,14 +41,14 @@ public:
Create(parent, id, value, pos, size, style, validator, name); Create(parent, id, value, pos, size, style, validator, name);
} }
bool Create(wxWindow *parent, wxWindowID id, bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTextCtrlNameStr); const wxString& name = wxTextCtrlNameStr);
// accessors // accessors
// --------- // ---------
virtual wxString GetValue() const ; virtual wxString GetValue() const ;
@@ -107,7 +107,7 @@ public:
virtual void Copy(); virtual void Copy();
virtual void Cut(); virtual void Cut();
virtual void Paste(); virtual void Paste();
virtual bool CanCopy() const; virtual bool CanCopy() const;
virtual bool CanCut() const; virtual bool CanCut() const;
virtual bool CanPaste() const; virtual bool CanPaste() const;
@@ -123,7 +123,7 @@ public:
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const; virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable); virtual void SetEditable(bool editable);
@@ -157,7 +157,7 @@ public:
virtual bool MacSetupCursor( const wxPoint& pt ) ; virtual bool MacSetupCursor( const wxPoint& pt ) ;
virtual void MacSuperShown( bool show ) ; virtual void MacSuperShown( bool show ) ;
virtual bool Show(bool show = TRUE) ; virtual bool Show(bool show = true) ;
protected: protected:
// common part of all ctors // common part of all ctors
@@ -176,7 +176,7 @@ protected:
void* m_macTXNvars ; void* m_macTXNvars ;
bool m_macUsesTXN ; bool m_macUsesTXN ;
unsigned long m_maxLength ; unsigned long m_maxLength ;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -6,7 +6,7 @@
// Created: 17/09/98 // Created: 17/09/98
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COMBOBOX_H_ #ifndef _WX_COMBOBOX_H_
@@ -22,11 +22,11 @@
class WXDLLEXPORT wxComboBox: public wxChoice class WXDLLEXPORT wxComboBox: public wxChoice
{ {
DECLARE_DYNAMIC_CLASS(wxComboBox) DECLARE_DYNAMIC_CLASS(wxComboBox)
public: public:
wxComboBox() { m_inSetSelection = false; } wxComboBox() { m_inSetSelection = false; }
~wxComboBox(); ~wxComboBox();
inline wxComboBox(wxWindow *parent, wxWindowID id, inline wxComboBox(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
@@ -40,7 +40,7 @@ public:
Create(parent, id, value, pos, size, n, choices, Create(parent, id, value, pos, size, n, choices,
style, validator, name); style, validator, name);
} }
inline wxComboBox(wxWindow *parent, wxWindowID id, inline wxComboBox(wxWindow *parent, wxWindowID id,
const wxString& value, const wxString& value,
const wxPoint& pos, const wxPoint& pos,
@@ -54,7 +54,7 @@ public:
Create(parent, id, value, pos, size, choices, Create(parent, id, value, pos, size, choices,
style, validator, name); style, validator, name);
} }
bool Create(wxWindow *parent, wxWindowID id, bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
@@ -63,7 +63,7 @@ public:
long style = 0, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr); const wxString& name = wxComboBoxNameStr);
bool Create(wxWindow *parent, wxWindowID id, bool Create(wxWindow *parent, wxWindowID id,
const wxString& value, const wxString& value,
const wxPoint& pos, const wxPoint& pos,
@@ -72,7 +72,7 @@ public:
long style = 0, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr); const wxString& name = wxComboBoxNameStr);
// implementation of wxControlWithItems // implementation of wxControlWithItems
virtual int DoAppend(const wxString& item); virtual int DoAppend(const wxString& item);
virtual int DoInsert(const wxString& item, int pos); virtual int DoInsert(const wxString& item, int pos);
@@ -87,7 +87,7 @@ public:
// Text field functions // Text field functions
virtual wxString GetValue() const ; virtual wxString GetValue() const ;
virtual void SetValue(const wxString& value); virtual void SetValue(const wxString& value);
// Clipboard operations // Clipboard operations
virtual void Copy(); virtual void Copy();
virtual void Cut(); virtual void Cut();
@@ -95,14 +95,14 @@ public:
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const ; virtual long GetInsertionPoint() const ;
virtual long GetLastPosition() const ; virtual wxTextPos GetLastPosition() const ;
virtual void Replace(long from, long to, const wxString& value); virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to); virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable); virtual void SetEditable(bool editable);
// Implementation // Implementation
virtual void ChangeFont(bool keepOriginalSize = TRUE); virtual void ChangeFont(bool keepOriginalSize = true);
virtual void ChangeBackgroundColour(); virtual void ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
WXWidget GetTopWidget() const { return m_mainWidget; } WXWidget GetTopWidget() const { return m_mainWidget; }

View File

@@ -20,7 +20,7 @@
class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase
{ {
DECLARE_DYNAMIC_CLASS(wxTextCtrl) DECLARE_DYNAMIC_CLASS(wxTextCtrl)
public: public:
// creation // creation
// -------- // --------
@@ -36,26 +36,26 @@ public:
{ {
Create(parent, id, value, pos, size, style, validator, name); Create(parent, id, value, pos, size, style, validator, name);
} }
bool Create(wxWindow *parent, wxWindowID id, bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0, const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTextCtrlNameStr); const wxString& name = wxTextCtrlNameStr);
// accessors // accessors
// --------- // ---------
virtual wxString GetValue() const; virtual wxString GetValue() const;
virtual void SetValue(const wxString& value); virtual void SetValue(const wxString& value);
virtual int GetLineLength(long lineNo) const; virtual int GetLineLength(long lineNo) const;
virtual wxString GetLineText(long lineNo) const; virtual wxString GetLineText(long lineNo) const;
virtual int GetNumberOfLines() const; virtual int GetNumberOfLines() const;
// operations // operations
// ---------- // ----------
// Clipboard operations // Clipboard operations
virtual void Copy(); virtual void Copy();
virtual void Cut(); virtual void Cut();
@@ -63,18 +63,18 @@ public:
virtual bool CanCopy() const; virtual bool CanCopy() const;
virtual bool CanCut() const; virtual bool CanCut() const;
virtual bool CanPaste() const; virtual bool CanPaste() const;
// Undo/redo // Undo/redo
virtual void Undo(); virtual void Undo();
virtual void Redo(); virtual void Redo();
virtual bool CanUndo() const; virtual bool CanUndo() const;
virtual bool CanRedo() const; virtual bool CanRedo() const;
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const; virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
virtual void Replace(long from, long to, const wxString& value); virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to); virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);
@@ -83,50 +83,50 @@ public:
// selection. // selection.
virtual void GetSelection(long* from, long* to) const; virtual void GetSelection(long* from, long* to) const;
virtual bool IsEditable() const ; virtual bool IsEditable() const ;
virtual void WriteText(const wxString& text); virtual void WriteText(const wxString& text);
virtual void AppendText(const wxString& text); virtual void AppendText(const wxString& text);
virtual void MarkDirty(); virtual void MarkDirty();
virtual void DiscardEdits(); virtual void DiscardEdits();
virtual bool IsModified() const; virtual bool IsModified() const;
virtual long XYToPosition(long x, long y) const; virtual long XYToPosition(long x, long y) const;
virtual bool PositionToXY(long pos, long *x, long *y) const; virtual bool PositionToXY(long pos, long *x, long *y) const;
virtual void ShowPosition(long pos); virtual void ShowPosition(long pos);
virtual void Clear(); virtual void Clear();
// callbacks // callbacks
// --------- // ---------
void OnDropFiles(wxDropFilesEvent& event); void OnDropFiles(wxDropFilesEvent& event);
void OnChar(wxKeyEvent& event); void OnChar(wxKeyEvent& event);
// void OnEraseBackground(wxEraseEvent& event); // void OnEraseBackground(wxEraseEvent& event);
void OnCut(wxCommandEvent& event); void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event); void OnCopy(wxCommandEvent& event);
void OnPaste(wxCommandEvent& event); void OnPaste(wxCommandEvent& event);
void OnUndo(wxCommandEvent& event); void OnUndo(wxCommandEvent& event);
void OnRedo(wxCommandEvent& event); void OnRedo(wxCommandEvent& event);
void OnUpdateCut(wxUpdateUIEvent& event); void OnUpdateCut(wxUpdateUIEvent& event);
void OnUpdateCopy(wxUpdateUIEvent& event); void OnUpdateCopy(wxUpdateUIEvent& event);
void OnUpdatePaste(wxUpdateUIEvent& event); void OnUpdatePaste(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event); void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(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 ChangeBackgroundColour();
virtual void ChangeForegroundColour(); virtual void ChangeForegroundColour();
void SetModified(bool mod) { m_modified = mod; } void SetModified(bool mod) { m_modified = mod; }
virtual WXWidget GetTopWidget() const; virtual WXWidget GetTopWidget() const;
// send the CHAR and TEXT_UPDATED events // send the CHAR and TEXT_UPDATED events
void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs, void DoSendEvents(void /* XmTextVerifyCallbackStruct */ *cbs,
long keycode); long keycode);
protected: protected:
wxString m_fileName; wxString m_fileName;
@@ -136,10 +136,10 @@ public:
void* m_tempCallbackStruct; void* m_tempCallbackStruct;
bool m_modified; bool m_modified;
wxString m_value; // Required for password text controls wxString m_value; // Required for password text controls
// Did we call wxTextCtrl::OnChar? If so, generate a command event. // Did we call wxTextCtrl::OnChar? If so, generate a command event.
bool m_processedDefault; bool m_processedDefault;
private: private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -92,7 +92,7 @@ public:
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const; virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
virtual void Replace(long from, long to, const wxString& value); virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to); virtual void Remove(long from, long to);
virtual void SetSelection(int n) { wxChoice::SetSelection(n); } virtual void SetSelection(int n) { wxChoice::SetSelection(n); }

View File

@@ -131,7 +131,7 @@ public:
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const; virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable); virtual void SetEditable(bool editable);

View File

@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// 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 // Author: Wlodzimierz ABX Skiba
// Modified by: // Modified by:
// Created: 30.08.2004 // Created: 30.08.2004
@@ -124,7 +124,7 @@ public:
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const; virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable); virtual void SetEditable(bool editable);

View File

@@ -110,7 +110,7 @@ class WXDLLEXPORT wxComboBox : public wxChoice
virtual void SetInsertionPoint(long lPos); virtual void SetInsertionPoint(long lPos);
virtual void SetInsertionPointEnd(void); virtual void SetInsertionPointEnd(void);
virtual long GetInsertionPoint(void) const; virtual long GetInsertionPoint(void) const;
virtual long GetLastPosition(void) const; virtual wxTextPos GetLastPosition(void) const;
virtual void Replace( long lFrom virtual void Replace( long lFrom
,long lTo ,long lTo
,const wxString& rsValue ,const wxString& rsValue

View File

@@ -112,7 +112,7 @@ public:
virtual void SetInsertionPoint(long lPos); virtual void SetInsertionPoint(long lPos);
virtual void SetInsertionPointEnd(void); virtual void SetInsertionPointEnd(void);
virtual long GetInsertionPoint(void) const; virtual long GetInsertionPoint(void) const;
virtual long GetLastPosition(void) const; virtual wxTextPos GetLastPosition(void) const;
virtual void SetSelection( long lFrom virtual void SetSelection( long lFrom
,long lTo ,long lTo

View File

@@ -85,7 +85,7 @@ public:
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const; virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
virtual void Replace(long from, long to, const wxString& value); virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to); virtual void Remove(long from, long to);
virtual void SetSelection(int n) { wxChoice::SetSelection(n); } virtual void SetSelection(int n) { wxChoice::SetSelection(n); }

View File

@@ -123,7 +123,7 @@ public:
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const; virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable); virtual void SetEditable(bool editable);

View File

@@ -70,6 +70,11 @@ typedef long wxTextCoord;
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
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -359,7 +364,7 @@ public:
virtual void SetInsertionPoint(long pos) = 0; virtual void SetInsertionPoint(long pos) = 0;
virtual void SetInsertionPointEnd() = 0; virtual void SetInsertionPointEnd() = 0;
virtual long GetInsertionPoint() const = 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 SetSelection(long from, long to) = 0;
virtual void SelectAll(); virtual void SelectAll();

View File

@@ -277,7 +277,7 @@ public:
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const; virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
virtual void Replace(long from, long to, const wxString& value); virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to); virtual void Remove(long from, long to);
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);

View File

@@ -183,18 +183,18 @@ public:
virtual void Redo() {} virtual void Redo() {}
virtual bool CanUndo() const { return (m_undos.GetCount() > 0); } virtual bool CanUndo() const { return (m_undos.GetCount() > 0); }
virtual bool CanRedo() const { return FALSE; } virtual bool CanRedo() const { return false; }
// Insertion point // Insertion point
virtual void SetInsertionPoint(long pos); virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd(); virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const; virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const; virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to); virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable); virtual void SetEditable(bool editable);
virtual bool Enable( bool enable = TRUE ); virtual bool Enable( bool enable = true );
void OnCut(wxCommandEvent& event); void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event); void OnCopy(wxCommandEvent& event);
@@ -212,7 +212,7 @@ public:
bool SetForegroundColour(const wxColour& colour); bool SetForegroundColour(const wxColour& colour);
bool SetBackgroundColour(const wxColour& colour); bool SetBackgroundColour(const wxColour& colour);
void SetModified() { m_modified = TRUE; } void SetModified() { m_modified = true; }
virtual void Freeze(); virtual void Freeze();
virtual void Thaw(); virtual void Thaw();
@@ -266,7 +266,7 @@ public:
void OnInternalIdle(); void OnInternalIdle();
void RefreshLine( int n ); void RefreshLine( int n );
void RefreshDown( 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(); void MyAdjustScrollbars();
protected: protected:
@@ -370,13 +370,6 @@ private:
// 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 class WXDLLEXPORT wxStdTextCtrlInputHandler : public wxStdInputHandler
{ {
public: public:
@@ -384,10 +377,10 @@ public:
virtual bool HandleKey(wxInputConsumer *consumer, virtual bool HandleKey(wxInputConsumer *consumer,
const wxKeyEvent& event, const wxKeyEvent& event,
bool pressed) { return FALSE; } bool pressed) { return false; }
virtual bool HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { return FALSE; } virtual bool HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { return false; }
virtual bool HandleMouseMove(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; } virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) { return false; }
protected: protected:
// get the position of the mouse click // get the position of the mouse click

View File

@@ -6,7 +6,7 @@
// Created: 2003/03/16 // Created: 2003/03/16
// RCS-ID: $Id: // RCS-ID: $Id:
// Copyright: (c) 2003 David Elliott // Copyright: (c) 2003 David Elliott
// Licence: wxWidgets licence // Licence: wxWidgets licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h" #include "wx/wxprec.h"
@@ -177,7 +177,7 @@ int wxTextCtrl::GetLineLength(long) const
return 0; return 0;
} }
long wxTextCtrl::GetLastPosition() const wxTextPos wxTextCtrl::GetLastPosition() const
{ {
return 0; return 0;
} }

View File

@@ -220,7 +220,7 @@ bool wxTextCtrlBase::LoadFile(const wxString& filename)
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() ) if ( filenameToUse.empty() )
{ {
// what kind of message to give? is it an error or a program bug? // what kind of message to give? is it an error or a program bug?
@@ -394,9 +394,8 @@ bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event)
case WXK_NUMPAD_DELETE: case WXK_NUMPAD_DELETE:
// delete the character at cursor // delete the character at cursor
{ {
const long pos = GetInsertionPoint(), const long pos = GetInsertionPoint();
last = GetLastPosition(); if ( pos < GetLastPosition() )
if ( pos < last )
Remove(pos, pos + 1); Remove(pos, pos + 1);
} }
break; break;

View File

@@ -644,7 +644,7 @@ void wxLogWindow::DoLogString(const wxChar *szString, time_t WXUNUSED(t))
// remove selection (WriteText is in fact ReplaceSelection) // remove selection (WriteText is in fact ReplaceSelection)
#ifdef __WXMSW__ #ifdef __WXMSW__
long nLen = pText->GetLastPosition(); wxTextPos nLen = pText->GetLastPosition();
pText->SetSelection(nLen, nLen); pText->SetSelection(nLen, nLen);
#endif // Windows #endif // Windows

View File

@@ -51,7 +51,7 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
if (combo->m_ignoreNextUpdate) if (combo->m_ignoreNextUpdate)
{ {
combo->m_ignoreNextUpdate = FALSE; combo->m_ignoreNextUpdate = false;
return; return;
} }
@@ -70,7 +70,7 @@ gtk_dummy_callback(GtkEntry *WXUNUSED(entry), GtkCombo *WXUNUSED(combo))
static void static void
gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo) gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
{ {
// when the popup is hidden, throw a SELECTED event only if the combobox // when the popup is hidden, throw a SELECTED event only if the combobox
// selection changed. // selection changed.
int curSelection = combo->GetSelection(); int curSelection = combo->GetSelection();
@@ -82,7 +82,7 @@ gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
event.SetEventObject( combo ); event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event ); combo->GetEventHandler()->ProcessEvent( event );
} }
// reset the selection flag to an identifiable value // reset the selection flag to an identifiable value
g_SelectionBeforePopup = -1; g_SelectionBeforePopup = -1;
} }
@@ -192,16 +192,16 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
long style, const wxValidator& validator, long style, const wxValidator& validator,
const wxString& name ) const wxString& name )
{ {
m_ignoreNextUpdate = FALSE; m_ignoreNextUpdate = false;
m_needParent = TRUE; m_needParent = true;
m_acceptsFocus = TRUE; m_acceptsFocus = true;
m_prevSelection = 0; m_prevSelection = 0;
if (!PreCreation( parent, pos, size ) || if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name )) !CreateBase( parent, id, pos, size, style, validator, name ))
{ {
wxFAIL_MSG( wxT("wxComboBox creation failed") ); wxFAIL_MSG( wxT("wxComboBox creation failed") );
return FALSE; return false;
} }
m_widget = gtk_combo_new(); m_widget = gtk_combo_new();
@@ -211,7 +211,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
gtk_signal_disconnect( GTK_OBJECT(combo->entry), combo->entry_change_id ); gtk_signal_disconnect( GTK_OBJECT(combo->entry), combo->entry_change_id );
// ... and add surogate handler. // ... and add surogate handler.
combo->entry_change_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "changed", 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 // make it more useable
gtk_combo_set_use_arrows_always( GTK_COMBO(m_widget), TRUE ); gtk_combo_set_use_arrows_always( GTK_COMBO(m_widget), TRUE );
@@ -223,7 +223,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
if (style & wxNO_BORDER) if (style & wxNO_BORDER)
g_object_set( GTK_ENTRY( combo->entry ), "has-frame", FALSE, NULL ); g_object_set( GTK_ENTRY( combo->entry ), "has-frame", FALSE, NULL );
#endif #endif
GtkWidget *list = GTK_COMBO(m_widget)->list; GtkWidget *list = GTK_COMBO(m_widget)->list;
#ifndef __WXGTK20__ #ifndef __WXGTK20__
@@ -260,9 +260,9 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
// "show" and "hide" events are generated when user click on the combobox button which popups a list // "show" and "hide" events are generated when user click on the combobox button which popups a list
// this list is the "popwin" gtk widget // this list is the "popwin" gtk widget
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(combo)->popwin), "hide", 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_connect( GTK_OBJECT(combo->entry), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this );
@@ -276,7 +276,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
wxSize setsize = GetSize(); wxSize setsize = GetSize();
gtk_widget_set_usize( m_widget, setsize.x, setsize.y ); gtk_widget_set_usize( m_widget, setsize.x, setsize.y );
return TRUE; return true;
} }
wxComboBox::~wxComboBox() wxComboBox::~wxComboBox()
@@ -780,7 +780,7 @@ long wxComboBox::GetInsertionPoint() const
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; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length; int pos = GTK_ENTRY(entry)->text_length;

View File

@@ -292,13 +292,13 @@ END_EVENT_TABLE()
void wxTextCtrl::Init() void wxTextCtrl::Init()
{ {
m_ignoreNextUpdate = m_ignoreNextUpdate =
m_modified = FALSE; m_modified = false;
SetUpdateFont(FALSE); SetUpdateFont(false);
m_text = m_text =
m_vScrollbar = (GtkWidget *)NULL; m_vScrollbar = (GtkWidget *)NULL;
#ifdef __WXGTK20__ #ifdef __WXGTK20__
m_frozenness = 0; m_frozenness = 0;
#endif #endif
} }
wxTextCtrl::wxTextCtrl( wxWindow *parent, wxTextCtrl::wxTextCtrl( wxWindow *parent,
@@ -324,18 +324,18 @@ bool wxTextCtrl::Create( wxWindow *parent,
const wxValidator& validator, const wxValidator& validator,
const wxString &name ) const wxString &name )
{ {
m_needParent = TRUE; m_needParent = true;
m_acceptsFocus = TRUE; m_acceptsFocus = true;
if (!PreCreation( parent, pos, size ) || if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name )) !CreateBase( parent, id, pos, size, style, validator, name ))
{ {
wxFAIL_MSG( wxT("wxTextCtrl creation failed") ); wxFAIL_MSG( wxT("wxTextCtrl creation failed") );
return FALSE; return false;
} }
m_vScrollbarVisible = FALSE; m_vScrollbarVisible = false;
bool multi_line = (style & wxTE_MULTILINE) != 0; bool multi_line = (style & wxTE_MULTILINE) != 0;
@@ -363,14 +363,14 @@ bool wxTextCtrl::Create( wxWindow *parent,
if (!HasFlag(wxNO_BORDER)) if (!HasFlag(wxNO_BORDER))
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
#else #else
// create our control ... // create our control ...
m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL ); m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
// ... and put into the upper left hand corner of the table // ... 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); m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1,
@@ -396,7 +396,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
m_widget = m_widget =
m_text = gtk_entry_new(); m_text = gtk_entry_new();
#ifdef __WXGTK20__ #ifdef __WXGTK20__
if (style & wxNO_BORDER) if (style & wxNO_BORDER)
g_object_set( GTK_ENTRY(m_text), "has-frame", FALSE, NULL ); g_object_set( GTK_ENTRY(m_text), "has-frame", FALSE, NULL );
#endif #endif
@@ -431,7 +431,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
} }
#endif // GTK+ 1.x #endif // GTK+ 1.x
if (!value.IsEmpty()) if (!value.empty())
{ {
#ifdef __WXGTK20__ #ifdef __WXGTK20__
SetValue( value ); SetValue( value );
@@ -505,7 +505,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
#endif #endif
} }
#endif // __WXGTK20__ #endif // __WXGTK20__
// We want to be notified about text changes. // We want to be notified about text changes.
#ifdef __WXGTK20__ #ifdef __WXGTK20__
if (multi_line) if (multi_line)
@@ -515,7 +515,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
} }
else else
#endif #endif
{ {
gtk_signal_connect( GTK_OBJECT(m_text), "changed", gtk_signal_connect( GTK_OBJECT(m_text), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
@@ -526,7 +526,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
wxTextAttr attrDef(GetForegroundColour(), GetBackgroundColour(), GetFont()); wxTextAttr attrDef(GetForegroundColour(), GetBackgroundColour(), GetFont());
SetDefaultStyle( attrDef ); SetDefaultStyle( attrDef );
return TRUE; return true;
} }
@@ -542,7 +542,7 @@ void wxTextCtrl::CalculateScrollbar()
if (m_vScrollbarVisible) if (m_vScrollbarVisible)
{ {
gtk_widget_hide( m_vScrollbar ); gtk_widget_hide( m_vScrollbar );
m_vScrollbarVisible = FALSE; m_vScrollbarVisible = false;
} }
} }
else else
@@ -550,7 +550,7 @@ void wxTextCtrl::CalculateScrollbar()
if (!m_vScrollbarVisible) if (!m_vScrollbarVisible)
{ {
gtk_widget_show( m_vScrollbar ); gtk_widget_show( m_vScrollbar );
m_vScrollbarVisible = TRUE; m_vScrollbarVisible = true;
} }
} }
#endif #endif
@@ -629,7 +629,7 @@ void wxTextCtrl::SetValue( const wxString &value )
// customize this behaviour. // customize this behaviour.
SetInsertionPoint(0); SetInsertionPoint(0);
m_modified = FALSE; m_modified = false;
} }
void wxTextCtrl::WriteText( const wxString &text ) void wxTextCtrl::WriteText( const wxString &text )
@@ -683,7 +683,7 @@ void wxTextCtrl::WriteText( const wxString &text )
// in UpdateFontIfNeeded() any longer // in UpdateFontIfNeeded() any longer
if ( !text.empty() ) if ( !text.empty() )
{ {
SetUpdateFont(FALSE); SetUpdateFont(false);
} }
// Bring editable's cursor back uptodate. // Bring editable's cursor back uptodate.
@@ -785,7 +785,7 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
// cast to prevent warning. But pos really should've been unsigned. // cast to prevent warning. But pos really should've been unsigned.
if( (unsigned long)pos > text.Len() ) if( (unsigned long)pos > text.Len() )
return FALSE; return false;
*x=0; // First Col *x=0; // First Col
*y=0; // First Line *y=0; // First Line
@@ -812,11 +812,11 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
else else
{ {
// index out of bounds // index out of bounds
return FALSE; return false;
} }
} }
return TRUE; return true;
} }
long wxTextCtrl::XYToPosition(long x, long y ) const long wxTextCtrl::XYToPosition(long x, long y ) const
@@ -957,7 +957,7 @@ bool wxTextCtrl::Enable( bool enable )
if (!wxWindowBase::Enable(enable)) if (!wxWindowBase::Enable(enable))
{ {
// nothing to do // nothing to do
return FALSE; return false;
} }
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -974,7 +974,7 @@ bool wxTextCtrl::Enable( bool enable )
gtk_widget_set_sensitive( m_text, enable ); gtk_widget_set_sensitive( m_text, enable );
} }
return TRUE; return true;
} }
// wxGTK-specific: called recursively by Enable, // wxGTK-specific: called recursively by Enable,
@@ -999,12 +999,12 @@ void wxTextCtrl::OnParentEnable( bool enable )
void wxTextCtrl::MarkDirty() void wxTextCtrl::MarkDirty()
{ {
m_modified = TRUE; m_modified = true;
} }
void wxTextCtrl::DiscardEdits() void wxTextCtrl::DiscardEdits()
{ {
m_modified = FALSE; m_modified = false;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1013,19 +1013,19 @@ void wxTextCtrl::DiscardEdits()
void wxTextCtrl::IgnoreNextTextUpdate() void wxTextCtrl::IgnoreNextTextUpdate()
{ {
m_ignoreNextUpdate = TRUE; m_ignoreNextUpdate = true;
} }
bool wxTextCtrl::IgnoreTextUpdate() bool wxTextCtrl::IgnoreTextUpdate()
{ {
if ( m_ignoreNextUpdate ) if ( m_ignoreNextUpdate )
{ {
m_ignoreNextUpdate = FALSE; m_ignoreNextUpdate = false;
return TRUE; return true;
} }
return FALSE; return false;
} }
void wxTextCtrl::SetMaxLength(unsigned long len) void wxTextCtrl::SetMaxLength(unsigned long len)
@@ -1178,7 +1178,7 @@ long wxTextCtrl::GetInsertionPoint() const
} }
} }
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") );
@@ -1227,7 +1227,7 @@ void wxTextCtrl::Replace( long from, long to, const wxString &value )
Remove( from, to ); Remove( from, to );
if (!value.IsEmpty()) if (!value.empty())
{ {
#ifdef __WXGTK20__ #ifdef __WXGTK20__
SetInsertionPoint( from ); SetInsertionPoint( from );
@@ -1297,14 +1297,14 @@ bool wxTextCtrl::CanUndo() const
{ {
// TODO // TODO
//wxFAIL_MSG( wxT("wxTextCtrl::CanUndo not implemented") ); //wxFAIL_MSG( wxT("wxTextCtrl::CanUndo not implemented") );
return FALSE; return false;
} }
bool wxTextCtrl::CanRedo() const bool wxTextCtrl::CanRedo() const
{ {
// TODO // TODO
//wxFAIL_MSG( wxT("wxTextCtrl::CanRedo not implemented") ); //wxFAIL_MSG( wxT("wxTextCtrl::CanRedo not implemented") );
return FALSE; return false;
} }
// 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
@@ -1315,7 +1315,7 @@ void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const
gint from = -1; gint from = -1;
gint to = -1; gint to = -1;
bool haveSelection = FALSE; bool haveSelection = false;
#ifdef __WXGTK20__ #ifdef __WXGTK20__
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -1323,7 +1323,7 @@ void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const
GtkTextIter ifrom, ito; GtkTextIter ifrom, ito;
if ( gtk_text_buffer_get_selection_bounds(m_buffer, &ifrom, &ito) ) if ( gtk_text_buffer_get_selection_bounds(m_buffer, &ifrom, &ito) )
{ {
haveSelection = TRUE; haveSelection = true;
from = gtk_text_iter_get_offset(&ifrom); from = gtk_text_iter_get_offset(&ifrom);
to = gtk_text_iter_get_offset(&ito); to = gtk_text_iter_get_offset(&ito);
} }
@@ -1333,13 +1333,13 @@ void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const
if ( gtk_editable_get_selection_bounds( GTK_EDITABLE(m_text), if ( gtk_editable_get_selection_bounds( GTK_EDITABLE(m_text),
&from, &to) ) &from, &to) )
{ {
haveSelection = TRUE; haveSelection = true;
} }
} }
#else // not GTK2 #else // not GTK2
if ( (GTK_EDITABLE(m_text)->has_selection) ) if ( (GTK_EDITABLE(m_text)->has_selection) )
{ {
haveSelection = TRUE; haveSelection = true;
from = (long) GTK_EDITABLE(m_text)->selection_start_pos; from = (long) GTK_EDITABLE(m_text)->selection_start_pos;
to = (long) GTK_EDITABLE(m_text)->selection_end_pos; to = (long) GTK_EDITABLE(m_text)->selection_end_pos;
} }
@@ -1365,7 +1365,7 @@ void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const
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__ #ifdef __WXGTK20__
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -1451,24 +1451,24 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
// the font will change for subsequent text insertiongs // the font will change for subsequent text insertiongs
bool wxTextCtrl::SetFont( const wxFont &font ) 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) ) if ( !wxTextCtrlBase::SetFont(font) )
{ {
// font didn't change, nothing to do // font didn't change, nothing to do
return FALSE; return false;
} }
if ( m_windowStyle & wxTE_MULTILINE ) if ( m_windowStyle & wxTE_MULTILINE )
{ {
SetUpdateFont(TRUE); SetUpdateFont(true);
m_defaultStyle.SetFont(font); m_defaultStyle.SetFont(font);
ChangeFontGlobally(); ChangeFontGlobally();
} }
return TRUE; return true;
} }
void wxTextCtrl::ChangeFontGlobally() void wxTextCtrl::ChangeFontGlobally()
@@ -1487,9 +1487,9 @@ void wxTextCtrl::ChangeFontGlobally()
#endif #endif
wxString value = GetValue(); wxString value = GetValue();
if ( !value.IsEmpty() ) if ( !value.empty() )
{ {
SetUpdateFont(FALSE); SetUpdateFont(false);
Clear(); Clear();
AppendText(value); AppendText(value);
@@ -1509,35 +1509,35 @@ void wxTextCtrl::UpdateFontIfNeeded()
bool wxTextCtrl::SetForegroundColour(const wxColour& colour) bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
{ {
if ( !wxControl::SetForegroundColour(colour) ) if ( !wxControl::SetForegroundColour(colour) )
return FALSE; return false;
// update default fg colour too // update default fg colour too
m_defaultStyle.SetTextColour(colour); m_defaultStyle.SetTextColour(colour);
return TRUE; return true;
} }
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 ) )
return FALSE; return false;
#ifndef __WXGTK20__ #ifndef __WXGTK20__
if (!m_widget->window) if (!m_widget->window)
return FALSE; return false;
#endif #endif
if (!m_backgroundColour.Ok()) if (!m_backgroundColour.Ok())
return FALSE; return false;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
#ifndef __WXGTK20__ #ifndef __WXGTK20__
GdkWindow *window = GTK_TEXT(m_text)->text_area; GdkWindow *window = GTK_TEXT(m_text)->text_area;
if (!window) if (!window)
return FALSE; return false;
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) ); m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
gdk_window_set_background( window, m_backgroundColour.GetColor() ); gdk_window_set_background( window, m_backgroundColour.GetColor() );
gdk_window_clear( window ); gdk_window_clear( window );
@@ -1547,7 +1547,7 @@ bool wxTextCtrl::SetBackgroundColour( const wxColour &colour )
// change active background color too // change active background color too
m_defaultStyle.SetBackgroundColour( colour ); m_defaultStyle.SetBackgroundColour( colour );
return TRUE; return true;
} }
bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style ) bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
@@ -1557,12 +1557,12 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
if ( style.IsDefault() ) if ( style.IsDefault() )
{ {
// nothing to do // nothing to do
return TRUE; return true;
} }
#ifdef __WXGTK20__ #ifdef __WXGTK20__
gint l = gtk_text_buffer_get_char_count( m_buffer ); 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") ); _T("invalid range in wxTextCtrl::SetStyle") );
GtkTextIter starti, endi; GtkTextIter starti, endi;
@@ -1576,14 +1576,14 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi ); wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi );
return TRUE; return true;
#else #else
// VERY dirty way to do that - removes the required text and re-adds it // VERY dirty way to do that - removes the required text and re-adds it
// with styling (FIXME) // with styling (FIXME)
gint l = gtk_text_get_length( GTK_TEXT(m_text) ); 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") ); _T("invalid range in wxTextCtrl::SetStyle") );
gint old_pos = gtk_editable_get_position( GTK_EDITABLE(m_text) ); gint old_pos = gtk_editable_get_position( GTK_EDITABLE(m_text) );
@@ -1615,12 +1615,12 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */ gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */
SetInsertionPoint( old_pos ); SetInsertionPoint( old_pos );
#endif #endif
return TRUE; return true;
} }
else // singe line else // singe line
{ {
// cannot do this for GTK+'s Entry widget // cannot do this for GTK+'s Entry widget
return FALSE; return false;
} }
} }
@@ -1808,7 +1808,7 @@ bool wxTextCtrl::DoScroll(GtkAdjustment *adj, int diff)
if ( fabs(adj->value - value) < 0.2 ) if ( fabs(adj->value - value) < 0.2 )
{ {
// well, this is what Robert does in wxScrollBar, so it must be good... // well, this is what Robert does in wxScrollBar, so it must be good...
return FALSE; return false;
} }
adj->value = value; adj->value = value;
@@ -1819,14 +1819,14 @@ bool wxTextCtrl::DoScroll(GtkAdjustment *adj, int diff)
gtk_signal_emit_by_name(GTK_OBJECT(adj), "value_changed"); gtk_signal_emit_by_name(GTK_OBJECT(adj), "value_changed");
#endif #endif
return TRUE; return true;
} }
bool wxTextCtrl::ScrollLines(int lines) bool wxTextCtrl::ScrollLines(int lines)
{ {
GtkAdjustment *adj = GetVAdj(); GtkAdjustment *adj = GetVAdj();
if ( !adj ) if ( !adj )
return FALSE; return false;
#ifdef __WXGTK20__ #ifdef __WXGTK20__
int diff = (int)ceil(lines*adj->step_increment); int diff = (int)ceil(lines*adj->step_increment);
@@ -1842,7 +1842,7 @@ bool wxTextCtrl::ScrollPages(int pages)
{ {
GtkAdjustment *adj = GetVAdj(); GtkAdjustment *adj = GetVAdj();
if ( !adj ) if ( !adj )
return FALSE; return false;
return DoScroll(adj, (int)ceil(pages*adj->page_increment)); return DoScroll(adj, (int)ceil(pages*adj->page_increment));
} }

View File

@@ -51,7 +51,7 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
if (combo->m_ignoreNextUpdate) if (combo->m_ignoreNextUpdate)
{ {
combo->m_ignoreNextUpdate = FALSE; combo->m_ignoreNextUpdate = false;
return; return;
} }
@@ -70,7 +70,7 @@ gtk_dummy_callback(GtkEntry *WXUNUSED(entry), GtkCombo *WXUNUSED(combo))
static void static void
gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo) gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
{ {
// when the popup is hidden, throw a SELECTED event only if the combobox // when the popup is hidden, throw a SELECTED event only if the combobox
// selection changed. // selection changed.
int curSelection = combo->GetSelection(); int curSelection = combo->GetSelection();
@@ -82,7 +82,7 @@ gtk_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
event.SetEventObject( combo ); event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event ); combo->GetEventHandler()->ProcessEvent( event );
} }
// reset the selection flag to an identifiable value // reset the selection flag to an identifiable value
g_SelectionBeforePopup = -1; g_SelectionBeforePopup = -1;
} }
@@ -192,16 +192,16 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
long style, const wxValidator& validator, long style, const wxValidator& validator,
const wxString& name ) const wxString& name )
{ {
m_ignoreNextUpdate = FALSE; m_ignoreNextUpdate = false;
m_needParent = TRUE; m_needParent = true;
m_acceptsFocus = TRUE; m_acceptsFocus = true;
m_prevSelection = 0; m_prevSelection = 0;
if (!PreCreation( parent, pos, size ) || if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name )) !CreateBase( parent, id, pos, size, style, validator, name ))
{ {
wxFAIL_MSG( wxT("wxComboBox creation failed") ); wxFAIL_MSG( wxT("wxComboBox creation failed") );
return FALSE; return false;
} }
m_widget = gtk_combo_new(); m_widget = gtk_combo_new();
@@ -211,7 +211,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
gtk_signal_disconnect( GTK_OBJECT(combo->entry), combo->entry_change_id ); gtk_signal_disconnect( GTK_OBJECT(combo->entry), combo->entry_change_id );
// ... and add surogate handler. // ... and add surogate handler.
combo->entry_change_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "changed", 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 // make it more useable
gtk_combo_set_use_arrows_always( GTK_COMBO(m_widget), TRUE ); gtk_combo_set_use_arrows_always( GTK_COMBO(m_widget), TRUE );
@@ -223,7 +223,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
if (style & wxNO_BORDER) if (style & wxNO_BORDER)
g_object_set( GTK_ENTRY( combo->entry ), "has-frame", FALSE, NULL ); g_object_set( GTK_ENTRY( combo->entry ), "has-frame", FALSE, NULL );
#endif #endif
GtkWidget *list = GTK_COMBO(m_widget)->list; GtkWidget *list = GTK_COMBO(m_widget)->list;
#ifndef __WXGTK20__ #ifndef __WXGTK20__
@@ -260,9 +260,9 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
// "show" and "hide" events are generated when user click on the combobox button which popups a list // "show" and "hide" events are generated when user click on the combobox button which popups a list
// this list is the "popwin" gtk widget // this list is the "popwin" gtk widget
gtk_signal_connect( GTK_OBJECT(GTK_COMBO(combo)->popwin), "hide", 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_connect( GTK_OBJECT(combo->entry), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this );
@@ -276,7 +276,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
wxSize setsize = GetSize(); wxSize setsize = GetSize();
gtk_widget_set_usize( m_widget, setsize.x, setsize.y ); gtk_widget_set_usize( m_widget, setsize.x, setsize.y );
return TRUE; return true;
} }
wxComboBox::~wxComboBox() wxComboBox::~wxComboBox()
@@ -780,7 +780,7 @@ long wxComboBox::GetInsertionPoint() const
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; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length; int pos = GTK_ENTRY(entry)->text_length;

View File

@@ -292,13 +292,13 @@ END_EVENT_TABLE()
void wxTextCtrl::Init() void wxTextCtrl::Init()
{ {
m_ignoreNextUpdate = m_ignoreNextUpdate =
m_modified = FALSE; m_modified = false;
SetUpdateFont(FALSE); SetUpdateFont(false);
m_text = m_text =
m_vScrollbar = (GtkWidget *)NULL; m_vScrollbar = (GtkWidget *)NULL;
#ifdef __WXGTK20__ #ifdef __WXGTK20__
m_frozenness = 0; m_frozenness = 0;
#endif #endif
} }
wxTextCtrl::wxTextCtrl( wxWindow *parent, wxTextCtrl::wxTextCtrl( wxWindow *parent,
@@ -324,18 +324,18 @@ bool wxTextCtrl::Create( wxWindow *parent,
const wxValidator& validator, const wxValidator& validator,
const wxString &name ) const wxString &name )
{ {
m_needParent = TRUE; m_needParent = true;
m_acceptsFocus = TRUE; m_acceptsFocus = true;
if (!PreCreation( parent, pos, size ) || if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name )) !CreateBase( parent, id, pos, size, style, validator, name ))
{ {
wxFAIL_MSG( wxT("wxTextCtrl creation failed") ); wxFAIL_MSG( wxT("wxTextCtrl creation failed") );
return FALSE; return false;
} }
m_vScrollbarVisible = FALSE; m_vScrollbarVisible = false;
bool multi_line = (style & wxTE_MULTILINE) != 0; bool multi_line = (style & wxTE_MULTILINE) != 0;
@@ -363,14 +363,14 @@ bool wxTextCtrl::Create( wxWindow *parent,
if (!HasFlag(wxNO_BORDER)) if (!HasFlag(wxNO_BORDER))
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
#else #else
// create our control ... // create our control ...
m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL ); m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
// ... and put into the upper left hand corner of the table // ... 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); m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1, gtk_table_attach( GTK_TABLE(m_widget), m_text, 0, 1, 0, 1,
@@ -396,7 +396,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
m_widget = m_widget =
m_text = gtk_entry_new(); m_text = gtk_entry_new();
#ifdef __WXGTK20__ #ifdef __WXGTK20__
if (style & wxNO_BORDER) if (style & wxNO_BORDER)
g_object_set( GTK_ENTRY(m_text), "has-frame", FALSE, NULL ); g_object_set( GTK_ENTRY(m_text), "has-frame", FALSE, NULL );
#endif #endif
@@ -431,7 +431,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
} }
#endif // GTK+ 1.x #endif // GTK+ 1.x
if (!value.IsEmpty()) if (!value.empty())
{ {
#ifdef __WXGTK20__ #ifdef __WXGTK20__
SetValue( value ); SetValue( value );
@@ -505,7 +505,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
#endif #endif
} }
#endif // __WXGTK20__ #endif // __WXGTK20__
// We want to be notified about text changes. // We want to be notified about text changes.
#ifdef __WXGTK20__ #ifdef __WXGTK20__
if (multi_line) if (multi_line)
@@ -515,7 +515,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
} }
else else
#endif #endif
{ {
gtk_signal_connect( GTK_OBJECT(m_text), "changed", gtk_signal_connect( GTK_OBJECT(m_text), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
@@ -526,7 +526,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
wxTextAttr attrDef(GetForegroundColour(), GetBackgroundColour(), GetFont()); wxTextAttr attrDef(GetForegroundColour(), GetBackgroundColour(), GetFont());
SetDefaultStyle( attrDef ); SetDefaultStyle( attrDef );
return TRUE; return true;
} }
@@ -542,7 +542,7 @@ void wxTextCtrl::CalculateScrollbar()
if (m_vScrollbarVisible) if (m_vScrollbarVisible)
{ {
gtk_widget_hide( m_vScrollbar ); gtk_widget_hide( m_vScrollbar );
m_vScrollbarVisible = FALSE; m_vScrollbarVisible = false;
} }
} }
else else
@@ -550,7 +550,7 @@ void wxTextCtrl::CalculateScrollbar()
if (!m_vScrollbarVisible) if (!m_vScrollbarVisible)
{ {
gtk_widget_show( m_vScrollbar ); gtk_widget_show( m_vScrollbar );
m_vScrollbarVisible = TRUE; m_vScrollbarVisible = true;
} }
} }
#endif #endif
@@ -629,7 +629,7 @@ void wxTextCtrl::SetValue( const wxString &value )
// customize this behaviour. // customize this behaviour.
SetInsertionPoint(0); SetInsertionPoint(0);
m_modified = FALSE; m_modified = false;
} }
void wxTextCtrl::WriteText( const wxString &text ) void wxTextCtrl::WriteText( const wxString &text )
@@ -683,7 +683,7 @@ void wxTextCtrl::WriteText( const wxString &text )
// in UpdateFontIfNeeded() any longer // in UpdateFontIfNeeded() any longer
if ( !text.empty() ) if ( !text.empty() )
{ {
SetUpdateFont(FALSE); SetUpdateFont(false);
} }
// Bring editable's cursor back uptodate. // Bring editable's cursor back uptodate.
@@ -785,7 +785,7 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
// cast to prevent warning. But pos really should've been unsigned. // cast to prevent warning. But pos really should've been unsigned.
if( (unsigned long)pos > text.Len() ) if( (unsigned long)pos > text.Len() )
return FALSE; return false;
*x=0; // First Col *x=0; // First Col
*y=0; // First Line *y=0; // First Line
@@ -812,11 +812,11 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
else else
{ {
// index out of bounds // index out of bounds
return FALSE; return false;
} }
} }
return TRUE; return true;
} }
long wxTextCtrl::XYToPosition(long x, long y ) const long wxTextCtrl::XYToPosition(long x, long y ) const
@@ -957,7 +957,7 @@ bool wxTextCtrl::Enable( bool enable )
if (!wxWindowBase::Enable(enable)) if (!wxWindowBase::Enable(enable))
{ {
// nothing to do // nothing to do
return FALSE; return false;
} }
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -974,7 +974,7 @@ bool wxTextCtrl::Enable( bool enable )
gtk_widget_set_sensitive( m_text, enable ); gtk_widget_set_sensitive( m_text, enable );
} }
return TRUE; return true;
} }
// wxGTK-specific: called recursively by Enable, // wxGTK-specific: called recursively by Enable,
@@ -999,12 +999,12 @@ void wxTextCtrl::OnParentEnable( bool enable )
void wxTextCtrl::MarkDirty() void wxTextCtrl::MarkDirty()
{ {
m_modified = TRUE; m_modified = true;
} }
void wxTextCtrl::DiscardEdits() void wxTextCtrl::DiscardEdits()
{ {
m_modified = FALSE; m_modified = false;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1013,19 +1013,19 @@ void wxTextCtrl::DiscardEdits()
void wxTextCtrl::IgnoreNextTextUpdate() void wxTextCtrl::IgnoreNextTextUpdate()
{ {
m_ignoreNextUpdate = TRUE; m_ignoreNextUpdate = true;
} }
bool wxTextCtrl::IgnoreTextUpdate() bool wxTextCtrl::IgnoreTextUpdate()
{ {
if ( m_ignoreNextUpdate ) if ( m_ignoreNextUpdate )
{ {
m_ignoreNextUpdate = FALSE; m_ignoreNextUpdate = false;
return TRUE; return true;
} }
return FALSE; return false;
} }
void wxTextCtrl::SetMaxLength(unsigned long len) void wxTextCtrl::SetMaxLength(unsigned long len)
@@ -1178,7 +1178,7 @@ long wxTextCtrl::GetInsertionPoint() const
} }
} }
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") );
@@ -1227,7 +1227,7 @@ void wxTextCtrl::Replace( long from, long to, const wxString &value )
Remove( from, to ); Remove( from, to );
if (!value.IsEmpty()) if (!value.empty())
{ {
#ifdef __WXGTK20__ #ifdef __WXGTK20__
SetInsertionPoint( from ); SetInsertionPoint( from );
@@ -1297,14 +1297,14 @@ bool wxTextCtrl::CanUndo() const
{ {
// TODO // TODO
//wxFAIL_MSG( wxT("wxTextCtrl::CanUndo not implemented") ); //wxFAIL_MSG( wxT("wxTextCtrl::CanUndo not implemented") );
return FALSE; return false;
} }
bool wxTextCtrl::CanRedo() const bool wxTextCtrl::CanRedo() const
{ {
// TODO // TODO
//wxFAIL_MSG( wxT("wxTextCtrl::CanRedo not implemented") ); //wxFAIL_MSG( wxT("wxTextCtrl::CanRedo not implemented") );
return FALSE; return false;
} }
// 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
@@ -1315,7 +1315,7 @@ void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const
gint from = -1; gint from = -1;
gint to = -1; gint to = -1;
bool haveSelection = FALSE; bool haveSelection = false;
#ifdef __WXGTK20__ #ifdef __WXGTK20__
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -1323,7 +1323,7 @@ void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const
GtkTextIter ifrom, ito; GtkTextIter ifrom, ito;
if ( gtk_text_buffer_get_selection_bounds(m_buffer, &ifrom, &ito) ) if ( gtk_text_buffer_get_selection_bounds(m_buffer, &ifrom, &ito) )
{ {
haveSelection = TRUE; haveSelection = true;
from = gtk_text_iter_get_offset(&ifrom); from = gtk_text_iter_get_offset(&ifrom);
to = gtk_text_iter_get_offset(&ito); to = gtk_text_iter_get_offset(&ito);
} }
@@ -1333,13 +1333,13 @@ void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const
if ( gtk_editable_get_selection_bounds( GTK_EDITABLE(m_text), if ( gtk_editable_get_selection_bounds( GTK_EDITABLE(m_text),
&from, &to) ) &from, &to) )
{ {
haveSelection = TRUE; haveSelection = true;
} }
} }
#else // not GTK2 #else // not GTK2
if ( (GTK_EDITABLE(m_text)->has_selection) ) if ( (GTK_EDITABLE(m_text)->has_selection) )
{ {
haveSelection = TRUE; haveSelection = true;
from = (long) GTK_EDITABLE(m_text)->selection_start_pos; from = (long) GTK_EDITABLE(m_text)->selection_start_pos;
to = (long) GTK_EDITABLE(m_text)->selection_end_pos; to = (long) GTK_EDITABLE(m_text)->selection_end_pos;
} }
@@ -1365,7 +1365,7 @@ void wxTextCtrl::GetSelection(long* fromOut, long* toOut) const
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__ #ifdef __WXGTK20__
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -1451,24 +1451,24 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
// the font will change for subsequent text insertiongs // the font will change for subsequent text insertiongs
bool wxTextCtrl::SetFont( const wxFont &font ) 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) ) if ( !wxTextCtrlBase::SetFont(font) )
{ {
// font didn't change, nothing to do // font didn't change, nothing to do
return FALSE; return false;
} }
if ( m_windowStyle & wxTE_MULTILINE ) if ( m_windowStyle & wxTE_MULTILINE )
{ {
SetUpdateFont(TRUE); SetUpdateFont(true);
m_defaultStyle.SetFont(font); m_defaultStyle.SetFont(font);
ChangeFontGlobally(); ChangeFontGlobally();
} }
return TRUE; return true;
} }
void wxTextCtrl::ChangeFontGlobally() void wxTextCtrl::ChangeFontGlobally()
@@ -1487,9 +1487,9 @@ void wxTextCtrl::ChangeFontGlobally()
#endif #endif
wxString value = GetValue(); wxString value = GetValue();
if ( !value.IsEmpty() ) if ( !value.empty() )
{ {
SetUpdateFont(FALSE); SetUpdateFont(false);
Clear(); Clear();
AppendText(value); AppendText(value);
@@ -1509,35 +1509,35 @@ void wxTextCtrl::UpdateFontIfNeeded()
bool wxTextCtrl::SetForegroundColour(const wxColour& colour) bool wxTextCtrl::SetForegroundColour(const wxColour& colour)
{ {
if ( !wxControl::SetForegroundColour(colour) ) if ( !wxControl::SetForegroundColour(colour) )
return FALSE; return false;
// update default fg colour too // update default fg colour too
m_defaultStyle.SetTextColour(colour); m_defaultStyle.SetTextColour(colour);
return TRUE; return true;
} }
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 ) )
return FALSE; return false;
#ifndef __WXGTK20__ #ifndef __WXGTK20__
if (!m_widget->window) if (!m_widget->window)
return FALSE; return false;
#endif #endif
if (!m_backgroundColour.Ok()) if (!m_backgroundColour.Ok())
return FALSE; return false;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
#ifndef __WXGTK20__ #ifndef __WXGTK20__
GdkWindow *window = GTK_TEXT(m_text)->text_area; GdkWindow *window = GTK_TEXT(m_text)->text_area;
if (!window) if (!window)
return FALSE; return false;
m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) ); m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
gdk_window_set_background( window, m_backgroundColour.GetColor() ); gdk_window_set_background( window, m_backgroundColour.GetColor() );
gdk_window_clear( window ); gdk_window_clear( window );
@@ -1547,7 +1547,7 @@ bool wxTextCtrl::SetBackgroundColour( const wxColour &colour )
// change active background color too // change active background color too
m_defaultStyle.SetBackgroundColour( colour ); m_defaultStyle.SetBackgroundColour( colour );
return TRUE; return true;
} }
bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style ) bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
@@ -1557,12 +1557,12 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
if ( style.IsDefault() ) if ( style.IsDefault() )
{ {
// nothing to do // nothing to do
return TRUE; return true;
} }
#ifdef __WXGTK20__ #ifdef __WXGTK20__
gint l = gtk_text_buffer_get_char_count( m_buffer ); 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") ); _T("invalid range in wxTextCtrl::SetStyle") );
GtkTextIter starti, endi; GtkTextIter starti, endi;
@@ -1576,14 +1576,14 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi ); wxGtkTextApplyTagsFromAttr( m_buffer, attr, &starti, &endi );
return TRUE; return true;
#else #else
// VERY dirty way to do that - removes the required text and re-adds it // VERY dirty way to do that - removes the required text and re-adds it
// with styling (FIXME) // with styling (FIXME)
gint l = gtk_text_get_length( GTK_TEXT(m_text) ); 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") ); _T("invalid range in wxTextCtrl::SetStyle") );
gint old_pos = gtk_editable_get_position( GTK_EDITABLE(m_text) ); gint old_pos = gtk_editable_get_position( GTK_EDITABLE(m_text) );
@@ -1615,12 +1615,12 @@ bool wxTextCtrl::SetStyle( long start, long end, const wxTextAttr& style )
gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */ gtk_editable_set_position( GTK_EDITABLE(m_text), old_pos ); */
SetInsertionPoint( old_pos ); SetInsertionPoint( old_pos );
#endif #endif
return TRUE; return true;
} }
else // singe line else // singe line
{ {
// cannot do this for GTK+'s Entry widget // cannot do this for GTK+'s Entry widget
return FALSE; return false;
} }
} }
@@ -1808,7 +1808,7 @@ bool wxTextCtrl::DoScroll(GtkAdjustment *adj, int diff)
if ( fabs(adj->value - value) < 0.2 ) if ( fabs(adj->value - value) < 0.2 )
{ {
// well, this is what Robert does in wxScrollBar, so it must be good... // well, this is what Robert does in wxScrollBar, so it must be good...
return FALSE; return false;
} }
adj->value = value; adj->value = value;
@@ -1819,14 +1819,14 @@ bool wxTextCtrl::DoScroll(GtkAdjustment *adj, int diff)
gtk_signal_emit_by_name(GTK_OBJECT(adj), "value_changed"); gtk_signal_emit_by_name(GTK_OBJECT(adj), "value_changed");
#endif #endif
return TRUE; return true;
} }
bool wxTextCtrl::ScrollLines(int lines) bool wxTextCtrl::ScrollLines(int lines)
{ {
GtkAdjustment *adj = GetVAdj(); GtkAdjustment *adj = GetVAdj();
if ( !adj ) if ( !adj )
return FALSE; return false;
#ifdef __WXGTK20__ #ifdef __WXGTK20__
int diff = (int)ceil(lines*adj->step_increment); int diff = (int)ceil(lines*adj->step_increment);
@@ -1842,7 +1842,7 @@ bool wxTextCtrl::ScrollPages(int pages)
{ {
GtkAdjustment *adj = GetVAdj(); GtkAdjustment *adj = GetVAdj();
if ( !adj ) if ( !adj )
return FALSE; return false;
return DoScroll(adj, (int)ceil(pages*adj->page_increment)); return DoScroll(adj, (int)ceil(pages*adj->page_increment));
} }

View File

@@ -68,18 +68,18 @@ public:
protected: protected:
void OnChar( wxKeyEvent& event ) void OnChar( wxKeyEvent& event )
{ {
// Allows processing the tab key to go to the next control // Allows processing the tab key to go to the next control
if (event.GetKeyCode() == WXK_TAB) if (event.GetKeyCode() == WXK_TAB)
{ {
wxNavigationKeyEvent NavEvent; wxNavigationKeyEvent NavEvent;
NavEvent.SetEventObject(this); NavEvent.SetEventObject(this);
NavEvent.SetDirection(true); NavEvent.SetDirection(true);
NavEvent.SetWindowChange(false); NavEvent.SetWindowChange(false);
// Get the parent of the combo and have it process the navigation? // Get the parent of the combo and have it process the navigation?
if (m_cb->GetParent()->GetEventHandler()->ProcessEvent(NavEvent)) if (m_cb->GetParent()->GetEventHandler()->ProcessEvent(NavEvent))
return; return;
} }
if ( event.GetKeyCode() == WXK_RETURN ) if ( event.GetKeyCode() == WXK_RETURN )
{ {
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_cb->GetId()); wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_cb->GetId());
@@ -269,17 +269,17 @@ void wxComboBox::DoMoveWindow(int x, int y, int width, int height)
bool wxComboBox::Enable(bool enable) bool wxComboBox::Enable(bool enable)
{ {
if ( !wxControl::Enable(enable) ) if ( !wxControl::Enable(enable) )
return FALSE; return false;
return TRUE; return true;
} }
bool wxComboBox::Show(bool show) bool wxComboBox::Show(bool show)
{ {
if ( !wxControl::Show(show) ) if ( !wxControl::Show(show) )
return FALSE; return false;
return TRUE; return true;
} }
void wxComboBox::SetFocus() void wxComboBox::SetFocus()
@@ -330,7 +330,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style , if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
wxDefaultValidator, name) ) wxDefaultValidator, name) )
{ {
return FALSE; return false;
} }
m_choice = new wxComboBoxChoice(this, style ); m_choice = new wxComboBoxChoice(this, style );
@@ -358,7 +358,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
SetBestSize(size); // Needed because it is a wxControlWithItems SetBestSize(size); // Needed because it is a wxControlWithItems
return TRUE; return true;
} }
wxString wxComboBox::GetValue() const wxString wxComboBox::GetValue() const
@@ -452,7 +452,7 @@ long wxComboBox::GetInsertionPoint() const
return 0; return 0;
} }
long wxComboBox::GetLastPosition() const wxTextPos wxComboBox::GetLastPosition() const
{ {
// TODO // TODO
return 0; return 0;
@@ -569,10 +569,10 @@ bool wxComboBox::SetStringSelection(const wxString& sel)
if (s > -1) if (s > -1)
{ {
SetSelection (s); SetSelection (s);
return TRUE; return true;
} }
else else
return FALSE; return false;
} }
void wxComboBox::SetString(int n, const wxString& s) void wxComboBox::SetString(int n, const wxString& s)
@@ -582,7 +582,7 @@ 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()

View File

@@ -19,7 +19,7 @@
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
#ifndef __HIVIEW__ #ifndef __HIVIEW__
#include <HIToolbox/HIView.h> #include <HIToolbox/HIView.h>
#endif #endif
#endif #endif
@@ -246,7 +246,7 @@ wxComboBox::~wxComboBox()
wxSize wxComboBox::DoGetBestSize() const wxSize wxComboBox::DoGetBestSize() const
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
return wxControl::DoGetBestSize(); return wxControl::DoGetBestSize();
#else #else
wxSize size = m_choice->GetBestSize(); wxSize size = m_choice->GetBestSize();
@@ -263,7 +263,7 @@ wxSize wxComboBox::DoGetBestSize() const
void wxComboBox::DoMoveWindow(int x, int y, int width, int height) { void wxComboBox::DoMoveWindow(int x, int y, int width, int height) {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
wxControl::DoMoveWindow(x, y, width, height); wxControl::DoMoveWindow(x, y, width, height);
#else #else
height = POPUPHEIGHT; height = POPUPHEIGHT;
@@ -293,23 +293,23 @@ void wxComboBox::DoMoveWindow(int x, int y, int width, int height) {
bool wxComboBox::Enable(bool enable) bool wxComboBox::Enable(bool enable)
{ {
if ( !wxControl::Enable(enable) ) if ( !wxControl::Enable(enable) )
return FALSE; return false;
return TRUE; return true;
} }
bool wxComboBox::Show(bool show) bool wxComboBox::Show(bool show)
{ {
if ( !wxControl::Show(show) ) if ( !wxControl::Show(show) )
return FALSE; return false;
return TRUE; return true;
} }
void wxComboBox::SetFocus() void wxComboBox::SetFocus()
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
wxControl::SetFocus(); wxControl::SetFocus();
#else #else
if ( m_text != NULL) { if ( m_text != NULL) {
m_text->SetFocus(); m_text->SetFocus();
@@ -358,12 +358,12 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
m_text = NULL; m_text = NULL;
m_choice = NULL; m_choice = NULL;
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
m_macIsUserPane = FALSE ; m_macIsUserPane = false ;
#endif #endif
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style , if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
wxDefaultValidator, name) ) wxDefaultValidator, name) )
{ {
return FALSE; return false;
} }
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
@@ -380,8 +380,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
//hiRect.size.width = bounds.right - bounds.left; //hiRect.size.width = bounds.right - bounds.left;
//hiRect.size.height = bounds.bottom - bounds.top; //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("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); //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() ; m_peer = new wxMacControl() ;
verify_noerr( HIComboBoxCreate( &hiRect, CFSTR(""), NULL, NULL, kHIComboBoxStandardAttributes, *m_peer ) ); verify_noerr( HIComboBoxCreate( &hiRect, CFSTR(""), NULL, NULL, kHIComboBoxStandardAttributes, *m_peer ) );
@@ -431,7 +431,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
SetBestSize(csize); // Needed because it is a wxControlWithItems SetBestSize(csize); // Needed because it is a wxControlWithItems
#endif #endif
return TRUE; return true;
} }
wxString wxComboBox::GetValue() const wxString wxComboBox::GetValue() const
@@ -532,7 +532,7 @@ long wxComboBox::GetInsertionPoint() const
return 0; return 0;
} }
long wxComboBox::GetLastPosition() const wxTextPos wxComboBox::GetLastPosition() const
{ {
// TODO // TODO
return 0; return 0;
@@ -628,9 +628,9 @@ void wxComboBox::FreeData()
int wxComboBox::GetCount() const { int wxComboBox::GetCount() const {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
return (int) HIComboBoxGetItemCount( *m_peer ); return (int) HIComboBoxGetItemCount( *m_peer );
#else #else
return m_choice->GetCount() ; return m_choice->GetCount() ;
#endif #endif
} }
@@ -686,7 +686,7 @@ int wxComboBox::FindString(const wxString& s) const
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
for( int i = 0 ; i < GetCount() ; i++ ) for( int i = 0 ; i < GetCount() ; i++ )
{ {
if ( GetString( i ).IsSameAs(s, FALSE) ) if ( GetString( i ).IsSameAs(s, false) )
return i ; return i ;
} }
return wxNOT_FOUND ; return wxNOT_FOUND ;
@@ -725,10 +725,10 @@ bool wxComboBox::SetStringSelection(const wxString& sel)
if (s > -1) if (s > -1)
{ {
SetSelection (s); SetSelection (s);
return TRUE; return true;
} }
else else
return FALSE; return false;
} }
void wxComboBox::SetString(int n, const wxString& s) void wxComboBox::SetString(int n, const wxString& s)
@@ -745,17 +745,17 @@ void wxComboBox::SetString(int n, const wxString& s)
bool wxComboBox::IsEditable() const bool wxComboBox::IsEditable() const
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
// TODO // TODO
return !HasFlag(wxCB_READONLY); return !HasFlag(wxCB_READONLY);
#else #else
return m_text != NULL && !HasFlag(wxCB_READONLY); return m_text != NULL && !HasFlag(wxCB_READONLY);
#endif #endif
} }
void wxComboBox::Undo() void wxComboBox::Undo()
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
// TODO // TODO
#else #else
if (m_text != NULL) if (m_text != NULL)
m_text->Undo(); m_text->Undo();
@@ -765,7 +765,7 @@ void wxComboBox::Undo()
void wxComboBox::Redo() void wxComboBox::Redo()
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
// TODO // TODO
#else #else
if (m_text != NULL) if (m_text != NULL)
m_text->Redo(); m_text->Redo();
@@ -775,7 +775,7 @@ void wxComboBox::Redo()
void wxComboBox::SelectAll() void wxComboBox::SelectAll()
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
// TODO // TODO
#else #else
if (m_text != NULL) if (m_text != NULL)
m_text->SelectAll(); m_text->SelectAll();
@@ -785,8 +785,8 @@ void wxComboBox::SelectAll()
bool wxComboBox::CanCopy() const bool wxComboBox::CanCopy() const
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
// TODO // TODO
return false; return false;
#else #else
if (m_text != NULL) if (m_text != NULL)
return m_text->CanCopy(); return m_text->CanCopy();
@@ -798,8 +798,8 @@ bool wxComboBox::CanCopy() const
bool wxComboBox::CanCut() const bool wxComboBox::CanCut() const
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
// TODO // TODO
return false; return false;
#else #else
if (m_text != NULL) if (m_text != NULL)
return m_text->CanCut(); return m_text->CanCut();
@@ -811,8 +811,8 @@ bool wxComboBox::CanCut() const
bool wxComboBox::CanPaste() const bool wxComboBox::CanPaste() const
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
// TODO // TODO
return false; return false;
#else #else
if (m_text != NULL) if (m_text != NULL)
return m_text->CanPaste(); return m_text->CanPaste();
@@ -824,8 +824,8 @@ bool wxComboBox::CanPaste() const
bool wxComboBox::CanUndo() const bool wxComboBox::CanUndo() const
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
// TODO // TODO
return false; return false;
#else #else
if (m_text != NULL) if (m_text != NULL)
return m_text->CanUndo(); return m_text->CanUndo();
@@ -837,8 +837,8 @@ bool wxComboBox::CanUndo() const
bool wxComboBox::CanRedo() const bool wxComboBox::CanRedo() const
{ {
#if USE_HICOMBOBOX #if USE_HICOMBOBOX
// TODO // TODO
return false; return false;
#else #else
if (m_text != NULL) if (m_text != NULL)
return m_text->CanRedo(); return m_text->CanRedo();

File diff suppressed because it is too large Load Diff

View File

@@ -223,17 +223,17 @@ void wxComboBox::DoMoveWindow(int x, int y, int width, int height) {
bool wxComboBox::Enable(bool enable) bool wxComboBox::Enable(bool enable)
{ {
if ( !wxControl::Enable(enable) ) if ( !wxControl::Enable(enable) )
return FALSE; return false;
return TRUE; return true;
} }
bool wxComboBox::Show(bool show) bool wxComboBox::Show(bool show)
{ {
if ( !wxControl::Show(show) ) if ( !wxControl::Show(show) )
return FALSE; return false;
return TRUE; return true;
} }
void wxComboBox::SetFocus() void wxComboBox::SetFocus()
@@ -284,7 +284,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style , if ( !wxControl::Create(parent, id, wxDefaultPosition, wxDefaultSize, style ,
wxDefaultValidator, name) ) wxDefaultValidator, name) )
{ {
return FALSE; return false;
} }
m_choice = new wxComboBoxChoice(this, style ); m_choice = new wxComboBoxChoice(this, style );
@@ -309,7 +309,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
m_choice->DoAppend( choices[ i ] ); m_choice->DoAppend( choices[ i ] );
} }
return TRUE; return true;
} }
wxString wxComboBox::GetValue() const wxString wxComboBox::GetValue() const
@@ -400,7 +400,7 @@ long wxComboBox::GetInsertionPoint() const
return 0; return 0;
} }
long wxComboBox::GetLastPosition() const wxTextPos wxComboBox::GetLastPosition() const
{ {
// TODO // TODO
return 0; return 0;
@@ -517,10 +517,10 @@ bool wxComboBox::SetStringSelection(const wxString& sel)
if (s > -1) if (s > -1)
{ {
SetSelection (s); SetSelection (s);
return TRUE; return true;
} }
else else
return FALSE; return false;
} }
void wxComboBox::SetString(int n, const wxString& s) void wxComboBox::SetString(int n, const wxString& s)
@@ -530,8 +530,7 @@ 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()

View File

@@ -225,7 +225,7 @@ static pascal void TPPaneDrawProc(ControlRef theControl, ControlPartCode thePart
else else
TXNSetFrameBounds( varsp->fTXNRec, varsp->fRTextArea.top + 30000 , varsp->fRTextArea.left + 30000 , TXNSetFrameBounds( varsp->fTXNRec, varsp->fRTextArea.top + 30000 , varsp->fRTextArea.left + 30000 ,
varsp->fRTextArea.bottom + 30000 , varsp->fRTextArea.right + 30000 , varsp->fTXNFrame); varsp->fRTextArea.bottom + 30000 , varsp->fRTextArea.right + 30000 , varsp->fTXNFrame);
} }
if ( IsControlVisible( theControl ) ) if ( IsControlVisible( theControl ) )
@@ -238,7 +238,7 @@ static pascal void TPPaneDrawProc(ControlRef theControl, ControlPartCode thePart
/* restore the drawing environment */ /* restore the drawing environment */
/* draw the text frame and focus frame (if necessary) */ /* draw the text frame and focus frame (if necessary) */
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive); DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
if ((**tpvars).fIsActive && varsp->fInFocus) if ((**tpvars).fIsActive && varsp->fInFocus)
DrawThemeFocusRect(&varsp->fRFocusOutline, true); DrawThemeFocusRect(&varsp->fRFocusOutline, true);
/* release our globals */ /* release our globals */
HSetState((Handle) tpvars, state); HSetState((Handle) tpvars, state);
@@ -420,7 +420,7 @@ static pascal void TPPaneActivateProc(ControlHandle theControl, Boolean activati
if ( IsControlVisible( theControl ) ) if ( IsControlVisible( theControl ) )
{ {
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive); DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
if (varsp->fInFocus) if (varsp->fInFocus)
DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive); DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive);
} }
HSetState((Handle) tpvars, state); HSetState((Handle) tpvars, state);
@@ -483,8 +483,8 @@ static pascal ControlPartCode TPPaneFocusProc(ControlHandle theControl, ControlF
if ( IsControlVisible( theControl ) ) if ( IsControlVisible( theControl ) )
{ {
/* save the drawing state */ /* save the drawing state */
SetPort((**tpvars).fDrawingEnvironment); SetPort((**tpvars).fDrawingEnvironment);
wxMacWindowClipper clipper( wxFindControlFromMacControl(theControl ) ) ; wxMacWindowClipper clipper( wxFindControlFromMacControl(theControl ) ) ;
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive); DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive && varsp->fInFocus); DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive && varsp->fInFocus);
} }
@@ -661,23 +661,23 @@ static void SetTXNData( TXNObject txn , const wxString& st , TXNOffset start , T
{ {
#if wxUSE_UNICODE #if wxUSE_UNICODE
#if SIZEOF_WCHAR_T == 2 #if SIZEOF_WCHAR_T == 2
size_t len = st.Len() ; size_t len = st.Len() ;
TXNSetData( txn , kTXNUnicodeTextData, (void*)st.wc_str(), len * 2, TXNSetData( txn , kTXNUnicodeTextData, (void*)st.wc_str(), len * 2,
start, end); start, end);
#else #else
wxMBConvUTF16BE converter ; wxMBConvUTF16BE converter ;
ByteCount byteBufferLen = converter.WC2MB( NULL , st.wc_str() , 0 ) ; ByteCount byteBufferLen = converter.WC2MB( NULL , st.wc_str() , 0 ) ;
UniChar *unibuf = (UniChar*) malloc(byteBufferLen) ; UniChar *unibuf = (UniChar*) malloc(byteBufferLen) ;
converter.WC2MB( (char*) unibuf , st.wc_str() , byteBufferLen ) ; converter.WC2MB( (char*) unibuf , st.wc_str() , byteBufferLen ) ;
TXNSetData( txn , kTXNUnicodeTextData, (void*)unibuf, byteBufferLen , TXNSetData( txn , kTXNUnicodeTextData, (void*)unibuf, byteBufferLen ,
start, end); start, end);
free( unibuf ) ; free( unibuf ) ;
#endif #endif
#else #else
wxCharBuffer text = st.mb_str(wxConvLocal) ; wxCharBuffer text = st.mb_str(wxConvLocal) ;
TXNSetData( txn , kTXNTextData, (void*)text.data(), strlen( text ) , TXNSetData( txn , kTXNTextData, (void*)text.data(), strlen( text ) ,
start, end); start, end);
#endif #endif
} }
// Text item // Text item
@@ -728,7 +728,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
// base initialization // base initialization
if ( !wxTextCtrlBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) ) if ( !wxTextCtrlBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) )
return FALSE; return false;
wxSize mySize = size ; wxSize mySize = size ;
if ( m_macUsesTXN ) if ( m_macUsesTXN )
@@ -767,7 +767,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
if ( m_windowStyle & wxTE_READONLY) if ( m_windowStyle & wxTE_READONLY)
{ {
m_editable = FALSE ; m_editable = false ;
} }
wxString st = str ; wxString st = str ;
@@ -796,7 +796,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
if ( !m_macUsesTXN ) 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 ) ; ::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , strlen(text) , text ) ;
} }
else else
@@ -813,7 +813,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart); TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
} }
return TRUE; return true;
} }
wxString wxTextCtrl::GetValue() const wxString wxTextCtrl::GetValue() const
@@ -826,12 +826,12 @@ wxString wxTextCtrl::GetValue() const
err = ::GetControlDataSize((ControlHandle) m_macControl, 0, err = ::GetControlDataSize((ControlHandle) m_macControl, 0,
( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, &actualSize ) ; ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, &actualSize ) ;
if ( err ) if ( err )
return wxEmptyString ; return wxEmptyString ;
if ( actualSize > 0 ) if ( actualSize > 0 )
{ {
wxCharBuffer buf(actualSize) ; wxCharBuffer buf(actualSize) ;
::GetControlData( (ControlHandle) m_macControl, 0, ::GetControlData( (ControlHandle) m_macControl, 0,
( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag,
actualSize , buf.data() , &actualSize ) ; actualSize , buf.data() , &actualSize ) ;
@@ -854,13 +854,13 @@ wxString wxTextCtrl::GetValue() const
if ( actualSize > 0 ) if ( actualSize > 0 )
{ {
wxChar *ptr = result.GetWriteBuf(actualSize*sizeof(wxChar)) ; wxChar *ptr = result.GetWriteBuf(actualSize*sizeof(wxChar)) ;
#if SIZEOF_WCHAR_T == 2 #if SIZEOF_WCHAR_T == 2
wxStrncpy( ptr , (wxChar*) *theText , actualSize ) ; wxStrncpy( ptr , (wxChar*) *theText , actualSize ) ;
#else #else
wxMBConvUTF16BE converter ; wxMBConvUTF16BE converter ;
HLock( theText ) ; HLock( theText ) ;
converter.MB2WC( ptr , (const char*)*theText , actualSize ) ; converter.MB2WC( ptr , (const char*)*theText , actualSize ) ;
HUnlock( theText ) ; HUnlock( theText ) ;
#endif #endif
ptr[actualSize] = 0 ; ptr[actualSize] = 0 ;
result.UngetWriteBuf( actualSize *sizeof(wxChar) ) ; result.UngetWriteBuf( actualSize *sizeof(wxChar) ) ;
@@ -911,7 +911,7 @@ void wxTextCtrl::SetValue(const wxString& str)
wxMacConvertNewlines13To10( &st ) ; wxMacConvertNewlines13To10( &st ) ;
if ( !m_macUsesTXN ) 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 ) ; ::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , strlen(text) , text ) ;
} }
else else
@@ -990,14 +990,14 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
if ( !formerEditable ) if ( !formerEditable )
SetEditable(formerEditable) ; SetEditable(formerEditable) ;
} }
return TRUE ; return true ;
} }
bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style) bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style)
{ {
wxTextCtrlBase::SetDefaultStyle( style ) ; wxTextCtrlBase::SetDefaultStyle( style ) ;
SetStyle( kTXNUseCurrentSelection , kTXNUseCurrentSelection , GetDefaultStyle() ) ; SetStyle( kTXNUseCurrentSelection , kTXNUseCurrentSelection , GetDefaultStyle() ) ;
return TRUE ; return true ;
} }
// Clipboard operations // Clipboard operations
@@ -1089,7 +1089,7 @@ bool wxTextCtrl::CanCut() const
bool wxTextCtrl::CanPaste() const bool wxTextCtrl::CanPaste() const
{ {
if (!IsEditable()) if (!IsEditable())
return FALSE; return false;
#if TARGET_CARBON #if TARGET_CARBON
OSStatus err = noErr; OSStatus err = noErr;
@@ -1105,20 +1105,20 @@ bool wxTextCtrl::CanPaste() const
{ {
if (( err = GetScrapFlavorSize( scrapRef, 'TEXT', &byteCount )) == noErr) if (( err = GetScrapFlavorSize( scrapRef, 'TEXT', &byteCount )) == noErr)
{ {
return TRUE ; return true ;
} }
} }
} }
return FALSE; return false;
#else #else
long offset ; long offset ;
if ( GetScrap( NULL , 'TEXT' , &offset ) > 0 ) if ( GetScrap( NULL , 'TEXT' , &offset ) > 0 )
{ {
return TRUE ; return true ;
} }
#endif #endif
return FALSE ; return false ;
} }
void wxTextCtrl::SetEditable(bool editable) void wxTextCtrl::SetEditable(bool editable)
@@ -1149,7 +1149,7 @@ void wxTextCtrl::SetInsertionPoint(long pos)
void wxTextCtrl::SetInsertionPointEnd() void wxTextCtrl::SetInsertionPointEnd()
{ {
long pos = GetLastPosition(); wxTextPos pos = GetLastPosition();
SetInsertionPoint(pos); SetInsertionPoint(pos);
} }
@@ -1160,7 +1160,7 @@ long wxTextCtrl::GetInsertionPoint() const
return begin ; return begin ;
} }
long wxTextCtrl::GetLastPosition() const wxTextPos wxTextCtrl::GetLastPosition() const
{ {
if ( !m_macUsesTXN ) if ( !m_macUsesTXN )
{ {
@@ -1245,14 +1245,14 @@ void wxTextCtrl::SetSelection(long from, long to)
ControlEditTextSelectionRec selection ; ControlEditTextSelectionRec selection ;
if ((from == -1) && (to == -1)) if ((from == -1) && (to == -1))
{ {
selection.selStart = 0 ; selection.selStart = 0 ;
selection.selEnd = 32767 ; selection.selEnd = 32767 ;
} }
else else
{ {
selection.selStart = from ; selection.selStart = from ;
selection.selEnd = to ; selection.selEnd = to ;
} }
TESetSelect( selection.selStart , selection.selEnd , ((TEHandle) m_macTE) ) ; TESetSelect( selection.selStart , selection.selEnd , ((TEHandle) m_macTE) ) ;
::SetControlData((ControlHandle) m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ; ::SetControlData((ControlHandle) m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
@@ -1267,9 +1267,9 @@ void wxTextCtrl::SetSelection(long from, long to)
SetPort((**tpvars).fDrawingEnvironment); SetPort((**tpvars).fDrawingEnvironment);
/* change the selection */ /* change the selection */
if ((from == -1) && (to == -1)) if ((from == -1) && (to == -1))
TXNSelectAll((TXNObject) m_macTXN); TXNSelectAll((TXNObject) m_macTXN);
else else
TXNSetSelection( (**tpvars).fTXNRec, from, to); TXNSetSelection( (**tpvars).fTXNRec, from, to);
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart); TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
} }
} }
@@ -1278,10 +1278,10 @@ bool wxTextCtrl::LoadFile(const wxString& file)
{ {
if ( wxTextCtrlBase::LoadFile(file) ) if ( wxTextCtrlBase::LoadFile(file) )
{ {
return TRUE; return true;
} }
return FALSE; return false;
} }
void wxTextCtrl::WriteText(const wxString& str) void wxTextCtrl::WriteText(const wxString& str)
@@ -1290,7 +1290,7 @@ void wxTextCtrl::WriteText(const wxString& str)
wxMacConvertNewlines13To10( &st ) ; wxMacConvertNewlines13To10( &st ) ;
if ( !m_macUsesTXN ) if ( !m_macUsesTXN )
{ {
wxCharBuffer text = st.mb_str(wxConvLocal) ; wxCharBuffer text = st.mb_str(wxConvLocal) ;
TEInsert( text , strlen(text) , ((TEHandle) m_macTE) ) ; TEInsert( text , strlen(text) , ((TEHandle) m_macTE) ) ;
} }
else else
@@ -1386,9 +1386,9 @@ void wxTextCtrl::Undo()
{ {
if (CanUndo()) if (CanUndo())
{ {
if ( m_macUsesTXN ) if ( m_macUsesTXN )
{ {
TXNUndo((TXNObject)m_macTXN); TXNUndo((TXNObject)m_macTXN);
} }
} }
} }
@@ -1397,37 +1397,37 @@ void wxTextCtrl::Redo()
{ {
if (CanRedo()) if (CanRedo())
{ {
if ( m_macUsesTXN ) if ( m_macUsesTXN )
{ {
TXNRedo((TXNObject)m_macTXN); TXNRedo((TXNObject)m_macTXN);
} }
} }
} }
bool wxTextCtrl::CanUndo() const bool wxTextCtrl::CanUndo() const
{ {
if ( !IsEditable() ) if ( !IsEditable() )
{ {
return false ; return false ;
} }
if ( m_macUsesTXN ) if ( m_macUsesTXN )
{ {
return TXNCanUndo((TXNObject)m_macTXN,NULL); return TXNCanUndo((TXNObject)m_macTXN,NULL);
} }
return FALSE ; return false ;
} }
bool wxTextCtrl::CanRedo() const bool wxTextCtrl::CanRedo() const
{ {
if ( !IsEditable() ) if ( !IsEditable() )
{ {
return false ; return false ;
} }
if ( m_macUsesTXN ) if ( m_macUsesTXN )
{ {
return TXNCanRedo((TXNObject)m_macTXN,NULL); return TXNCanRedo((TXNObject)m_macTXN,NULL);
} }
return FALSE ; return false ;
} }
// Makes modifie or unmodified // Makes modifie or unmodified
@@ -1443,14 +1443,14 @@ void wxTextCtrl::DiscardEdits()
int wxTextCtrl::GetNumberOfLines() const int wxTextCtrl::GetNumberOfLines() const
{ {
if ( m_macUsesTXN ) if ( m_macUsesTXN )
{ {
ItemCount lines ; ItemCount lines ;
TXNGetLineCount((TXNObject)m_macTXN, &lines ) ; TXNGetLineCount((TXNObject)m_macTXN, &lines ) ;
return lines ; return lines ;
} }
else else
{ {
wxString content = GetValue() ; wxString content = GetValue() ;
int count = 1; int count = 1;
@@ -1470,13 +1470,13 @@ long wxTextCtrl::XYToPosition(long x, long y) const
bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
{ {
return FALSE ; return false ;
} }
void wxTextCtrl::ShowPosition(long pos) void wxTextCtrl::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)
if ( m_macUsesTXN ) if ( m_macUsesTXN )
{ {
Point current ; Point current ;
Point desired ; Point desired ;
@@ -1491,7 +1491,7 @@ void wxTextCtrl::ShowPosition(long pos)
SInt32 dv = desired.v - current.v ; SInt32 dv = desired.v - current.v ;
SInt32 dh = desired.h - current.h ; SInt32 dh = desired.h - current.h ;
TXNShowSelection( (TXNObject) m_macTXN , true ) ; 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!") );
} }
} }
@@ -1641,7 +1641,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
// this will make wxWidgets eat the ENTER key so that // this will make wxWidgets eat the ENTER key so that
// we actually prevent line wrapping in a single line // we actually prevent line wrapping in a single line
// text control // text control
eat_key = TRUE; eat_key = true;
} }
break; break;
@@ -1672,7 +1672,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
#if TARGET_CARBON #if TARGET_CARBON
if ( m_macUsesTXN && wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL ) if ( m_macUsesTXN && wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL )
CallNextEventHandler((EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef() , (EventRef) wxTheApp->MacGetCurrentEvent() ) ; CallNextEventHandler((EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef() , (EventRef) wxTheApp->MacGetCurrentEvent() ) ;
else else
{ {
EventRecord rec ; EventRecord rec ;
if ( wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ) if ( wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) )

View File

@@ -53,7 +53,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
const wxString& name) const wxString& name)
{ {
if( !CreateControl( parent, id, pos, size, style, validator, name ) ) if( !CreateControl( parent, id, pos, size, style, validator, name ) )
return FALSE; return false;
m_noStrings = n; m_noStrings = n;
@@ -83,7 +83,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
SetValue(value); SetValue(value);
ChangeFont(FALSE); ChangeFont(false);
XtAddCallback (buttonWidget, XmNselectionCallback, (XtCallbackProc) wxComboBoxCallback, XtAddCallback (buttonWidget, XmNselectionCallback, (XtCallbackProc) wxComboBoxCallback,
(XtPointer) this); (XtPointer) this);
@@ -94,7 +94,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
ChangeBackgroundColour(); ChangeBackgroundColour();
return TRUE; return true;
} }
bool wxComboBox::Create(wxWindow *parent, wxWindowID id, bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
@@ -107,7 +107,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
const wxString& name) const wxString& name)
{ {
wxCArrayString chs(choices); 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);
} }
@@ -141,11 +141,11 @@ wxString wxComboBox::GetValue() const
void wxComboBox::SetValue(const wxString& value) void wxComboBox::SetValue(const wxString& value)
{ {
m_inSetValue = TRUE; m_inSetValue = true;
if( !value.empty() ) if( !value.empty() )
XmComboBoxSetString( (Widget)m_mainWidget, XmComboBoxSetString( (Widget)m_mainWidget,
wxConstCast(value.c_str(), char) ); wxConstCast(value.c_str(), char) );
m_inSetValue = FALSE; m_inSetValue = false;
} }
void wxComboBox::SetString(int n, const wxString& s) void wxComboBox::SetString(int n, const wxString& s)
@@ -281,9 +281,9 @@ long wxComboBox::GetInsertionPoint() const
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)

View File

@@ -92,7 +92,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
Widget buttonWidget= XtVaCreateManagedWidget(name.c_str(), Widget buttonWidget= XtVaCreateManagedWidget(name.c_str(),
xmComboBoxWidgetClass, parentWidget, xmComboBoxWidgetClass, parentWidget,
XmNcomboBoxType, cb_type, XmNcomboBoxType, cb_type,
NULL); NULL);
m_mainWidget = (Widget) buttonWidget; m_mainWidget = (Widget) buttonWidget;
@@ -136,7 +136,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
const wxString& name) const wxString& name)
{ {
wxCArrayString chs(choices); 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);
} }
@@ -252,7 +252,7 @@ void wxComboBox::Clear()
#else #else
while(m_noStrings > 0) while(m_noStrings > 0)
{ {
XmComboBoxDeletePos((Widget) m_mainWidget, m_noStrings--); XmComboBoxDeletePos((Widget) m_mainWidget, m_noStrings--);
} }
#endif #endif
@@ -333,7 +333,7 @@ long wxComboBox::GetInsertionPoint() const
return (long)XmTextGetInsertionPosition( GetXmText(this) ); return (long)XmTextGetInsertionPosition( GetXmText(this) );
} }
long wxComboBox::GetLastPosition() const wxTextPos wxComboBox::GetLastPosition() const
{ {
XmTextPosition pos = XmTextGetLastPosition( GetXmText(this) ); XmTextPosition pos = XmTextGetLastPosition( GetXmText(this) );
return (long)pos; return (long)pos;

View File

@@ -97,8 +97,8 @@ static void wxTextWindowActivateProc(Widget w, XtPointer clientData, XmAnyCallba
wxTextCtrl::wxTextCtrl() wxTextCtrl::wxTextCtrl()
{ {
m_tempCallbackStruct = (void*) NULL; m_tempCallbackStruct = (void*) NULL;
m_modified = FALSE; m_modified = false;
m_processedDefault = FALSE; m_processedDefault = false;
} }
bool wxTextCtrl::Create(wxWindow *parent, bool wxTextCtrl::Create(wxWindow *parent,
@@ -114,8 +114,8 @@ bool wxTextCtrl::Create(wxWindow *parent,
return false; return false;
m_tempCallbackStruct = (void*) NULL; m_tempCallbackStruct = (void*) NULL;
m_modified = FALSE; m_modified = false;
m_processedDefault = FALSE; m_processedDefault = false;
m_backgroundColour = *wxWHITE; m_backgroundColour = *wxWHITE;
@@ -181,7 +181,7 @@ bool wxTextCtrl::Create(wxWindow *parent,
XmNvalue, wxConstCast(value.c_str(), char), XmNvalue, wxConstCast(value.c_str(), char),
NULL); NULL);
} }
// install callbacks // install callbacks
XtAddCallback((Widget) m_mainWidget, XmNvalueChangedCallback, (XtCallbackProc)wxTextWindowChangedProc, (XtPointer)this); XtAddCallback((Widget) m_mainWidget, XmNvalueChangedCallback, (XtCallbackProc)wxTextWindowChangedProc, (XtPointer)this);
@@ -194,7 +194,7 @@ bool wxTextCtrl::Create(wxWindow *parent,
XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this); XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this);
// font // font
ChangeFont(FALSE); ChangeFont(false);
wxSize best = GetBestSize(); wxSize best = GetBestSize();
if( size.x != -1 ) best.x = size.x; if( size.x != -1 ) best.x = size.x;
@@ -205,7 +205,7 @@ bool wxTextCtrl::Create(wxWindow *parent,
ChangeBackgroundColour(); ChangeBackgroundColour();
return TRUE; return true;
} }
WXWidget wxTextCtrl::GetTopWidget() const WXWidget wxTextCtrl::GetTopWidget() const
@@ -248,7 +248,7 @@ wxString wxTextCtrl::GetValue() const
void wxTextCtrl::SetValue(const wxString& value) void wxTextCtrl::SetValue(const wxString& value)
{ {
m_inSetValue = TRUE; m_inSetValue = true;
// do this instead... MB // do this instead... MB
// //
@@ -262,7 +262,7 @@ void wxTextCtrl::SetValue(const wxString& value)
Clear(); Clear();
AppendText( value ); AppendText( value );
m_inSetValue = FALSE; m_inSetValue = false;
} }
// Clipboard operations // Clipboard operations
@@ -316,13 +316,13 @@ void wxTextCtrl::Redo()
bool wxTextCtrl::CanUndo() const bool wxTextCtrl::CanUndo() const
{ {
// No Undo in Motif // No Undo in Motif
return FALSE; return false;
} }
bool wxTextCtrl::CanRedo() const bool wxTextCtrl::CanRedo() const
{ {
// No Redo in Motif // No Redo in Motif
return FALSE; return false;
} }
// 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
@@ -354,7 +354,7 @@ void wxTextCtrl::SetInsertionPoint(long pos)
void wxTextCtrl::SetInsertionPointEnd() void wxTextCtrl::SetInsertionPointEnd()
{ {
long pos = GetLastPosition(); wxTextPos pos = GetLastPosition();
SetInsertionPoint(pos); SetInsertionPoint(pos);
} }
@@ -363,7 +363,7 @@ long wxTextCtrl::GetInsertionPoint() const
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);
} }
@@ -398,24 +398,24 @@ void wxTextCtrl::WriteText(const wxString& text)
XtVaSetValues ((Widget) m_mainWidget, XmNcursorPosition, textPosition, NULL); XtVaSetValues ((Widget) m_mainWidget, XmNcursorPosition, textPosition, NULL);
SetInsertionPoint(textPosition); SetInsertionPoint(textPosition);
XmTextShowPosition ((Widget) m_mainWidget, textPosition); XmTextShowPosition ((Widget) m_mainWidget, textPosition);
m_modified = TRUE; m_modified = true;
} }
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(), XmTextInsert ((Widget) m_mainWidget, GetLastPosition(),
wxConstCast(text.c_str(), char)); wxConstCast(text.c_str(), char));
XtVaSetValues ((Widget) m_mainWidget, XmNcursorPosition, textPosition, NULL); XtVaSetValues ((Widget) m_mainWidget, XmNcursorPosition, textPosition, NULL);
SetInsertionPoint(textPosition); SetInsertionPoint(textPosition);
XmTextShowPosition ((Widget) m_mainWidget, textPosition); XmTextShowPosition ((Widget) m_mainWidget, textPosition);
m_modified = TRUE; m_modified = true;
} }
void wxTextCtrl::Clear() void wxTextCtrl::Clear()
{ {
XmTextSetString ((Widget) m_mainWidget, ""); XmTextSetString ((Widget) m_mainWidget, "");
m_modified = FALSE; m_modified = false;
} }
bool wxTextCtrl::IsModified() const bool wxTextCtrl::IsModified() const
@@ -426,12 +426,12 @@ bool wxTextCtrl::IsModified() const
// Makes modified or unmodified // Makes modified or unmodified
void wxTextCtrl::MarkDirty() void wxTextCtrl::MarkDirty()
{ {
m_modified = TRUE; m_modified = true;
} }
void wxTextCtrl::DiscardEdits() void wxTextCtrl::DiscardEdits()
{ {
m_modified = FALSE; m_modified = false;
} }
int wxTextCtrl::GetNumberOfLines() const int wxTextCtrl::GetNumberOfLines() const
@@ -442,7 +442,7 @@ int wxTextCtrl::GetNumberOfLines() const
{ {
long i = 0; long i = 0;
int currentLine = 0; int currentLine = 0;
bool finished = FALSE; bool finished = false;
while (!finished) while (!finished)
{ {
int ch = s[i]; int ch = s[i];
@@ -453,7 +453,7 @@ int wxTextCtrl::GetNumberOfLines() const
} }
else if (ch == 0) else if (ch == 0)
{ {
finished = TRUE; finished = true;
} }
else else
i++; i++;
@@ -488,7 +488,7 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
if ( y ) if ( y )
*y = yy; *y = yy;
return TRUE; return true;
} }
void wxTextCtrl::ShowPosition(long pos) void wxTextCtrl::ShowPosition(long pos)
@@ -551,7 +551,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
// Indicates that we should generate a normal command, because // Indicates that we should generate a normal command, because
// we're letting default behaviour happen (otherwise it's vetoed // we're letting default behaviour happen (otherwise it's vetoed
// by virtue of overriding OnChar) // by virtue of overriding OnChar)
m_processedDefault = TRUE; m_processedDefault = true;
if (m_tempCallbackStruct) if (m_tempCallbackStruct)
{ {
@@ -588,12 +588,12 @@ void wxTextCtrl::ChangeBackgroundColour()
NULL); NULL);
wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
if (hsb) if (hsb)
wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, TRUE); wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, true);
if (vsb) if (vsb)
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);
} }
} }
@@ -677,7 +677,7 @@ wxSize wxDoGetSingleTextCtrlBestSize( Widget textWidget,
return wxSize( x + 2 * xmargin + 2 * highlight + 2 * shadow, return wxSize( x + 2 * xmargin + 2 * highlight + 2 * shadow,
// MBN: +2 necessary: Lesstif bug or mine? // 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
@@ -756,14 +756,14 @@ wxTextWindowChangedProc (Widget w, XtPointer clientData, XtPointer WXUNUSED(ptr)
return; return;
wxTextCtrl *tw = (wxTextCtrl *) clientData; wxTextCtrl *tw = (wxTextCtrl *) clientData;
tw->SetModified(TRUE); tw->SetModified(true);
} }
static void static void
wxTextWindowModifyProc (Widget WXUNUSED(w), XtPointer clientData, XmTextVerifyCallbackStruct *cbs) wxTextWindowModifyProc (Widget WXUNUSED(w), XtPointer clientData, XmTextVerifyCallbackStruct *cbs)
{ {
wxTextCtrl *tw = (wxTextCtrl *) clientData; 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 // 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 // to store the string inside the class because GetValue() can't retrieve

View File

@@ -620,7 +620,7 @@ void wxComboBox::SetInsertionPointEnd()
// setting insertion point doesn't make sense for read only comboboxes // setting insertion point doesn't make sense for read only comboboxes
if ( !(GetWindowStyle() & wxCB_READONLY) ) if ( !(GetWindowStyle() & wxCB_READONLY) )
{ {
long pos = GetLastPosition(); wxTextPos pos = GetLastPosition();
SetInsertionPoint(pos); SetInsertionPoint(pos);
} }
} }
@@ -635,15 +635,15 @@ long wxComboBox::GetInsertionPoint() const
#endif #endif
} }
long wxComboBox::GetLastPosition() const wxTextPos wxComboBox::GetLastPosition() const
{ {
HWND hEditWnd = (HWND) GetEditHWND(); HWND hEditWnd = (HWND) GetEditHWND();
// Get number of characters in the last (only) line. We'll add this to the character // Get number of characters in the last (only) line. We'll add this to the character
// index for the last line, 1st position. // 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); return lineLength;
} }
void wxComboBox::Replace(long from, long to, const wxString& value) void wxComboBox::Replace(long from, long to, const wxString& value)

View File

@@ -1141,7 +1141,7 @@ long wxTextCtrl::GetInsertionPoint() const
return Pos & 0xFFFF; return Pos & 0xFFFF;
} }
long wxTextCtrl::GetLastPosition() const wxTextPos wxTextCtrl::GetLastPosition() const
{ {
int numLines = GetNumberOfLines(); int numLines = GetNumberOfLines();
long posStartLastLine = XYToPosition(0, numLines - 1); long posStartLastLine = XYToPosition(0, numLines - 1);
@@ -2082,7 +2082,7 @@ void wxTextCtrl::OnSetFocus(wxFocusEvent& WXUNUSED(event))
// Default colors for MSW text control // Default colors for MSW text control
// //
// Set default background color to the native white instead of // 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
@@ -2466,7 +2466,7 @@ bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style)
{ {
// we have to do this or the style wouldn't apply for the text typed by // we have to do this or the style wouldn't apply for the text typed by
// the user // the user
long posLast = GetLastPosition(); wxTextPos posLast = GetLastPosition();
SetStyle(posLast, posLast, m_defaultStyle); SetStyle(posLast, posLast, m_defaultStyle);
} }
@@ -2531,7 +2531,7 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
wxStrcpy(lf.lfFaceName, cf.szFaceName); wxStrcpy(lf.lfFaceName, cf.szFaceName);
//NOTE: we _MUST_ set each of these values to _something_ since we //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) if (cf.dwEffects & CFE_ITALIC)
lf.lfItalic = TRUE; lf.lfItalic = TRUE;
else else

View File

@@ -566,7 +566,7 @@ long wxTextCtrl::GetInsertionPoint() const
return Pos & 0xFFFF; return Pos & 0xFFFF;
} }
long wxTextCtrl::GetLastPosition() const wxTextPos wxTextCtrl::GetLastPosition() const
{ {
int numLines = GetNumberOfLines(); int numLines = GetNumberOfLines();
long posStartLastLine = XYToPosition(0, numLines - 1); long posStartLastLine = XYToPosition(0, numLines - 1);

View File

@@ -81,9 +81,9 @@ bool wxComboBox::OS2Command(
} }
// //
// 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()
// //
return FALSE; return false;
} // end of wxComboBox::OS2Command } // end of wxComboBox::OS2Command
bool wxComboBox::Create( bool wxComboBox::Create(
@@ -117,7 +117,7 @@ bool wxComboBox::Create(
, const wxString& rsName , const wxString& rsName
) )
{ {
m_isShown = FALSE; m_isShown = false;
if (!CreateControl( pParent if (!CreateControl( pParent
,vId ,vId
@@ -127,7 +127,7 @@ bool wxComboBox::Create(
,rValidator ,rValidator
,rsName ,rsName
)) ))
return FALSE; return false;
// //
// Get the right style // Get the right style
@@ -150,7 +150,7 @@ bool wxComboBox::Create(
if (!OS2CreateControl( "COMBOBOX" if (!OS2CreateControl( "COMBOBOX"
,lSstyle ,lSstyle
)) ))
return FALSE; return false;
// //
// A choice/combobox normally has a white background (or other, depending // A choice/combobox normally has a white background (or other, depending
@@ -171,7 +171,7 @@ bool wxComboBox::Create(
,rSize.x ,rSize.x
,rSize.y ,rSize.y
); );
if (!rsValue.IsEmpty()) if (!rsValue.empty())
{ {
SetValue(rsValue); SetValue(rsValue);
} }
@@ -179,8 +179,8 @@ bool wxComboBox::Create(
,(PFNWP)wxComboEditWndProc ,(PFNWP)wxComboEditWndProc
); );
::WinSetWindowULong(GetHwnd(), QWL_USER, (ULONG)this); ::WinSetWindowULong(GetHwnd(), QWL_USER, (ULONG)this);
Show(TRUE); Show(true);
return TRUE; return true;
} // end of wxComboBox::Create } // end of wxComboBox::Create
void wxComboBox::SetValue( void wxComboBox::SetValue(
@@ -237,7 +237,7 @@ void wxComboBox::SetInsertionPoint(
void wxComboBox::SetInsertionPointEnd() void wxComboBox::SetInsertionPointEnd()
{ {
long lPos = GetLastPosition(); wxTextPos lPos = GetLastPosition();
SetInsertionPoint(lPos); SetInsertionPoint(lPos);
} // end of wxComboBox::SetInsertionPointEnd } // end of wxComboBox::SetInsertionPointEnd
@@ -254,7 +254,7 @@ long wxComboBox::GetInsertionPoint() const
return lPos; return lPos;
} // end of wxComboBox::GetInsertionPoint } // end of wxComboBox::GetInsertionPoint
long wxComboBox::GetLastPosition() const wxTextPos wxComboBox::GetLastPosition() const
{ {
long lLineLength = 0L; long lLineLength = 0L;
WNDPARAMS vParams; WNDPARAMS vParams;
@@ -381,7 +381,7 @@ bool wxComboBox::ProcessEditMsg(
case KC_CHAR: case KC_CHAR:
return (HandleChar( wParam return (HandleChar( wParam
,lParam ,lParam
,TRUE /* isASCII */ ,true /* isASCII */
)); ));
case KC_PREVDOWN: case KC_PREVDOWN:
@@ -403,7 +403,7 @@ bool wxComboBox::ProcessEditMsg(
return(HandleKillFocus((WXHWND)(HWND)wParam)); return(HandleKillFocus((WXHWND)(HWND)wParam));
break; break;
} }
return FALSE; return false;
} // end of WinGuiBase_CComboBox::ProcessEditMsg } // end of WinGuiBase_CComboBox::ProcessEditMsg
MRESULT EXPENTRY wxComboEditWndProc( MRESULT EXPENTRY wxComboEditWndProc(

View File

@@ -112,7 +112,7 @@ bool wxTextCtrl::Create(
,rValidator ,rValidator
,rsName ,rsName
)) ))
return FALSE; return false;
wxPoint vPos = rPos; // The OS/2 position wxPoint vPos = rPos; // The OS/2 position
SWP vSwp; SWP vSwp;
@@ -123,7 +123,7 @@ bool wxTextCtrl::Create(
} }
m_windowStyle = lStyle; m_windowStyle = lStyle;
m_bIsMLE = FALSE; m_bIsMLE = false;
long lSstyle = WS_VISIBLE | WS_TABSTOP; long lSstyle = WS_VISIBLE | WS_TABSTOP;
@@ -133,7 +133,7 @@ bool wxTextCtrl::Create(
if ( m_windowStyle & wxTE_MULTILINE ) if ( m_windowStyle & wxTE_MULTILINE )
{ {
lSstyle |= MLS_BORDER | MLS_WORDWRAP; lSstyle |= MLS_BORDER | MLS_WORDWRAP;
m_bIsMLE = TRUE; m_bIsMLE = true;
if ((m_windowStyle & wxTE_NO_VSCROLL) == 0) if ((m_windowStyle & wxTE_NO_VSCROLL) == 0)
lSstyle |= MLS_VSCROLL; lSstyle |= MLS_VSCROLL;
@@ -191,7 +191,7 @@ bool wxTextCtrl::Create(
if (m_hWnd == 0) if (m_hWnd == 0)
{ {
return FALSE; return false;
} }
SubclassWin(GetHWND()); SubclassWin(GetHWND());
@@ -205,7 +205,7 @@ bool wxTextCtrl::Create(
,wxNORMAL ,wxNORMAL
); );
SetFont(*pTextFont); SetFont(*pTextFont);
if (!rsValue.IsEmpty()) if (!rsValue.empty())
{ {
SetValue(rsValue); SetValue(rsValue);
} }
@@ -223,7 +223,7 @@ bool wxTextCtrl::Create(
,rSize.y ,rSize.y
); );
delete pTextFont; delete pTextFont;
return TRUE; return true;
} // end of wxTextCtrl::Create } // end of wxTextCtrl::Create
// //
@@ -456,10 +456,10 @@ bool wxTextCtrl::CanCut() const
bool wxTextCtrl::CanPaste() const bool wxTextCtrl::CanPaste() const
{ {
bool bIsTextAvailable = FALSE; bool bIsTextAvailable = false;
if (!IsEditable()) if (!IsEditable())
return FALSE; return false;
// //
// Check for straight text on clipboard // Check for straight text on clipboard
@@ -502,7 +502,7 @@ void wxTextCtrl::SetInsertionPoint(
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
@@ -530,7 +530,7 @@ long wxTextCtrl::GetInsertionPoint() const
return (dwPos & 0xFFFF); return (dwPos & 0xFFFF);
} // end of wxTextCtrl::GetInsertionPoint } // end of wxTextCtrl::GetInsertionPoint
long wxTextCtrl::GetLastPosition() const wxTextPos wxTextCtrl::GetLastPosition() const
{ {
HWND hWnd = GetHwnd(); HWND hWnd = GetHwnd();
long lCharIndex; long lCharIndex;
@@ -687,9 +687,9 @@ bool wxTextCtrl::LoadFile(
// Update the size limit if needed // Update the size limit if needed
// //
AdjustSpaceLimit(); AdjustSpaceLimit();
return TRUE; return true;
} }
return FALSE; return false;
} // end of wxTextCtrl::LoadFile } // end of wxTextCtrl::LoadFile
bool wxTextCtrl::IsModified() const bool wxTextCtrl::IsModified() const
@@ -773,7 +773,7 @@ bool wxTextCtrl::PositionToXY(
if (nLineNo == -1) if (nLineNo == -1)
{ {
// no such line // no such line
return FALSE; return false;
} }
// //
@@ -805,7 +805,7 @@ bool wxTextCtrl::PositionToXY(
if (lCharIndex == -1) if (lCharIndex == -1)
{ {
return FALSE; return false;
} }
// //
@@ -816,7 +816,7 @@ bool wxTextCtrl::PositionToXY(
if (plY) if (plY)
*plY = nLineNo; *plY = nLineNo;
return TRUE; return true;
} // end of wxTextCtrl::PositionToXY } // end of wxTextCtrl::PositionToXY
void wxTextCtrl::ShowPosition( void wxTextCtrl::ShowPosition(
@@ -956,7 +956,7 @@ bool wxTextCtrl::CanUndo() const
if (m_bIsMLE) if (m_bIsMLE)
bOk = (::WinSendMsg(GetHwnd(), MLM_QUERYUNDO, 0, 0) != 0); bOk = (::WinSendMsg(GetHwnd(), MLM_QUERYUNDO, 0, 0) != 0);
else else
bOk = FALSE; // can't undo regular edit fields in PM bOk = false; // can't undo regular edit fields in PM
return bOk; return bOk;
} // end of wxTextCtrl::CanUndo } // end of wxTextCtrl::CanUndo
@@ -967,7 +967,7 @@ bool wxTextCtrl::CanRedo() const
if (m_bIsMLE) if (m_bIsMLE)
bOk = (::WinSendMsg(GetHwnd(), MLM_QUERYUNDO, 0, 0) != 0); bOk = (::WinSendMsg(GetHwnd(), MLM_QUERYUNDO, 0, 0) != 0);
else else
bOk = FALSE; // can't undo regular edit fields in PM bOk = false; // can't undo regular edit fields in PM
return bOk; return bOk;
} // end of wxTextCtrl::CanRedo } // end of wxTextCtrl::CanRedo
@@ -1065,7 +1065,7 @@ void wxTextCtrl::OnChar(
wxNavigationKeyEvent vEventNav; wxNavigationKeyEvent vEventNav;
vEventNav.SetDirection(!rEvent.ShiftDown()); vEventNav.SetDirection(!rEvent.ShiftDown());
vEventNav.SetWindowChange(FALSE); vEventNav.SetWindowChange(false);
vEventNav.SetEventObject(this); vEventNav.SetEventObject(this);
if ( GetEventHandler()->ProcessEvent(vEventNav) ) if ( GetEventHandler()->ProcessEvent(vEventNav) )
@@ -1117,15 +1117,15 @@ bool wxTextCtrl::OS2Command(
case EN_SCROLL: case EN_SCROLL:
case EN_INSERTMODETOGGLE: case EN_INSERTMODETOGGLE:
case EN_MEMERROR: case EN_MEMERROR:
return FALSE; return false;
default: default:
return FALSE; return false;
} }
// //
// Processed // Processed
// //
return TRUE; return true;
} // end of wxTextCtrl::OS2Command } // end of wxTextCtrl::OS2Command
void wxTextCtrl::AdjustSpaceLimit() void wxTextCtrl::AdjustSpaceLimit()
@@ -1148,7 +1148,7 @@ void wxTextCtrl::AdjustSpaceLimit()
WNDPARAMS vParams; WNDPARAMS vParams;
vParams.fsStatus = WPM_CBCTLDATA; vParams.fsStatus = WPM_CBCTLDATA;
vParams.pCtlData = &Efd; vParams.pCtlData = &Efd;
vParams.cbCtlData = sizeof(ENTRYFDATA); vParams.cbCtlData = sizeof(ENTRYFDATA);
if (::WinSendMsg( GetHwnd() if (::WinSendMsg( GetHwnd()
@@ -1325,7 +1325,7 @@ bool wxTextCtrl::SetBackgroundColour(
{ {
if (m_bIsMLE) if (m_bIsMLE)
::WinSendMsg(GetHwnd(), MLM_SETBACKCOLOR, (MPARAM)rColour.GetPixel(), MLE_INDEX); ::WinSendMsg(GetHwnd(), MLM_SETBACKCOLOR, (MPARAM)rColour.GetPixel(), MLE_INDEX);
return TRUE; return true;
} // end of wxTextCtrl::SetBackgroundColour } // end of wxTextCtrl::SetBackgroundColour
bool wxTextCtrl::SetForegroundColour( bool wxTextCtrl::SetForegroundColour(
@@ -1334,7 +1334,7 @@ bool wxTextCtrl::SetForegroundColour(
{ {
if (m_bIsMLE) if (m_bIsMLE)
::WinSendMsg(GetHwnd(), MLM_SETTEXTCOLOR, (MPARAM)rColour.GetPixel(), MLE_INDEX); ::WinSendMsg(GetHwnd(), MLM_SETTEXTCOLOR, (MPARAM)rColour.GetPixel(), MLE_INDEX);
return TRUE; return true;
} // end of wxTextCtrl::SetForegroundColour } // end of wxTextCtrl::SetForegroundColour
bool wxTextCtrl::SetStyle( bool wxTextCtrl::SetStyle(
@@ -1381,6 +1381,6 @@ bool wxTextCtrl::SetStyle(
// //
// TODO:: finish this part // TODO:: finish this part
// //
return TRUE; return true;
} // end of wxTextCtrl::SetStyle } // end of wxTextCtrl::SetStyle

View File

@@ -244,7 +244,7 @@ long wxComboBox::GetInsertionPoint() const
return 0; return 0;
} }
long wxComboBox::GetLastPosition() const wxTextPos wxComboBox::GetLastPosition() const
{ {
return 0; return 0;
} }
@@ -263,7 +263,7 @@ void wxComboBox::SetSelection(long from, long to)
bool wxComboBox::IsEditable() const bool wxComboBox::IsEditable() const
{ {
return false; return false;
} }
void wxComboBox::Undo() void wxComboBox::Undo()
@@ -280,27 +280,27 @@ void wxComboBox::SelectAll()
bool wxComboBox::CanCopy() const bool wxComboBox::CanCopy() const
{ {
return false; return false;
} }
bool wxComboBox::CanCut() const bool wxComboBox::CanCut() const
{ {
return false; return false;
} }
bool wxComboBox::CanPaste() const bool wxComboBox::CanPaste() const
{ {
return false; return false;
} }
bool wxComboBox::CanUndo() const bool wxComboBox::CanUndo() const
{ {
return false; return false;
} }
bool wxComboBox::CanRedo() const bool wxComboBox::CanRedo() const
{ {
return false; return false;
} }

View File

@@ -378,7 +378,7 @@ long wxTextCtrl::GetInsertionPoint() const
return 0; return 0;
} }
long wxTextCtrl::GetLastPosition() const wxTextPos wxTextCtrl::GetLastPosition() const
{ {
return 0; return 0;
} }

View File

@@ -763,7 +763,7 @@ long wxComboBox::GetInsertionPoint() const
return GetText()->GetInsertionPoint(); return GetText()->GetInsertionPoint();
} }
long wxComboBox::GetLastPosition() const wxTextPos wxComboBox::GetLastPosition() const
{ {
return GetText()->GetLastPosition(); return GetText()->GetLastPosition();
} }
@@ -892,7 +892,7 @@ wxClientData* wxComboBox::DoGetItemClientObject(int n) const
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()

View File

@@ -47,7 +47,7 @@
is true in which case a single LINE may correspond to multiple ROWs. 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 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 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 before the first character and the last position is the one beyond the last
character. For an empty text control GetLastPosition() returns 0. character. For an empty text control GetLastPosition() returns 0.
@@ -197,7 +197,7 @@ static inline void OrderPositions(wxTextPos& from, wxTextPos& to)
// the value which is never used for text position, even not -1 which is // the value which is never used for text position, even not -1 which is
// sometimes used for some special meaning // 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 // overlap between pages (when using PageUp/Dn) in lines
static const size_t PAGE_OVERLAP_IN_LINES = 1; static const size_t PAGE_OVERLAP_IN_LINES = 1;
@@ -1670,7 +1670,7 @@ wxTextPos wxTextCtrl::XYToPosition(wxTextCoord x, wxTextCoord y) const
// if they are out of range // if they are out of range
if ( IsSingleLine() ) if ( IsSingleLine() )
{ {
return x > GetLastPosition() || y > 0 ? wxDefaultCoord : x; return ( x > GetLastPosition() || y > 0 ) ? wxOutOfRangeTextCoord : x;
} }
else // multiline else // multiline
{ {

File diff suppressed because it is too large Load Diff