Added validation support

Fixed a few minor things in wxGrid
  Fixed bug in SetClippingregion
  Disabled SetDefault again
  Fixed bug in AddChild, SetSize et al.
  Add PROCESS_ENTER and wxEVT_TEXT_CHANGE
  Renamed OnOk -> OnOK
  Added a few compatibilty functions
  Added code to make iinterception
    of events possible and work


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@538 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-08-14 22:53:21 +00:00
parent 470b7da353
commit 903f689bf7
39 changed files with 561 additions and 287 deletions

View File

@@ -23,7 +23,7 @@
#define wxGRID_DEFAULT_EDIT_WIDTH 300
#define wxGRID_DEFAULT_EDIT_HEIGHT 27
#define wxGRID_DEFAULT_EDIT_X 5
#define wxGRID_DEFAULT_EDIT_X 2
#define wxGRID_DEFAULT_EDIT_Y 1
#define wxGRID_DEFAULT_SHEET_TOP 31
#define wxGRID_DEFAULT_SHEET_LEFT 0

View File

@@ -60,6 +60,9 @@ class wxBitmapButton: public wxControl
void SetDefault(void);
void SetLabel( const wxString &label );
wxString GetLabel(void) const;
virtual void SetLabel(const wxBitmap& bitmap) { SetBitmapLabel(bitmap); }
virtual void SetBitmapLabel( const wxBitmap& bitmap );
wxBitmap& GetBitmapLabel(void) const { return (wxBitmap&) m_bitmap; }
public:

View File

@@ -63,7 +63,7 @@ class wxDialog: public wxWindow
bool OnClose(void);
void OnApply( wxCommandEvent &event );
void OnCancel( wxCommandEvent &event );
void OnOk( wxCommandEvent &event );
void OnOK( wxCommandEvent &event );
void OnPaint(wxPaintEvent& event);
bool Destroy(void);
void OnCloseWindow(wxCloseEvent& event);
@@ -75,15 +75,19 @@ class wxDialog: public wxWindow
virtual void EndModal(int retCode);
virtual bool IsModal(void) const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
virtual void InitDialog(void);
virtual void Centre( int direction = wxHORIZONTAL );
private:
friend wxWindow;
friend wxDC;
friend wxRadioBox;
bool m_modalShowing;
wxString m_title;
virtual void ImplementSetPosition();
DECLARE_EVENT_TABLE()
};

View File

@@ -61,6 +61,7 @@ public:
virtual bool Show( bool show );
virtual void Enable( bool enable );
virtual void Centre( int direction = wxHORIZONTAL );
virtual void GetClientSize( int *width, int *height ) const;
virtual void SetClientSize( int const width, int const height );
@@ -90,6 +91,7 @@ public:
virtual void SetIcon( const wxIcon &icon );
void Iconize( bool WXUNUSED(iconize)) { }
bool IsIconized(void) const { return FALSE; }
bool Iconized(void) const { return FALSE; }
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
void OnSize( wxSizeEvent &event );
@@ -107,6 +109,7 @@ private:
// update frame's menus (called from OnIdle)
void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu);
virtual void ImplementSetPosition();
GtkWidget *m_mainWindow;
wxMenuBar *m_frameMenuBar;

View File

@@ -48,7 +48,7 @@ class wxTextCtrl: public wxControl, public streambuf
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxTextCtrl);
public:
public:
wxTextCtrl();
wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "",
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
@@ -102,11 +102,12 @@ public:
wxTextCtrl& operator<<(const char c);
virtual GtkWidget* GetConnectWidget(void);
virtual bool IsOwnGtkWindow( GdkWindow *window );
private:
bool m_modified;
GtkWidget *m_text;
private:
bool m_modified;
GtkWidget *m_text;
};
#endif // __GTKTEXTCTRLH__

View File

@@ -103,7 +103,8 @@ public:
virtual bool Show( bool show );
virtual void Enable( bool enable );
virtual void MakeModal( bool modal );
virtual bool IsEnabled() const { return m_isEnabled; };
virtual bool IsEnabled() const { return m_isEnabled; }
inline bool Enabled(void) const { return IsEnabled(); }
virtual void SetFocus();
virtual bool OnClose();
@@ -191,8 +192,9 @@ public:
virtual void SetDropTarget( wxDropTarget *dropTarget );
virtual wxDropTarget *GetDropTarget() const;
private:
//private:
virtual GtkWidget* GetConnectWidget(void);
virtual bool IsOwnGtkWindow( GdkWindow *window );
public:
virtual void SetScrollbar( int orient, int pos, int thumbVisible,

View File

@@ -60,6 +60,9 @@ class wxBitmapButton: public wxControl
void SetDefault(void);
void SetLabel( const wxString &label );
wxString GetLabel(void) const;
virtual void SetLabel(const wxBitmap& bitmap) { SetBitmapLabel(bitmap); }
virtual void SetBitmapLabel( const wxBitmap& bitmap );
wxBitmap& GetBitmapLabel(void) const { return (wxBitmap&) m_bitmap; }
public:

View File

@@ -63,7 +63,7 @@ class wxDialog: public wxWindow
bool OnClose(void);
void OnApply( wxCommandEvent &event );
void OnCancel( wxCommandEvent &event );
void OnOk( wxCommandEvent &event );
void OnOK( wxCommandEvent &event );
void OnPaint(wxPaintEvent& event);
bool Destroy(void);
void OnCloseWindow(wxCloseEvent& event);
@@ -75,15 +75,19 @@ class wxDialog: public wxWindow
virtual void EndModal(int retCode);
virtual bool IsModal(void) const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
virtual void InitDialog(void);
virtual void Centre( int direction = wxHORIZONTAL );
private:
friend wxWindow;
friend wxDC;
friend wxRadioBox;
bool m_modalShowing;
wxString m_title;
virtual void ImplementSetPosition();
DECLARE_EVENT_TABLE()
};

View File

@@ -61,6 +61,7 @@ public:
virtual bool Show( bool show );
virtual void Enable( bool enable );
virtual void Centre( int direction = wxHORIZONTAL );
virtual void GetClientSize( int *width, int *height ) const;
virtual void SetClientSize( int const width, int const height );
@@ -90,6 +91,7 @@ public:
virtual void SetIcon( const wxIcon &icon );
void Iconize( bool WXUNUSED(iconize)) { }
bool IsIconized(void) const { return FALSE; }
bool Iconized(void) const { return FALSE; }
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
void OnSize( wxSizeEvent &event );
@@ -107,6 +109,7 @@ private:
// update frame's menus (called from OnIdle)
void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu);
virtual void ImplementSetPosition();
GtkWidget *m_mainWindow;
wxMenuBar *m_frameMenuBar;

View File

@@ -48,7 +48,7 @@ class wxTextCtrl: public wxControl, public streambuf
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxTextCtrl);
public:
public:
wxTextCtrl();
wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "",
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
@@ -102,11 +102,12 @@ public:
wxTextCtrl& operator<<(const char c);
virtual GtkWidget* GetConnectWidget(void);
virtual bool IsOwnGtkWindow( GdkWindow *window );
private:
bool m_modified;
GtkWidget *m_text;
private:
bool m_modified;
GtkWidget *m_text;
};
#endif // __GTKTEXTCTRLH__

View File

