Temporarily use self-made wxTextCtrl in wxX11 until

the in /src/univ.cpp works better.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14881 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2002-04-01 11:41:59 +00:00
parent 8a328874b6
commit 4175e95227
13 changed files with 2866 additions and 337 deletions

640
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -2099,7 +2099,11 @@ equivalent variable and GTK+ is version 1.2.3 or above.
ALL_HEADERS="\$(ALL_HEADERS) \${UNIV_HEADERS}"
PORT_FILES="${PORT_FILES} \${top_srcdir}/src/univ/files.lst"
TOOLKIT_VPATH="\${top_srcdir}/src/univ${PATH_IFS}\${top_srcdir}/src/univ/themes${PATH_IFS}\${top_srcdir}/src/${TOOLKIT_DIR}"
if test "$wxUSE_X11" = 1; then
TOOLKIT_VPATH="\${top_srcdir}/src/${TOOLKIT_DIR}${PATH_IFS}\${top_srcdir}/src/univ${PATH_IFS}\${top_srcdir}/src/univ/themes"
else
TOOLKIT_VPATH="\${top_srcdir}/src/univ${PATH_IFS}\${top_srcdir}/src/univ/themes${PATH_IFS}\${top_srcdir}/src/${TOOLKIT_DIR}"
fi
TOOLCHAIN_DEFS="${TOOLCHAIN_DEFS} -D__WXUNIVERSAL__"
WIDGET_SET=univ
else

View File

@ -1217,6 +1217,7 @@ private.h X11H
region.h X11H
reparent.h X11H
settings.h X11H
textctrl.h X11H
toolbar.h X11H
toplevel.h X11H
window.h X11H
@ -1524,7 +1525,7 @@ statbox.h UnivH
statline.h UnivH
stattext.h UnivH
statusbr.h UnivH
textctrl.h UnivH
textctrl.h UnivH NotX11
theme.h UnivH
toolbar.h UnivH
window.h UnivH

View File

@ -276,7 +276,9 @@ protected:
// include the platform-dependent class definition
// ----------------------------------------------------------------------------
#if defined(__WXUNIVERSAL__)
#if defined(__WXX11__)
#include "wx/x11/textctrl.h"
#elif defined(__WXUNIVERSAL__)
#include "wx/univ/textctrl.h"
#elif defined(__WXMSW__)
#include "wx/msw/textctrl.h"

379
include/wx/x11/textctrl.h Normal file
View File

@ -0,0 +1,379 @@
/////////////////////////////////////////////////////////////////////////////
// Name: textctrl.h
// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __X11TEXTCTRLH__
#define __X11TEXTCTRLH__
#ifdef __GNUG__
#pragma interface "textctrl.h"
#endif
#include "wx/scrolwin.h"
#include "wx/dynarray.h"
#include "wx/datetime.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxTextCtrl;
//-----------------------------------------------------------------------------
// helpers
//-----------------------------------------------------------------------------
enum wxSourceUndo
{
wxSOURCE_UNDO_LINE,
wxSOURCE_UNDO_ENTER,
wxSOURCE_UNDO_BACK,
wxSOURCE_UNDO_INSERT_LINE,
wxSOURCE_UNDO_DELETE,
wxSOURCE_UNDO_PASTE
};
class wxSourceUndoStep: public wxObject
{
public:
wxSourceUndoStep( wxSourceUndo type, int y1, int y2, wxTextCtrl *owner );
void Undo();
wxSourceUndo m_type;
int m_y1;
int m_y2;
int m_cursorX;
int m_cursorY;
wxTextCtrl *m_owner;
wxString m_text;
wxArrayString m_lines;
};
class wxSourceLine
{
public:
wxSourceLine( const wxString &text = wxEmptyString )
{
m_text = text;
}
wxString m_text;
};
WX_DECLARE_OBJARRAY(wxSourceLine, wxSourceLineArray);
enum wxSourceLanguage
{
wxSOURCE_LANG_NONE,
wxSOURCE_LANG_CPP,
wxSOURCE_LANG_PERL,
wxSOURCE_LANG_PYTHON
};
//-----------------------------------------------------------------------------
// wxTextCtrl
//-----------------------------------------------------------------------------
class wxTextCtrl: public wxTextCtrlBase, public wxScrollHelper
{
public:
wxTextCtrl() { Init(); }
wxTextCtrl(wxWindow *parent,
wxWindowID id,
const wxString &value = wxEmptyString,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxTextCtrlNameStr);
bool Create(wxWindow *parent,
wxWindowID id,
const wxString &value = wxEmptyString,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxTextCtrlNameStr);
// required for scrolling with wxScrollHelper
// ------------------------------------------
virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
// implement base class pure virtuals
// ----------------------------------
virtual wxString GetValue() const;
virtual void SetValue(const wxString& value);
virtual int GetLineLength(long lineNo) const;
virtual wxString GetLineText(long lineNo) const;
virtual int GetNumberOfLines() const;
virtual bool IsModified() const;
virtual bool IsEditable() const;
// more readable flag testing methods
// ----------------------------------
bool IsSingleLine() const { return !(GetWindowStyle() & wxTE_MULTILINE); }
bool IsPassword() const { return (GetWindowStyle() & wxTE_PASSWORD) != 0; }
bool WrapLines() const { return FALSE; }
// If the return values from and to are the same, there is no selection.
virtual void GetSelection(long* from, long* to) const;
// operations
// ----------
// editing
virtual void Clear();
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
// clears the dirty flag
virtual void DiscardEdits();
virtual void SetMaxLength(unsigned long len);
// writing text inserts it at the current position, appending always
// inserts it at the end
virtual void WriteText(const wxString& text);
virtual void AppendText(const wxString& text);
// apply text attribute to the range of text (only works with richedit
// controls)
virtual bool SetStyle(long start, long end, const wxTextAttr& style);
// translate between the position (which is just an index in the text ctrl
// considering all its contents as a single strings) and (x, y) coordinates
// which represent column and line.
virtual long XYToPosition(long x, long y) const;
virtual bool PositionToXY(long pos, long *x, long *y) const;
virtual void ShowPosition(long pos);
// Clipboard operations
virtual void Copy();
virtual void Cut();
virtual void Paste();
// Undo/redo
virtual void Undo();
virtual void Redo() {}
virtual bool CanUndo() const { return (m_undos.GetCount() > 0); }
virtual bool CanRedo() const { return FALSE; }
// Insertion point
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual bool Enable( bool enable );
void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);
void OnPaste(wxCommandEvent& event);
void OnUndo(wxCommandEvent& event);
void OnRedo(wxCommandEvent& event);
void OnUpdateCut(wxUpdateUIEvent& event);
void OnUpdateCopy(wxUpdateUIEvent& event);
void OnUpdatePaste(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
bool SetFont(const wxFont& font);
bool SetForegroundColour(const wxColour& colour);
bool SetBackgroundColour(const wxColour& colour);
void SetModified() { m_modified = TRUE; }
virtual void Freeze();
virtual void Thaw();
// textctrl specific scrolling
virtual bool ScrollLines(int lines);
virtual bool ScrollPages(int pages);
// not part of the wxTextCtrl API from now on..
void Delete();
void DeleteLine();
void Indent();
void Unindent();
bool HasSelection();
void ClearSelection();
int GetCursorX() { return m_cursorX; }
int GetCursorY() { return m_cursorY; }
bool IsModified() { return m_modified; }
bool OverwriteMode() { return m_overwrite; }
// implementation from now on...
void SearchForBrackets();
void DoChar( char c );
void DoBack();
void DoDelete();
void DoReturn();
void DoDClick();
wxString GetNextToken( wxString &line, int &pos );
void DrawLine( wxDC &dc, int x, int y, const wxString &line, int lineNum );
void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event );
void OnChar( wxKeyEvent &event );
void OnIdle( wxIdleEvent &event );
void RefreshLine( int n );
void RefreshDown( int n );
void MoveCursor( int new_x, int new_y, bool shift = FALSE, bool centre = FALSE );
void MyAdjustScrollbars();
protected:
// common part of all ctors
void Init();
virtual wxSize DoGetBestSize() const;
friend class wxSourceUndoStep;
wxSourceLineArray m_lines;
wxFont m_sourceFont;
wxColour m_sourceColour;
wxColour m_commentColour;
wxColour m_stringColour;
int m_cursorX;
int m_cursorY;
int m_selStartX,m_selStartY;
int m_selEndX,m_selEndY;
int m_lineHeight;
int m_charWidth;
int m_longestLine;
bool m_overwrite;
bool m_modified;
bool m_editable;
bool m_ignoreInput;
wxArrayString m_keywords;
wxColour m_keywordColour;
wxArrayString m_defines;
wxColour m_defineColour;
wxArrayString m_variables;
wxColour m_variableColour;
wxSourceLanguage m_lang;
wxList m_undos;
bool m_capturing;
int m_bracketX;
int m_bracketY;
private:
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxTextCtrl);
};
//-----------------------------------------------------------------------------
// this is superfluous here but helps to compile
//-----------------------------------------------------------------------------
// cursor movement and also selection and delete operations
#define wxACTION_TEXT_GOTO _T("goto") // to pos in numArg
#define wxACTION_TEXT_FIRST _T("first") // go to pos 0
#define wxACTION_TEXT_LAST _T("last") // go to last pos
#define wxACTION_TEXT_HOME _T("home")
#define wxACTION_TEXT_END _T("end")
#define wxACTION_TEXT_LEFT _T("left")
#define wxACTION_TEXT_RIGHT _T("right")
#define wxACTION_TEXT_UP _T("up")
#define wxACTION_TEXT_DOWN _T("down")
#define wxACTION_TEXT_WORD_LEFT _T("wordleft")
#define wxACTION_TEXT_WORD_RIGHT _T("wordright")
#define wxACTION_TEXT_PAGE_UP _T("pageup")
#define wxACTION_TEXT_PAGE_DOWN _T("pagedown")
// clipboard operations
#define wxACTION_TEXT_COPY _T("copy")
#define wxACTION_TEXT_CUT _T("cut")
#define wxACTION_TEXT_PASTE _T("paste")
// insert text at the cursor position: the text is in strArg of PerformAction
#define wxACTION_TEXT_INSERT _T("insert")
// if the action starts with either of these prefixes and the rest of the
// string is one of the movement commands, it means to select/delete text from
// the current cursor position to the new one
#define wxACTION_TEXT_PREFIX_SEL _T("sel")
#define wxACTION_TEXT_PREFIX_DEL _T("del")
// mouse selection
#define wxACTION_TEXT_ANCHOR_SEL _T("anchorsel")
#define wxACTION_TEXT_EXTEND_SEL _T("extendsel")
#define wxACTION_TEXT_SEL_WORD _T("wordsel")
#define wxACTION_TEXT_SEL_LINE _T("linesel")
// undo or redo
#define wxACTION_TEXT_UNDO _T("undo")
#define wxACTION_TEXT_REDO _T("redo")
// ----------------------------------------------------------------------------
// wxTextCtrl types
// ----------------------------------------------------------------------------
// wxTextPos is the position in the text
typedef long wxTextPos;
// wxTextCoord is the line or row number (which should have been unsigned but
// is long for backwards compatibility)
typedef long wxTextCoord;
class WXDLLEXPORT wxStdTextCtrlInputHandler : public wxStdInputHandler
{
public:
wxStdTextCtrlInputHandler(wxInputHandler *inphand) : wxStdInputHandler(inphand) {}
virtual bool HandleKey(wxInputConsumer *consumer,
const wxKeyEvent& event,
bool pressed) { return FALSE; }
virtual bool HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { return FALSE; }
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { return FALSE; }
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) { return FALSE; }
protected:
// get the position of the mouse click
static wxTextPos HitTest(const wxTextCtrl *text, const wxPoint& pos) { return 0; }
// capture data
wxTextCtrl *m_winCapture;
};
#endif // __GTKTEXTCTRLH__