@@ -103,7 +103,8 @@ public:
virtual bool Show( bool show );
virtual void Enable( bool enable );
virtual void MakeModal( bool modal );
virtual bool IsEnabled() const { return m_isEnabled; };
virtual bool IsEnabled() const { return m_isEnabled; }
inline bool Enabled(void) const { return IsEnabled(); }
virtual void SetFocus();
virtual bool OnClose();
@@ -191,8 +192,9 @@ public:
virtual void SetDropTarget( wxDropTarget *dropTarget );
virtual wxDropTarget *GetDropTarget() const;
private:
//private:
virtual GtkWidget* GetConnectWidget(void);
virtual bool IsOwnGtkWindow( GdkWindow *window );
public:
virtual void SetScrollbar( int orient, int pos, int thumbVisible,

View File

@@ -6,7 +6,7 @@
#elif defined(__WXMOTIF__)
#include "wx/generic/treectrl.h"
#elif defined(__WXGTK__)
#include "wx/gtk/treectrl.h"
#include "wx/generic/treectrl.h"
#endif
#endif

View File

@@ -1 +1 @@
include ../../src/gtk/setup/general/makeapp
include ../../install/unix/setup/general/makeapp

View File

@@ -0,0 +1 @@
include ../../install/unix/setup/general/makeapp

View File

@@ -0,0 +1,26 @@
# WXXT base directory
WXBASEDIR=@WXBASEDIR@
# set the OS type for compilation
OS=@OS@
# compile a library only
RULE=bin
# define library name
BIN_TARGET=validate
# define library sources
BIN_SRC=\
validate.cpp
#define library objects
BIN_OBJ=\
validate.o
# additional things needed to link
BIN_LINK=
# additional things needed to compile
ADD_COMPILE=
# include the definitions now
include ../../../template.mak

View File

@@ -0,0 +1,44 @@
/* XPM */
static char *mondrian_xpm[] = {
/* columns rows colors chars-per-pixel */
"32 32 6 1",
" c Black",
". c Blue",
"X c #00bf00",
"o c Red",
"O c Yellow",
"+ c Gray100",
/* pixels */
" ",
" oooooo +++++++++++++++++++++++ ",
" oooooo +++++++++++++++++++++++ ",
" oooooo +++++++++++++++++++++++ ",
" oooooo +++++++++++++++++++++++ ",
" oooooo +++++++++++++++++++++++ ",
" oooooo +++++++++++++++++++++++ ",
" oooooo +++++++++++++++++++++++ ",
" ",
" ++++++ ++++++++++++++++++ .... ",
" ++++++ ++++++++++++++++++ .... ",
" ++++++ ++++++++++++++++++ .... ",
" ++++++ ++++++++++++++++++ .... ",
" ++++++ ++++++++++++++++++ .... ",
" ++++++ ++++++++++++++++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++ ",
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
" "
};

View File

@@ -82,7 +82,7 @@ void MyFrame::OnQuit(wxCommandEvent& event)
void MyFrame::OnTestDialog(wxCommandEvent& event)
{
MyDialog dialog(this, "Validation test dialog", wxPoint(100, 100), wxSize(340, 200));
MyDialog dialog(this, "Validation test dialog", wxPoint(100, 100), wxSize(340, 170));
dialog.ShowModal();
}
@@ -95,7 +95,7 @@ MyDialog::MyDialog(wxWindow *parent, const wxString& title, const wxPoint& pos,
wxButton *but2 = new wxButton(this, wxID_CANCEL, "Cancel", wxPoint(250, 60), wxSize(80, 30));
wxTextCtrl *txt1 = new wxTextCtrl(this, VALIDATE_TEXT, "",
wxPoint(10, 10), wxSize(100, -1), 0, wxTextValidator(wxFILTER_ALPHA, &g_data.m_string));
wxPoint(10, 10), wxSize(120, -1), 0, wxTextValidator(wxFILTER_ALPHA, &g_data.m_string));
// SetBackgroundColour(wxColour(0,0,255));

View File

@@ -24,7 +24,8 @@
#include <stdio.h>
#include "wx/textctrl.h"
#include "wx/utils.h"
#include "wx/msgbxdlg.h"
#include "wx/msgdlg.h"
#include "wx/intl.h"
#endif
#include "wx/valtext.h"

View File

@@ -62,7 +62,8 @@ wxGenericGrid::wxGenericGrid(void)
m_cellTextColour = *wxBLACK;
m_cellBackgroundColour = *wxWHITE;
m_labelTextColour = *wxBLACK;
m_labelBackgroundColour = *wxLIGHT_GREY;
// m_labelBackgroundColour = *wxLIGHT_GREY;
m_labelBackgroundColour = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
m_labelBackgroundBrush = NULL;
m_labelTextFont = NULL;
m_cellTextFont = NULL;
@@ -121,7 +122,8 @@ bool wxGenericGrid::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,
m_cellTextColour = *wxBLACK;
m_cellBackgroundColour = *wxWHITE;
m_labelTextColour = *wxBLACK;
m_labelBackgroundColour = *wxLIGHT_GREY;
// m_labelBackgroundColour = *wxLIGHT_GREY;
m_labelBackgroundColour = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
m_labelBackgroundBrush = NULL;
m_labelTextFont = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxBOLD);
m_cellTextFont = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL);
@@ -839,11 +841,17 @@ void wxGenericGrid::DrawCellBackground(wxDC *dc, wxRectangle *rect, int row, int
{
dc->SetBrush(*cell->GetBackgroundBrush());
dc->SetPen(*wxTRANSPARENT_PEN);
#ifdef 0 // In wxWin 2.0 the dc code is exact. RR.
#ifdef __WXMOTIF__
dc->DrawRectangle(rect->x+1, rect->y+1, rect->width-1, rect->height-1);
#else
dc->DrawRectangle(rect->x+1, rect->y+1, rect->width, rect->height);
#endif
#endif
dc->DrawRectangle(rect->x+1, rect->y+1, rect->width-1, rect->height-1);
dc->SetPen(*wxBLACK_PEN);
}
}
@@ -1008,7 +1016,7 @@ void wxGenericGrid::AdjustScrollbars(void)
*/
m_hScrollBar->SetScrollbar(m_hScrollBar->GetPosition(), wxMax(noHorizSteps, 1), nCols, wxMax(noHorizSteps, 1));
m_hScrollBar->SetSize(m_leftOfSheet, ch - m_scrollWidth,
m_hScrollBar->SetSize(m_leftOfSheet, ch - m_scrollWidth -2,
cw - vertScrollBarWidth - m_leftOfSheet, m_scrollWidth);
}
@@ -1370,8 +1378,9 @@ void wxGenericGrid::OnSelectCellImplementation(wxDC *dc, int row, int col)
// Why isn't this needed for Windows??
// Probably because of the SetValue??
// Arrrrrgh. This isn't needed anywhere, of course. RR.
#ifndef __WXMSW__
HighlightCell(dc);
// HighlightCell(dc);
#endif
dc->DestroyClippingRegion();
@@ -1427,16 +1436,27 @@ void wxGenericGrid::OnChangeSelectionLabel(void)
void wxGenericGrid::HighlightCell(wxDC *dc)
{
dc->SetLogicalFunction(wxINVERT);
// Top
dc->DrawLine(m_currentRect.x + 1, m_currentRect.y + 1, m_currentRect.x + m_currentRect.width - 1, m_currentRect.y + 1);
dc->DrawLine( m_currentRect.x + 1,
m_currentRect.y + 1,
m_currentRect.x + m_currentRect.width - 1,
m_currentRect.y + 1);
// Right
dc->DrawLine(m_currentRect.x + m_currentRect.width - 1, m_currentRect.y + 1,
m_currentRect.x + m_currentRect.width - 1, m_currentRect.y +m_currentRect.height - 1);
dc->DrawLine( m_currentRect.x + m_currentRect.width - 1,
m_currentRect.y + 1,
m_currentRect.x + m_currentRect.width - 1,
m_currentRect.y +m_currentRect.height - 1 );
// Bottom
dc->DrawLine(m_currentRect.x + m_currentRect.width - 1, m_currentRect.y + m_currentRect.height - 1,
m_currentRect.x + 1, m_currentRect.y + m_currentRect.height - 1);
dc->DrawLine( m_currentRect.x + m_currentRect.width - 1,
m_currentRect.y + m_currentRect.height - 1,
m_currentRect.x + 1,
m_currentRect.y + m_currentRect.height - 1);
// Left
dc->DrawLine(m_currentRect.x + 1, m_currentRect.y + m_currentRect.height - 1, m_currentRect.x + 1, m_currentRect.y + 1);
dc->DrawLine( m_currentRect.x + 1,
m_currentRect.y + m_currentRect.height - 1,
m_currentRect.x + 1,
m_currentRect.y + 1);
dc->SetLogicalFunction(wxCOPY);
}

View File

@@ -52,6 +52,7 @@ LIB_CPP_SRC=\
common/zstream.cpp \
common/objstrm.cpp \
common/validate.cpp \
common/valtext.cpp \
common/wxexpr.cpp \
\
gtk/app.cpp \
@@ -91,11 +92,11 @@ LIB_CPP_SRC=\
gtk/settings.cpp \
gtk/slider.cpp \
gtk/statbox.cpp \
gtk/statbmp.cpp \
gtk/stattext.cpp \
gtk/tbargtk.cpp \
gtk/textctrl.cpp \
gtk/timer.cpp \
gtk/treectrl.cpp \
gtk/utilsgtk.cpp \
gtk/utilsres.cpp \
gtk/window.cpp \
@@ -114,8 +115,9 @@ LIB_CPP_SRC=\
generic/splitter.cpp \
generic/statusbr.cpp \
generic/tabg.cpp \
generic/textdlgg.cpp
generic/textdlgg.cpp \
generic/treectrl.cpp
LIB_C_SRC=\
common/extended.c \

View File

@@ -91,7 +91,10 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
void wxBitmapButton::SetDefault(void)
{
/*
GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT );
gtk_widget_grab_default( m_widget );
*/
}
void wxBitmapButton::SetLabel( const wxString &label )
@@ -103,3 +106,21 @@ wxString wxBitmapButton::GetLabel(void) const
{
return wxControl::GetLabel();
}
void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap )
{
m_bitmap = bitmap;
if (!m_bitmap.Ok()) return;
GtkButton *bin = GTK_BUTTON( m_widget );
GtkPixmap *g_pixmap = GTK_PIXMAP( bin->child );
GdkBitmap *mask = NULL;
if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
gtk_pixmap_set( g_pixmap, m_bitmap.GetPixmap(), mask );
}

View File

@@ -79,7 +79,10 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
void wxButton::SetDefault(void)
{
/*
GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT );
gtk_widget_grab_default( m_widget );
*/
}
void wxButton::SetLabel( const wxString &label )

View File