View File

@ -59,7 +59,6 @@ GENERICOBJS= accel.obj &
gridsel.obj &
helpext.obj &
helphtml.obj &
helpwxht.obj &
imaglist.obj &
laywin.obj &
listctrl.obj &
@ -147,6 +146,7 @@ COMMONOBJS = &
hashmap.obj &
helpbase.obj &
http.obj &
iconbndl.obj &
imagall.obj &
imagbmp.obj &
image.obj &
@ -698,6 +698,9 @@ helpbase.obj: $(COMMDIR)\helpbase.cpp
http.obj: $(COMMDIR)\http.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
iconbndl.obj: $(COMMDIR)\iconbndl.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
imagall.obj: $(COMMDIR)\imagall.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
@ -982,9 +985,6 @@ helpext.obj: $(GENDIR)\helpext.cpp
helphtml.obj: $(GENDIR)\helphtml.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
helpwxht.obj: $(GENDIR)\helpwxht.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
imaglist.obj: $(GENDIR)\imaglist.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<

View File

@ -4117,6 +4117,7 @@ void wxTextCtrl::DoDraw(wxControlRenderer *renderer)
// the update region is in window coords and text area is in the client
// ones, so it must be shifted before computing intersection
wxRegion rgnUpdate = GetUpdateRegion();
wxRect rectTextArea = GetRealTextArea();
wxPoint pt = GetClientAreaOrigin();
wxRect rectTextAreaAdjusted = rectTextArea;

View File

@ -4160,12 +4160,12 @@ bool wxWin32ScrollBarInputHandler::HandleMouseMove(wxInputConsumer *control,
wxPoint pos = event.GetPosition();
if (scrollbar->HasFlag( wxVERTICAL ))
{
if (pos.x > -20 && pos.x < scrollbar->GetSize().x+20)
if (pos.x > -40 && pos.x < scrollbar->GetSize().x+40)
pos.x = 5;
}
else
{
if (pos.y > -20 && pos.y < scrollbar->GetSize().y+20)
if (pos.y > -40 && pos.y < scrollbar->GetSize().y+40)
pos.y = 5;
}
ht = m_renderer->HitTestScrollbar(scrollbar, pos );

View File

@ -1215,7 +1215,7 @@ SOURCE=..\include\wx\univ\setup.h
InputPath=..\include\wx\univ\setup.h
"../lib/univ/wx/setup.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(InputPath) ..\lib\univ\wx\setup.h
copy "$(InputPath)" ..\lib\univ\wx\setup.h
# End Custom Build
!ELSEIF "$(CFG)" == "wxUniv - Win32 Debug"
@ -1223,7 +1223,7 @@ InputPath=..\include\wx\univ\setup.h
InputPath=..\include\wx\univ\setup.h
"../lib/univd/wx/setup.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(InputPath) ..\lib\univd\wx\setup.h
copy "$(InputPath)" ..\lib\univd\wx\setup.h
# End Custom Build
!ENDIF

View File

@ -1447,7 +1447,7 @@ SOURCE=..\include\wx\msw\setup.h
InputPath=..\include\wx\msw\setup.h
"../lib/mswdllu/wx/setup.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(InputPath) ..\lib\mswdllu\wx\setup.h
copy "$(InputPath)" ..\lib\mswdllu\wx\setup.h
# End Custom Build
!ELSEIF "$(CFG)" == "wxWindows - Win32 Debug Unicode DLL"
@ -1455,7 +1455,7 @@ InputPath=..\include\wx\msw\setup.h
InputPath=..\include\wx\msw\setup.h
"../lib/mswdllud/wx/setup.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(InputPath) ..\lib\mswdllud\wx\setup.h
copy "$(InputPath)" ..\lib\mswdllud\wx\setup.h
# End Custom Build
!ELSEIF "$(CFG)" == "wxWindows - Win32 Release Unicode"
@ -1463,7 +1463,7 @@ InputPath=..\include\wx\msw\setup.h
InputPath=..\include\wx\msw\setup.h
"../lib/mswu/wx/setup.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(InputPath) ..\lib\mswu\wx\setup.h
copy "$(InputPath)" ..\lib\mswu\wx\setup.h
# End Custom Build
!ELSEIF "$(CFG)" == "wxWindows - Win32 Debug Unicode"
@ -1471,7 +1471,7 @@ InputPath=..\include\wx\msw\setup.h
InputPath=..\include\wx\msw\setup.h
"../lib/mswud/wx/setup.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(InputPath) ..\lib\mswud\wx\setup.h
copy "$(InputPath)" ..\lib\mswud\wx\setup.h
# End Custom Build
!ELSEIF "$(CFG)" == "wxWindows - Win32 Release DLL"
@ -1479,7 +1479,7 @@ InputPath=..\include\wx\msw\setup.h
InputPath=..\include\wx\msw\setup.h
"../lib/mswdll/wx/setup.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(InputPath) ..\lib\mswdll\wx\setup.h
copy "$(InputPath)" ..\lib\mswdll\wx\setup.h
# End Custom Build
!ELSEIF "$(CFG)" == "wxWindows - Win32 Debug DLL"
@ -1487,7 +1487,7 @@ InputPath=..\include\wx\msw\setup.h
InputPath=..\include\wx\msw\setup.h
"../lib/mswdlld/wx/setup.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(InputPath) ..\lib\mswdlld\wx\setup.h
copy "$(InputPath)" ..\lib\mswdlld\wx\setup.h
# End Custom Build
!ELSEIF "$(CFG)" == "wxWindows - Win32 Release"
@ -1495,7 +1495,7 @@ InputPath=..\include\wx\msw\setup.h
InputPath=..\include\wx\msw\setup.h
"../lib/msw/wx/setup.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(InputPath) ..\lib\msw\wx\setup.h
copy "$(InputPath)" ..\lib\msw\wx\setup.h
# End Custom Build
!ELSEIF "$(CFG)" == "wxWindows - Win32 Debug"
@ -1503,7 +1503,7 @@ InputPath=..\include\wx\msw\setup.h
InputPath=..\include\wx\msw\setup.h
"../lib/mswd/wx/setup.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(InputPath) ..\lib\mswd\wx\setup.h
copy "$(InputPath)" ..\lib\mswd\wx\setup.h
# End Custom Build
!ENDIF

View File

@ -562,6 +562,8 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
#if !wxUSE_NANOX
case GraphicsExpose:
{
printf( "GraphicExpose event\n" );
// wxLogDebug( "GraphicsExpose from %s", win->GetName().c_str(),
// event->xgraphicsexpose.x, event->xgraphicsexpose.y,
// event->xgraphicsexpose.width, event->xgraphicsexpose.height);

View File

@ -503,6 +503,7 @@ ALL_HEADERS = \
x11/region.h \
x11/reparent.h \
x11/settings.h \
x11/textctrl.h \
x11/toolbar.h \
x11/toplevel.h \
x11/window.h \

2135
src/x11/textctrl.cpp Normal file

File diff suppressed because it is too large Load Diff