@@ -92,7 +92,7 @@ wxPaintDC::wxPaintDC(void)
m_textGC = NULL;
m_bgGC = NULL;
m_cmap = NULL;
};
}
wxPaintDC::wxPaintDC( wxWindow *window )
{
@@ -120,21 +120,21 @@ wxPaintDC::wxPaintDC( wxWindow *window )
long y = 0;
window->GetDrawingOffset( &x, &y );
SetInternalDeviceOrigin( -x, -y );
};
}
wxPaintDC::~wxPaintDC(void)
{
};
}
void wxPaintDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1),
wxColour *WXUNUSED(col), int WXUNUSED(style) )
{
};
}
bool wxPaintDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
{
return FALSE;
};
}
void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 )
{
@@ -144,8 +144,8 @@ void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 )
{
gdk_draw_line( m_window, m_penGC,
XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
};
};
}
}
void wxPaintDC::CrossHair( long x, long y )
{
@@ -162,8 +162,8 @@ void wxPaintDC::CrossHair( long x, long y )
0, yy, XLOG2DEVREL(w), yy );
gdk_draw_line( m_window, m_penGC,
xx, 0, xx, YLOG2DEVREL(h) );
};
};
}
}
void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double yc )
{
@@ -199,7 +199,7 @@ void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double y
radius2 = (xx2 - xxc == 0) ?
(yy2 - yyc < 0) ? 90.0 : -90.0 :
-atan2(double(yy2-yyc), double(xx2-xxc)) * RAD2DEG;
};
}
long alpha1 = long(radius1 * 64.0);
long alpha2 = long((radius2 - radius1) * 64.0);
while (alpha2 <= 0) alpha2 += 360*64;
@@ -211,7 +211,7 @@ void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double y
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
};
}
void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
{
@@ -233,7 +233,7 @@ void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, start, end );
};
}
void wxPaintDC::DrawPoint( long x, long y )
{
@@ -241,7 +241,7 @@ void wxPaintDC::DrawPoint( long x, long y )
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
};
}
void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
{
@@ -256,8 +256,8 @@ void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
long y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste
long y2 = YLOG2DEV(points[i+1].y + yoffset);
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
};
};
}
}
void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
{
@@ -276,8 +276,8 @@ void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
long y2 = YLOG2DEV(npoint->y + yoffset);
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
node = node->Next();
};
};
}
}
void wxPaintDC::DrawPolygon( int n, wxPoint points[],
long xoffset, long yoffset, int WXUNUSED(fillStyle) )
@@ -302,7 +302,7 @@ void wxPaintDC::DrawPolygon( int n, wxPoint points[],
gdkpoints[(i+1)%n].x,
gdkpoints[(i+1)%n].y);
delete[] gdkpoints;
};
}
void wxPaintDC::DrawPolygon( wxList *lines, long xoffset,
long yoffset, int WXUNUSED(fillStyle))
@@ -335,7 +335,7 @@ void wxPaintDC::DrawPolygon( wxList *lines, long xoffset,
gdkpoints[(i+1)%n].y);
}
delete[] gdkpoints;
};
}
void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
{
@@ -358,7 +358,7 @@ void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
};
}
void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
{
@@ -410,7 +410,7 @@ void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, d
gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
};
}
if (m_pen.GetStyle() != wxTRANSPARENT)
{
@@ -422,8 +422,8 @@ void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, d
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
};
};
}
}
void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
{
@@ -443,12 +443,12 @@ void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 );
};
}
bool wxPaintDC::CanDrawBitmap(void) const
{
return TRUE;
};
}
void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
{
@@ -466,7 +466,7 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
{
gdk_gc_set_clip_mask( m_penGC, mask );
gdk_gc_set_clip_origin( m_penGC, xx, yy );
};
}
GdkPixmap *pm = icon.GetPixmap();
gdk_draw_pixmap( m_window, m_penGC, pm, 0, 0, xx, yy, -1, -1 );
@@ -475,8 +475,8 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
{
gdk_gc_set_clip_mask( m_penGC, NULL );
gdk_gc_set_clip_origin( m_penGC, 0, 0 );
};
};
}
}
bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool WXUNUSED(useMask) )
@@ -518,10 +518,9 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
*/
return TRUE;
};
}
void wxPaintDC::DrawText( const wxString &text, long x, long y, bool
WXUNUSED(use16) )
void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(use16) )
{
if (!Ok()) return;
@@ -551,14 +550,14 @@ WXUNUSED(use16) )
if (font->descent > 0) ul_y++;
gdk_draw_line( m_window, m_textGC, x, ul_y, x + width, ul_y);
}
};
}
bool wxPaintDC::CanGetTextExtent(void) const
{
return TRUE;
};
}
void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height,
long *WXUNUSED(descent), long *WXUNUSED(externalLeading),
@@ -569,7 +568,7 @@ void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height
GdkFont *font = m_font.GetInternalFont( m_scaleY );
if (width) (*width) = long(gdk_string_width( font, string ) / m_scaleX);
if (height) (*height) = long((font->ascent + font->descent) / m_scaleY);
};
}
long wxPaintDC::GetCharWidth(void)
{
@@ -577,7 +576,7 @@ long wxPaintDC::GetCharWidth(void)
GdkFont *font = m_font.GetInternalFont( m_scaleY );
return gdk_string_width( font, "H" );
};
}
long wxPaintDC::GetCharHeight(void)
{
@@ -585,7 +584,7 @@ long wxPaintDC::GetCharHeight(void)
GdkFont *font = m_font.GetInternalFont( m_scaleY );
return font->ascent + font->descent;
};
}
void wxPaintDC::Clear(void)
{
@@ -603,15 +602,15 @@ void wxPaintDC::Clear(void)
int height = 0;
GetSize( &width, &height );
gdk_draw_rectangle( m_window, m_bgGC, TRUE, 0, 0, width, height );
};
};
}
}
void wxPaintDC::SetFont( const wxFont &font )
{
if (!Ok()) return;
m_font = font;
};
}
void wxPaintDC::SetPen( const wxPen &pen )
{
@@ -640,34 +639,34 @@ void wxPaintDC::SetPen( const wxPen &pen )
GdkLineStyle lineStyle = GDK_LINE_SOLID;
switch (m_pen.GetStyle())
{
case wxSOLID: { lineStyle = GDK_LINE_SOLID; break; };
case wxDOT: { lineStyle = GDK_LINE_ON_OFF_DASH; break; };
case wxLONG_DASH: { lineStyle = GDK_LINE_ON_OFF_DASH; break; };
case wxSHORT_DASH: { lineStyle = GDK_LINE_ON_OFF_DASH; break; };
case wxDOT_DASH: { lineStyle = GDK_LINE_DOUBLE_DASH; break; };
};
case wxSOLID: { lineStyle = GDK_LINE_SOLID; break; }
case wxDOT: { lineStyle = GDK_LINE_ON_OFF_DASH; break; }
case wxLONG_DASH: { lineStyle = GDK_LINE_ON_OFF_DASH; break; }
case wxSHORT_DASH: { lineStyle = GDK_LINE_ON_OFF_DASH; break; }
case wxDOT_DASH: { lineStyle = GDK_LINE_DOUBLE_DASH; break; }
}
GdkCapStyle capStyle = GDK_CAP_ROUND;
switch (m_pen.GetCap())
{
case wxCAP_ROUND: { capStyle = (width <= 1) ? GDK_CAP_NOT_LAST : GDK_CAP_ROUND; break; };
case wxCAP_PROJECTING: { capStyle = GDK_CAP_PROJECTING; break; };
case wxCAP_BUTT: { capStyle = GDK_CAP_BUTT; break; };
};
case wxCAP_ROUND: { capStyle = (width <= 1) ? GDK_CAP_NOT_LAST : GDK_CAP_ROUND; break; }
case wxCAP_PROJECTING: { capStyle = GDK_CAP_PROJECTING; break; }
case wxCAP_BUTT: { capStyle = GDK_CAP_BUTT; break; }
}
GdkJoinStyle joinStyle = GDK_JOIN_ROUND;
switch (m_pen.GetJoin())
{
case wxJOIN_BEVEL: { joinStyle = GDK_JOIN_BEVEL; break; };
case wxJOIN_ROUND: { joinStyle = GDK_JOIN_ROUND; break; };
case wxJOIN_MITER: { joinStyle = GDK_JOIN_MITER; break; };
};
case wxJOIN_BEVEL: { joinStyle = GDK_JOIN_BEVEL; break; }
case wxJOIN_ROUND: { joinStyle = GDK_JOIN_ROUND; break; }
case wxJOIN_MITER: { joinStyle = GDK_JOIN_MITER; break; }
}
gdk_gc_set_line_attributes( m_penGC, width, lineStyle, capStyle, joinStyle );
m_pen.GetColour().CalcPixel( m_cmap );
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
};
}
void wxPaintDC::SetBrush( const wxBrush &brush )
{
@@ -690,21 +689,21 @@ void wxPaintDC::SetBrush( const wxBrush &brush )
break;
default:
fillStyle = GDK_STIPPLED;
};
}
gdk_gc_set_fill( m_brushGC, fillStyle );
if (m_brush.GetStyle() == wxSTIPPLE)
{
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetPixmap() );
};
}
if (IS_HATCH(m_brush.GetStyle()))
{
int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH;
gdk_gc_set_stipple( m_brushGC, hatches[num] );
};
};
}
}
// CMB 21/7/98: Added SetBackground. Sets background brush
// for Clear() and bg colour for shapes filled with cross-hatch brush
@@ -730,21 +729,21 @@ void wxPaintDC::SetBackground( const wxBrush &brush )
break;
default:
fillStyle = GDK_STIPPLED;
};
}
gdk_gc_set_fill( m_bgGC, fillStyle );
if (m_backgroundBrush.GetStyle() == wxSTIPPLE)
{
gdk_gc_set_stipple( m_bgGC, m_backgroundBrush.GetStipple()->GetPixmap() );
};
}
if (IS_HATCH(m_backgroundBrush.GetStyle()))
{
int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH;
gdk_gc_set_stipple( m_bgGC, hatches[num] );
};
};
}
}
void wxPaintDC::SetLogicalFunction( int function )
{
@@ -755,11 +754,11 @@ void wxPaintDC::SetLogicalFunction( int function )
case wxXOR: mode = GDK_INVERT; break;
case wxINVERT: mode = GDK_INVERT; break;
default: break;
};
}
m_logicalFunction = function;
gdk_gc_set_function( m_penGC, mode );
gdk_gc_set_function( m_brushGC, mode );
};
}
void wxPaintDC::SetTextForeground( const wxColour &col )
{
@@ -772,7 +771,7 @@ void wxPaintDC::SetTextForeground( const wxColour &col )
m_textForegroundColour.CalcPixel( m_cmap );
gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() );
};
}
void wxPaintDC::SetTextBackground( const wxColour &col )
{
@@ -785,7 +784,7 @@ void wxPaintDC::SetTextBackground( const wxColour &col )
m_textBackgroundColour.CalcPixel( m_cmap );
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
};
}
void wxPaintDC::SetBackgroundMode( int mode )
{
@@ -798,11 +797,11 @@ void wxPaintDC::SetBackgroundMode( int mode )
gdk_gc_set_fill( m_brushGC,
(m_backgroundMode == wxTRANSPARENT) ? GDK_STIPPLED : GDK_OPAQUE_STIPPLED);
}
};
}
void wxPaintDC::SetPalette( const wxPalette& WXUNUSED(palette) )
{
};
}
void wxPaintDC::SetClippingRegion( long x, long y, long width, long height )
{
@@ -811,14 +810,14 @@ void wxPaintDC::SetClippingRegion( long x, long y, long width, long height )
GdkRectangle rect;
rect.x = XLOG2DEV(x);
rect.y = YLOG2DEV(y);
rect.width = XLOG2DEV(x+width);
rect.height = YLOG2DEV(y+height);
rect.width = XLOG2DEVREL(width);
rect.height = YLOG2DEVREL(height);
gdk_gc_set_clip_rectangle( m_penGC, &rect );
gdk_gc_set_clip_rectangle( m_brushGC, &rect );
gdk_gc_set_clip_rectangle( m_textGC, &rect );
gdk_gc_set_clip_rectangle( m_bgGC, &rect );
};
}
void wxPaintDC::DestroyClippingRegion(void)
{
@@ -828,7 +827,7 @@ void wxPaintDC::DestroyClippingRegion(void)
gdk_gc_set_clip_rectangle( m_brushGC, NULL );
gdk_gc_set_clip_rectangle( m_textGC, NULL );
gdk_gc_set_clip_rectangle( m_bgGC, NULL );
};
}
void wxPaintDC::SetUpDC(void)
{
@@ -859,13 +858,13 @@ void wxPaintDC::SetUpDC(void)
hatch_bitmap[3] = gdk_bitmap_create_from_data( NULL, cross_bits, cross_width, cross_height );
hatch_bitmap[4] = gdk_bitmap_create_from_data( NULL, horiz_bits, horiz_width, horiz_height );
hatch_bitmap[5] = gdk_bitmap_create_from_data( NULL, verti_bits, verti_width, verti_height );
};
};
}
}
GdkWindow *wxPaintDC::GetWindow(void)
{
return m_window;
};
}
// ----------------------------------- spline code ----------------------------------------
@@ -1030,4 +1029,4 @@ void wxPaintDC::DrawOpenSpline( wxList *points )
wx_spline_add_point( x2, y2 );
wx_spline_draw_point_array( this );
};
}

View File

@@ -43,7 +43,7 @@ bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED
//-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxDialog,wxWindow)
EVT_BUTTON (wxID_OK, wxDialog::OnOk)
EVT_BUTTON (wxID_OK, wxDialog::OnOK)
EVT_BUTTON (wxID_CANCEL, wxDialog::OnCancel)
EVT_BUTTON (wxID_APPLY, wxDialog::OnApply)
EVT_CLOSE (wxDialog::OnCloseWindow)
@@ -93,6 +93,11 @@ bool wxDialog::Create( wxWindow *parent,
SetTitle( title );
if ((m_x != -1) || (m_y != -1))
gtk_widget_set_uposition( m_widget, m_x, m_y );
gtk_widget_set_usize( m_widget, m_width, m_height );
PostCreation();
return TRUE;
@@ -134,7 +139,7 @@ void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) )
};
};
void wxDialog::OnOk( wxCommandEvent &WXUNUSED(event) )
void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) )
{
if ( Validate() && TransferDataFromWindow())
{
@@ -187,6 +192,19 @@ void wxDialog::OnCloseWindow(wxCloseEvent& event)
};
};
void wxDialog::ImplementSetPosition(void)
{
if ((m_x != -1) || (m_y != -1))
gtk_widget_set_uposition( m_widget, m_x, m_y );
}
void wxDialog::Centre( int direction )
{
if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2;
ImplementSetPosition();
}
bool wxDialog::Show( bool show )
{
if (!show && IsModal() && m_modalShowing)

View File

@@ -36,7 +36,7 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), gpointer data )
return;
}
dialog->OnOk( event );
dialog->OnOK( event );
};
void gtk_filedialog_cancel_callback( GtkWidget *WXUNUSED(widget), gpointer data )

View File

@@ -211,6 +211,19 @@ bool wxFrame::Destroy()
return TRUE;
}
void wxFrame::ImplementSetPosition(void)
{
if ((m_x != -1) || (m_y != -1))
gtk_widget_set_uposition( m_widget, m_x, m_y );
}
void wxFrame::Centre( int direction )
{
if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2;
ImplementSetPosition();
}
void wxFrame::GetClientSize( int *width, int *height ) const
{
wxWindow::GetClientSize( width, height );

View File

@@ -147,12 +147,22 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
clientData, helpString1, helpString2 );
GdkPixmap *pixmap = bitmap.GetPixmap();
GtkWidget *tool_pixmap = NULL;
wxCHECK_MSG( bitmap.GetBitmap() == NULL, (wxToolBarTool *)NULL, "wxToolBar doesn't support GdkBitmap" )
wxCHECK_MSG( bitmap.GetPixmap() != NULL, (wxToolBarTool *)NULL, "wxToolBar::Add needs a wxBitmap" )
if (TRUE)
{
GdkPixmap *pixmap = bitmap.GetPixmap();
GdkBitmap *mask = NULL;
if (bitmap.GetMask()) mask = bitmap.GetMask()->GetBitmap();
GtkWidget *tool_pixmap = gtk_pixmap_new( pixmap, mask );
GdkBitmap *mask = NULL;
if (bitmap.GetMask()) mask = bitmap.GetMask()->GetBitmap();
tool_pixmap = gtk_pixmap_new( pixmap, mask );
}
gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
GtkToolbarChildType ctype = GTK_TOOLBAR_CHILD_BUTTON;

View File

@@ -25,11 +25,16 @@ IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl)
static void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
{
win->SetModified();
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId );
wxString val( win->GetValue() );
if (!val.IsNull()) event.m_commandString = WXSTRINGCAST val;
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
}
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
// EVT_CHAR(wxTextCtrl::OnChar)
EVT_CHAR(wxTextCtrl::OnChar)
END_EVENT_TABLE()
wxTextCtrl::wxTextCtrl(void) : streambuf()
@@ -77,7 +82,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
0, 0);
// put the horizontal scrollbar in the lower left hand corner
if ( bHasHScrollbar ) {
if (bHasHScrollbar)
{
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
GTK_EXPAND | GTK_FILL,
@@ -92,9 +98,10 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
GTK_FILL,
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
0, 0);
gtk_widget_show(vscrollbar);
gtk_widget_show( vscrollbar );
}
else {
else
{
// a single-line text control: no need for scrollbars
m_widget =
m_text = gtk_entry_new();
@@ -107,7 +114,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
PostCreation();
if ( bMultiLine ) {
if (bMultiLine)
{
gtk_widget_realize(m_text);
gtk_widget_show(m_text);
}
@@ -128,7 +136,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
}
else
{
if ( bMultiLine )
if (bMultiLine)
gtk_text_set_editable( GTK_TEXT(m_text), 1 );
}
@@ -306,8 +314,25 @@ void wxTextCtrl::Delete(void)
SetValue( "" );
}
void wxTextCtrl::OnChar( wxKeyEvent &WXUNUSED(event) )
void wxTextCtrl::OnChar( wxKeyEvent &key_event )
{
if ((key_event.KeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER))
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
event.SetEventObject(this);
printf( "Hallo.\n" );
if (GetEventHandler()->ProcessEvent(event)) return;
}
else if (key_event.KeyCode() == WXK_TAB)
{
wxNavigationKeyEvent event;
event.SetDirection( key_event.m_shiftDown );
event.SetWindowChange(FALSE);
event.SetEventObject(this);
if (GetEventHandler()->ProcessEvent(event)) return;
}
key_event.Skip();
}
int wxTextCtrl::overflow( int WXUNUSED(c) )
@@ -392,6 +417,13 @@ GtkWidget* wxTextCtrl::GetConnectWidget(void)
return GTK_WIDGET(m_text);
}
bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
{
if (m_windowStyle & wxTE_MULTILINE)
return (window == GTK_TEXT(m_text)->text_area);
else
return (window == GTK_ENTRY(m_text)->text_area);
}

View File

@@ -29,7 +29,6 @@
#include "wx/notebook.h"
#include "wx/statusbr.h"
#include <wx/intl.h>
//#include "wx/treectrl.h"
#include "gdk/gdkkeysyms.h"
#include <math.h>
#include "wx/gtk/win_gtk.h"
@@ -272,9 +271,10 @@ gint gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), GdkEventKey *gd
//-----------------------------------------------------------------------------
// button_press
gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
if (widget->window != gdk_event->window) return TRUE;
gint gtk_window_button_press_callback( GtkWidget *WXUNUSED(widget), GdkEventButton *gdk_event, wxWindow *win )
{
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if (g_blockEventsOnDrag) return TRUE;
if (win->m_wxwindow)
@@ -353,10 +353,9 @@ gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_ev
//-----------------------------------------------------------------------------
// button_release
gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
gint gtk_window_button_release_callback( GtkWidget *WXUNUSED(widget), GdkEventButton *gdk_event, wxWindow *win )
{
if (widget->window != gdk_event->window) return TRUE;
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE;
@@ -397,10 +396,9 @@ gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_
//-----------------------------------------------------------------------------
// motion_notify
gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
gint gtk_window_motion_notify_callback( GtkWidget *WXUNUSED(widget), GdkEventMotion *gdk_event, wxWindow *win )
{
if (widget->window != gdk_event->window) return TRUE;
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE;
@@ -1077,7 +1075,7 @@ void wxWindow::ImplementSetPosition(void)
if (!m_parent)
{
printf( _("wxWindow::SetSize error.\n") );
wxFAIL_MSG( _("wxWindow::SetSize error.\n") );
return;
}
@@ -1812,6 +1810,12 @@ GtkWidget* wxWindow::GetConnectWidget(void)
return connect_widget;
}
bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
{
if (m_wxwindow) return (window == m_wxwindow->window);
return (window == m_widget->window);
}
void wxWindow::SetFont( const wxFont &font )
{
m_font = font;

View File

@@ -91,7 +91,10 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
void wxBitmapButton::SetDefault(void)
{
/*
GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT );
gtk_widget_grab_default( m_widget );
*/
}
void wxBitmapButton::SetLabel( const wxString &label )
@@ -103,3 +106,21 @@ wxString wxBitmapButton::GetLabel(void) const
{
return wxControl::GetLabel();
}
void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap )
{
m_bitmap = bitmap;
if (!m_bitmap.Ok()) return;
GtkButton *bin = GTK_BUTTON( m_widget );
GtkPixmap *g_pixmap = GTK_PIXMAP( bin->child );
GdkBitmap *mask = NULL;
if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
gtk_pixmap_set( g_pixmap, m_bitmap.GetPixmap(), mask );
}

View File

@@ -79,7 +79,10 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
void wxButton::SetDefault(void)
{
/*
GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT );
gtk_widget_grab_default( m_widget );
*/
}
void wxButton::SetLabel( const wxString &label )

View File

@@ -92,7 +92,7 @@ wxPaintDC::wxPaintDC(void)
m_textGC = NULL;
m_bgGC = NULL;
m_cmap = NULL;
};
}
wxPaintDC::wxPaintDC( wxWindow *window )
{
@@ -120,21 +120,21 @@ wxPaintDC::wxPaintDC( wxWindow *window )
long y = 0;
window->GetDrawingOffset( &x, &y );
SetInternalDeviceOrigin( -x, -y );
};
}
wxPaintDC::~wxPaintDC(void)
{
};
}
void wxPaintDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1),
wxColour *WXUNUSED(col), int WXUNUSED(style) )
{
};
}
bool wxPaintDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
{
return FALSE;
};
}
void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 )
{
@@ -144,8 +144,8 @@ void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 )
{
gdk_draw_line( m_window, m_penGC,
XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
};
};
}
}
void wxPaintDC::CrossHair( long x, long y )
{
@@ -162,8 +162,8 @@ void wxPaintDC::CrossHair( long x, long y )
0, yy, XLOG2DEVREL(w), yy );
gdk_draw_line( m_window, m_penGC,
xx, 0, xx, YLOG2DEVREL(h) );
};
};
}
}
void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double yc )
{
@@ -199,7 +199,7 @@ void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double y
radius2 = (xx2 - xxc == 0) ?
(yy2 - yyc < 0) ? 90.0 : -90.0 :
-atan2(double(yy2-yyc), double(xx2-xxc)) * RAD2DEG;
};
}
long alpha1 = long(radius1 * 64.0);
long alpha2 = long((radius2 - radius1) * 64.0);
while (alpha2 <= 0) alpha2 += 360*64;
@@ -211,7 +211,7 @@ void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double y
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
};
}
void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
{
@@ -233,7 +233,7 @@ void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, start, end );
};
}
void wxPaintDC::DrawPoint( long x, long y )
{
@@ -241,7 +241,7 @@ void wxPaintDC::DrawPoint( long x, long y )
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
};
}
void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
{
@@ -256,8 +256,8 @@ void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
long y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste
long y2 = YLOG2DEV(points[i+1].y + yoffset);
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
};
};
}
}
void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
{
@@ -276,8 +276,8 @@ void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
long y2 = YLOG2DEV(npoint->y + yoffset);
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
node = node->Next();
};
};
}
}
void wxPaintDC::DrawPolygon( int n, wxPoint points[],
long xoffset, long yoffset, int WXUNUSED(fillStyle) )
@@ -302,7 +302,7 @@ void wxPaintDC::DrawPolygon( int n, wxPoint points[],
gdkpoints[(i+1)%n].x,
gdkpoints[(i+1)%n].y);
delete[] gdkpoints;
};
}
void wxPaintDC::DrawPolygon( wxList *lines, long xoffset,
long yoffset, int WXUNUSED(fillStyle))
@@ -335,7 +335,7 @@ void wxPaintDC::DrawPolygon( wxList *lines, long xoffset,
gdkpoints[(i+1)%n].y);
}
delete[] gdkpoints;
};
}
void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
{
@@ -358,7 +358,7 @@ void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
};
}
void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
{
@@ -410,7 +410,7 @@ void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, d
gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
};
}
if (m_pen.GetStyle() != wxTRANSPARENT)
{
@@ -422,8 +422,8 @@ void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, d
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
};
};
}
}
void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
{
@@ -443,12 +443,12 @@ void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 );
};
}
bool wxPaintDC::CanDrawBitmap(void) const
{
return TRUE;
};
}
void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
{
@@ -466,7 +466,7 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
{
gdk_gc_set_clip_mask( m_penGC, mask );
gdk_gc_set_clip_origin( m_penGC, xx, yy );
};
}
GdkPixmap *pm = icon.GetPixmap();
gdk_draw_pixmap( m_window, m_penGC, pm, 0, 0, xx, yy, -1, -1 );
@@ -475,8 +475,8 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
{
gdk_gc_set_clip_mask( m_penGC, NULL );
gdk_gc_set_clip_origin( m_penGC, 0, 0 );
};
};
}
}
bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool WXUNUSED(useMask) )
@@ -518,10 +518,9 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
*/
return TRUE;
};
}
void wxPaintDC::DrawText( const wxString &text, long x, long y, bool
WXUNUSED(use16) )
void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(use16) )
{
if (!Ok()) return;
@@ -551,14 +550,14 @@ WXUNUSED(use16) )
if (font->descent > 0) ul_y++;
gdk_draw_line( m_window, m_textGC, x, ul_y, x + width, ul_y);
}
};
}
bool wxPaintDC::CanGetTextExtent(void) const
{
return TRUE;
};
}
void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height,
long *WXUNUSED(descent), long *WXUNUSED(externalLeading),
@@ -569,7 +568,7 @@ void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height
GdkFont *font = m_font.GetInternalFont( m_scaleY );
if (width) (*width) = long(gdk_string_width( font, string ) / m_scaleX);
if (height) (*height) = long((font->ascent + font->descent) / m_scaleY);
};
}
long wxPaintDC::GetCharWidth(void)
{
@@ -577,7 +576,7 @@ long wxPaintDC::GetCharWidth(void)
GdkFont *font = m_font.GetInternalFont( m_scaleY );
return gdk_string_width( font, "H" );
};
}
long wxPaintDC::GetCharHeight(void)
{
@@ -585,7 +584,7 @@ long wxPaintDC::GetCharHeight(void)
GdkFont *font = m_font.GetInternalFont( m_scaleY );
return font->ascent + font->descent;
};
}
void wxPaintDC::Clear(void)
{
@@ -603,15 +602,15 @@ void wxPaintDC::Clear(void)
int height = 0;
GetSize( &width, &height );
gdk_draw_rectangle( m_window, m_bgGC, TRUE, 0, 0, width, height );
};
};
}
}
void wxPaintDC::SetFont( const wxFont &font )
{
if (!Ok()) return;
m_font = font;
};
}
void wxPaintDC::SetPen( const wxPen &pen )
{
@@ -640,34 +639,34 @@ void wxPaintDC::SetPen( const wxPen &pen )
GdkLineStyle lineStyle = GDK_LINE_SOLID;
switch (m_pen.GetStyle())
{
case wxSOLID: { lineStyle = GDK_LINE_SOLID; break; };
case wxDOT: { lineStyle = GDK_LINE_ON_OFF_DASH; break; };
case wxLONG_DASH: { lineStyle = GDK_LINE_ON_OFF_DASH; break; };
case wxSHORT_DASH: { lineStyle = GDK_LINE_ON_OFF_DASH; break; };
case wxDOT_DASH: { lineStyle = GDK_LINE_DOUBLE_DASH; break; };
};
case wxSOLID: { lineStyle = GDK_LINE_SOLID; break; }
case wxDOT: { lineStyle = GDK_LINE_ON_OFF_DASH; break; }
case wxLONG_DASH: { lineStyle = GDK_LINE_ON_OFF_DASH; break; }
case wxSHORT_DASH: { lineStyle = GDK_LINE_ON_OFF_DASH; break; }
case wxDOT_DASH: { lineStyle = GDK_LINE_DOUBLE_DASH; break; }
}
GdkCapStyle capStyle = GDK_CAP_ROUND;
switch (m_pen.GetCap())
{
case wxCAP_ROUND: { capStyle = (width <= 1) ? GDK_CAP_NOT_LAST : GDK_CAP_ROUND; break; };
case wxCAP_PROJECTING: { capStyle = GDK_CAP_PROJECTING; break; };
case wxCAP_BUTT: { capStyle = GDK_CAP_BUTT; break; };
};
case wxCAP_ROUND: { capStyle = (width <= 1) ? GDK_CAP_NOT_LAST : GDK_CAP_ROUND; break; }
case wxCAP_PROJECTING: { capStyle = GDK_CAP_PROJECTING; break; }
case wxCAP_BUTT: { capStyle = GDK_CAP_BUTT; break; }
}
GdkJoinStyle joinStyle = GDK_JOIN_ROUND;
switch (m_pen.GetJoin())
{
case wxJOIN_BEVEL: { joinStyle = GDK_JOIN_BEVEL; break; };
case wxJOIN_ROUND: { joinStyle = GDK_JOIN_ROUND; break; };
case wxJOIN_MITER: { joinStyle = GDK_JOIN_MITER; break; };
};
case wxJOIN_BEVEL: { joinStyle = GDK_JOIN_BEVEL; break; }
case wxJOIN_ROUND: { joinStyle = GDK_JOIN_ROUND; break; }
case wxJOIN_MITER: { joinStyle = GDK_JOIN_MITER; break; }
}
gdk_gc_set_line_attributes( m_penGC, width, lineStyle, capStyle, joinStyle );
m_pen.GetColour().CalcPixel( m_cmap );
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
};
}
void wxPaintDC::SetBrush( const wxBrush &brush )
{
@@ -690,21 +689,21 @@ void wxPaintDC::SetBrush( const wxBrush &brush )
break;
default:
fillStyle = GDK_STIPPLED;
};
}
gdk_gc_set_fill( m_brushGC, fillStyle );
if (m_brush.GetStyle() == wxSTIPPLE)
{
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetPixmap() );
};
}
if (IS_HATCH(m_brush.GetStyle()))
{
int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH;
gdk_gc_set_stipple( m_brushGC, hatches[num] );
};
};
}
}
// CMB 21/7/98: Added SetBackground. Sets background brush
// for Clear() and bg colour for shapes filled with cross-hatch brush
@@ -730,21 +729,21 @@ void wxPaintDC::SetBackground( const wxBrush &brush )
break;
default:
fillStyle = GDK_STIPPLED;
};
}
gdk_gc_set_fill( m_bgGC, fillStyle );
if (m_backgroundBrush.GetStyle() == wxSTIPPLE)
{
gdk_gc_set_stipple( m_bgGC, m_backgroundBrush.GetStipple()->GetPixmap() );
};
}
if (IS_HATCH(m_backgroundBrush.GetStyle()))
{
int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH;
gdk_gc_set_stipple( m_bgGC, hatches[num] );
};
};
}
}
void wxPaintDC::SetLogicalFunction( int function )
{
@@ -755,11 +754,11 @@ void wxPaintDC::SetLogicalFunction( int function )
case wxXOR: mode = GDK_INVERT; break;
case wxINVERT: mode = GDK_INVERT; break;
default: break;
};
}
m_logicalFunction = function;
gdk_gc_set_function( m_penGC, mode );
gdk_gc_set_function( m_brushGC, mode );
};
}
void wxPaintDC::SetTextForeground( const wxColour &col )
{
@@ -772,7 +771,7 @@ void wxPaintDC::SetTextForeground( const wxColour &col )
m_textForegroundColour.CalcPixel( m_cmap );
gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() );
};
}
void wxPaintDC::SetTextBackground( const wxColour &col )
{
@@ -785,7 +784,7 @@ void wxPaintDC::SetTextBackground( const wxColour &col )
m_textBackgroundColour.CalcPixel( m_cmap );
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
};
}
void wxPaintDC::SetBackgroundMode( int mode )
{
@@ -798,11 +797,11 @@ void wxPaintDC::SetBackgroundMode( int mode )
gdk_gc_set_fill( m_brushGC,
(m_backgroundMode == wxTRANSPARENT) ? GDK_STIPPLED : GDK_OPAQUE_STIPPLED);
}
};
}
void wxPaintDC::SetPalette( const wxPalette& WXUNUSED(palette) )
{
};
}
void wxPaintDC::SetClippingRegion( long x, long y, long width, long height )
{
@@ -811,14 +810,14 @@ void wxPaintDC::SetClippingRegion( long x, long y, long width, long height )
GdkRectangle rect;
rect.x = XLOG2DEV(x);
rect.y = YLOG2DEV(y);
rect.width = XLOG2DEV(x+width);
rect.height = YLOG2DEV(y+height);
rect.width = XLOG2DEVREL(width);
rect.height = YLOG2DEVREL(height);
gdk_gc_set_clip_rectangle( m_penGC, &rect );
gdk_gc_set_clip_rectangle( m_brushGC, &rect );
gdk_gc_set_clip_rectangle( m_textGC, &rect );
gdk_gc_set_clip_rectangle( m_bgGC, &rect );
};
}
void wxPaintDC::DestroyClippingRegion(void)
{
@@ -828,7 +827,7 @@ void wxPaintDC::DestroyClippingRegion(void)
gdk_gc_set_clip_rectangle( m_brushGC, NULL );
gdk_gc_set_clip_rectangle( m_textGC, NULL );
gdk_gc_set_clip_rectangle( m_bgGC, NULL );
};
}
void wxPaintDC::SetUpDC(void)
{
@@ -859,13 +858,13 @@ void wxPaintDC::SetUpDC(void)
hatch_bitmap[3] = gdk_bitmap_create_from_data( NULL, cross_bits, cross_width, cross_height );
hatch_bitmap[4] = gdk_bitmap_create_from_data( NULL, horiz_bits, horiz_width, horiz_height );
hatch_bitmap[5] = gdk_bitmap_create_from_data( NULL, verti_bits, verti_width, verti_height );
};
};
}
}
GdkWindow *wxPaintDC::GetWindow(void)
{
return m_window;
};
}
// ----------------------------------- spline code ----------------------------------------
@@ -1030,4 +1029,4 @@ void wxPaintDC::DrawOpenSpline( wxList *points )
wx_spline_add_point( x2, y2 );
wx_spline_draw_point_array( this );
};
}

View File

@@ -43,7 +43,7 @@ bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED
//-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxDialog,wxWindow)
EVT_BUTTON (wxID_OK, wxDialog::OnOk)
EVT_BUTTON (wxID_OK, wxDialog::OnOK)
EVT_BUTTON (wxID_CANCEL, wxDialog::OnCancel)
EVT_BUTTON (wxID_APPLY, wxDialog::OnApply)
EVT_CLOSE (wxDialog::OnCloseWindow)
@@ -93,6 +93,11 @@ bool wxDialog::Create( wxWindow *parent,
SetTitle( title );
if ((m_x != -1) || (m_y != -1))
gtk_widget_set_uposition( m_widget, m_x, m_y );
gtk_widget_set_usize( m_widget, m_width, m_height );
PostCreation();
return TRUE;
@@ -134,7 +139,7 @@ void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) )
};
};
void wxDialog::OnOk( wxCommandEvent &WXUNUSED(event) )
void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) )
{
if ( Validate() && TransferDataFromWindow())
{
@@ -187,6 +192,19 @@ void wxDialog::OnCloseWindow(wxCloseEvent& event)
};
};
void wxDialog::ImplementSetPosition(void)
{
if ((m_x != -1) || (m_y != -1))
gtk_widget_set_uposition( m_widget, m_x, m_y );
}
void wxDialog::Centre( int direction )
{
if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2;
ImplementSetPosition();
}
bool wxDialog::Show( bool show )
{
if (!show && IsModal() && m_modalShowing)

View File

@@ -36,7 +36,7 @@ void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), gpointer data )
return;
}
dialog->OnOk( event );
dialog->OnOK( event );
};
void gtk_filedialog_cancel_callback( GtkWidget *WXUNUSED(widget), gpointer data )

View File

@@ -211,6 +211,19 @@ bool wxFrame::Destroy()
return TRUE;
}
void wxFrame::ImplementSetPosition(void)
{
if ((m_x != -1) || (m_y != -1))
gtk_widget_set_uposition( m_widget, m_x, m_y );
}
void wxFrame::Centre( int direction )
{
if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2;
ImplementSetPosition();
}
void wxFrame::GetClientSize( int *width, int *height ) const
{
wxWindow::GetClientSize( width, height );

View File

@@ -147,12 +147,22 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
clientData, helpString1, helpString2 );
GdkPixmap *pixmap = bitmap.GetPixmap();
GtkWidget *tool_pixmap = NULL;
wxCHECK_MSG( bitmap.GetBitmap() == NULL, (wxToolBarTool *)NULL, "wxToolBar doesn't support GdkBitmap" )
wxCHECK_MSG( bitmap.GetPixmap() != NULL, (wxToolBarTool *)NULL, "wxToolBar::Add needs a wxBitmap" )
if (TRUE)
{
GdkPixmap *pixmap = bitmap.GetPixmap();
GdkBitmap *mask = NULL;
if (bitmap.GetMask()) mask = bitmap.GetMask()->GetBitmap();
GtkWidget *tool_pixmap = gtk_pixmap_new( pixmap, mask );
GdkBitmap *mask = NULL;
if (bitmap.GetMask()) mask = bitmap.GetMask()->GetBitmap();
tool_pixmap = gtk_pixmap_new( pixmap, mask );
}
gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
GtkToolbarChildType ctype = GTK_TOOLBAR_CHILD_BUTTON;

View File

@@ -25,11 +25,16 @@ IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl)
static void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
{
win->SetModified();
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId );
wxString val( win->GetValue() );
if (!val.IsNull()) event.m_commandString = WXSTRINGCAST val;
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
}
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
// EVT_CHAR(wxTextCtrl::OnChar)
EVT_CHAR(wxTextCtrl::OnChar)
END_EVENT_TABLE()
wxTextCtrl::wxTextCtrl(void) : streambuf()
@@ -77,7 +82,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
0, 0);
// put the horizontal scrollbar in the lower left hand corner
if ( bHasHScrollbar ) {
if (bHasHScrollbar)
{
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
GTK_EXPAND | GTK_FILL,
@@ -92,9 +98,10 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
GTK_FILL,
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
0, 0);
gtk_widget_show(vscrollbar);
gtk_widget_show( vscrollbar );
}
else {
else
{
// a single-line text control: no need for scrollbars
m_widget =
m_text = gtk_entry_new();
@@ -107,7 +114,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
PostCreation();
if ( bMultiLine ) {
if (bMultiLine)
{
gtk_widget_realize(m_text);
gtk_widget_show(m_text);
}
@@ -128,7 +136,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
}
else
{
if ( bMultiLine )
if (bMultiLine)
gtk_text_set_editable( GTK_TEXT(m_text), 1 );
}
@@ -306,8 +314,25 @@ void wxTextCtrl::Delete(void)
SetValue( "" );
}
void wxTextCtrl::OnChar( wxKeyEvent &WXUNUSED(event) )
void wxTextCtrl::OnChar( wxKeyEvent &key_event )
{
if ((key_event.KeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER))
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
event.SetEventObject(this);
printf( "Hallo.\n" );
if (GetEventHandler()->ProcessEvent(event)) return;
}
else if (key_event.KeyCode() == WXK_TAB)
{
wxNavigationKeyEvent event;
event.SetDirection( key_event.m_shiftDown );
event.SetWindowChange(FALSE);
event.SetEventObject(this);
if (GetEventHandler()->ProcessEvent(event)) return;
}
key_event.Skip();
}
int wxTextCtrl::overflow( int WXUNUSED(c) )
@@ -392,6 +417,13 @@ GtkWidget* wxTextCtrl::GetConnectWidget(void)
return GTK_WIDGET(m_text);
}
bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
{
if (m_windowStyle & wxTE_MULTILINE)
return (window == GTK_TEXT(m_text)->text_area);
else
return (window == GTK_ENTRY(m_text)->text_area);
}

View File

@@ -29,7 +29,6 @@
#include "wx/notebook.h"
#include "wx/statusbr.h"
#include <wx/intl.h>
//#include "wx/treectrl.h"
#include "gdk/gdkkeysyms.h"
#include <math.h>
#include "wx/gtk/win_gtk.h"
@@ -272,9 +271,10 @@ gint gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), GdkEventKey *gd
//-----------------------------------------------------------------------------
// button_press
gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
if (widget->window != gdk_event->window) return TRUE;
gint gtk_window_button_press_callback( GtkWidget *WXUNUSED(widget), GdkEventButton *gdk_event, wxWindow *win )
{
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if (g_blockEventsOnDrag) return TRUE;
if (win->m_wxwindow)
@@ -353,10 +353,9 @@ gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_ev
//-----------------------------------------------------------------------------
// button_release
gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
gint gtk_window_button_release_callback( GtkWidget *WXUNUSED(widget), GdkEventButton *gdk_event, wxWindow *win )
{
if (widget->window != gdk_event->window) return TRUE;
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE;
@@ -397,10 +396,9 @@ gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_
//-----------------------------------------------------------------------------
// motion_notify
gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
gint gtk_window_motion_notify_callback( GtkWidget *WXUNUSED(widget), GdkEventMotion *gdk_event, wxWindow *win )
{
if (widget->window != gdk_event->window) return TRUE;
if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
if (g_blockEventsOnDrag) return TRUE;
if (!win->HasVMT()) return TRUE;
@@ -1077,7 +1075,7 @@ void wxWindow::ImplementSetPosition(void)
if (!m_parent)
{
printf( _("wxWindow::SetSize error.\n") );
wxFAIL_MSG( _("wxWindow::SetSize error.\n") );
return;
}
@@ -1812,6 +1810,12 @@ GtkWidget* wxWindow::GetConnectWidget(void)
return connect_widget;
}
bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
{
if (m_wxwindow) return (window == m_wxwindow->window);
return (window == m_widget->window);
}
void wxWindow::SetFont( const wxFont &font )
{
m_font = font;

View File

@@ -1,46 +0,0 @@
#! /bin/sh
# create "/gtk" if not present
if test ! -d gtk; then
mkdir gtk
fi
# create "/qt" if not present
if test ! -d qt; then
mkdir qt
fi
# create "/motif" if not present
if test ! -d motif; then
mkdir motif
fi
# create "/common" if not present
if test ! -d common; then
mkdir common
fi
# create "/generic" if not present
if test ! -d generic; then
mkdir generic
fi
# create "/png" if not present
if test ! -d png; then
mkdir png
fi
# create "/zlib" if not present
if test ! -d zlib; then
mkdir zlib
fi
# create "/gdk_imlib" if not present
if test ! -d gdk_imlib; then
mkdir gdk_imlib
fi
# create "/iodbc" if not present
if test ! -d iodbc; then
mkdir iodbc
fi