#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
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:
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);
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()
};
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 );
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 );
// update frame's menus (called from OnIdle)
void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu);
+ virtual void ImplementSetPosition();
GtkWidget *m_mainWindow;
wxMenuBar *m_frameMenuBar;
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,
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__
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();
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,
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:
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);
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()
};
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 );
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 );
// update frame's menus (called from OnIdle)
void DoMenuUpdates();
void DoMenuUpdates(wxMenu* menu);
+ virtual void ImplementSetPosition();
GtkWidget *m_mainWindow;
wxMenuBar *m_frameMenuBar;
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,
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__
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();
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,
#elif defined(__WXMOTIF__)
#include "wx/generic/treectrl.h"
#elif defined(__WXGTK__)
-#include "wx/gtk/treectrl.h"
+#include "wx/generic/treectrl.h"
#endif
#endif
-include ../../src/gtk/setup/general/makeapp
+include ../../install/unix/setup/general/makeapp
--- /dev/null
+include ../../install/unix/setup/general/makeapp
--- /dev/null
+# 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
--- /dev/null
+/* 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 ++++ ",
+" "
+};
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();
}
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));
#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"
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;
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);
{
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);
}
}
*/
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);
}
// 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();
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);
}
common/zstream.cpp \
common/objstrm.cpp \
common/validate.cpp \
+ common/valtext.cpp \
common/wxexpr.cpp \
\
gtk/app.cpp \
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 \
generic/splitter.cpp \
generic/statusbr.cpp \
generic/tabg.cpp \
- generic/textdlgg.cpp
-
+ generic/textdlgg.cpp \
+ generic/treectrl.cpp
+
LIB_C_SRC=\
common/extended.c \
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 )
{
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 );
+}
+
+
+
+
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 )
m_textGC = NULL;
m_bgGC = NULL;
m_cmap = NULL;
-};
+}
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 )
{
{
gdk_draw_line( m_window, m_penGC,
XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
- };
-};
+ }
+}
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 )
{
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;
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 )
{
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 )
{
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 )
{
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 )
{
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) )
gdkpoints[(i+1)%n].x,
gdkpoints[(i+1)%n].y);
delete[] gdkpoints;
-};
+}
void wxPaintDC::DrawPolygon( wxList *lines, long xoffset,
long yoffset, int WXUNUSED(fillStyle))
gdkpoints[(i+1)%n].y);
}
delete[] gdkpoints;
-};
+}
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 )
{
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)
{
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 )
{
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 )
{
{
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 );
{
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) )
*/
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;
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),
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)
{
GdkFont *font = m_font.GetInternalFont( m_scaleY );
return gdk_string_width( font, "H" );
-};
+}
long wxPaintDC::GetCharHeight(void)
{
GdkFont *font = m_font.GetInternalFont( m_scaleY );
return font->ascent + font->descent;
-};
+}
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 )
{
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 )
{
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
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 )
{
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 )
{
m_textForegroundColour.CalcPixel( m_cmap );
gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() );
-};
+}
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 )
{
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 )
{
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)
{
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)
{
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 ----------------------------------------
wx_spline_add_point( x2, y2 );
wx_spline_draw_point_array( this );
-};
+}
//-----------------------------------------------------------------------------
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)
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;
};
};
-void wxDialog::OnOk( wxCommandEvent &WXUNUSED(event) )
+void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) )
{
if ( Validate() && TransferDataFromWindow())
{
};
};
+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)
return;
}
- dialog->OnOk( event );
+ dialog->OnOK( event );
};
void gtk_filedialog_cancel_callback( GtkWidget *WXUNUSED(widget), gpointer data )
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 );
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
clientData, helpString1, helpString2 );
- GdkPixmap *pixmap = bitmap.GetPixmap();
-
- GdkBitmap *mask = NULL;
- if (bitmap.GetMask()) mask = bitmap.GetMask()->GetBitmap();
+ 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();
- 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;
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()
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,
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();
PostCreation();
- if ( bMultiLine ) {
+ if (bMultiLine)
+ {
gtk_widget_realize(m_text);
gtk_widget_show(m_text);
}
}
else
{
- if ( bMultiLine )
+ if (bMultiLine)
gtk_text_set_editable( GTK_TEXT(m_text), 1 );
}
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) )
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);
+}
#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"
//-----------------------------------------------------------------------------
// 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)
//-----------------------------------------------------------------------------
// 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;
//-----------------------------------------------------------------------------
// 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;
if (!m_parent)
{
- printf( _("wxWindow::SetSize error.\n") );
+ wxFAIL_MSG( _("wxWindow::SetSize error.\n") );
return;
}
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;
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 )
{
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 );
+}
+
+
+
+
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 )
m_textGC = NULL;
m_bgGC = NULL;
m_cmap = NULL;
-};
+}
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 )
{
{
gdk_draw_line( m_window, m_penGC,
XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
- };
-};
+ }
+}
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 )
{
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;
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 )
{
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 )
{
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 )
{
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 )
{
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) )
gdkpoints[(i+1)%n].x,
gdkpoints[(i+1)%n].y);
delete[] gdkpoints;
-};
+}
void wxPaintDC::DrawPolygon( wxList *lines, long xoffset,
long yoffset, int WXUNUSED(fillStyle))
gdkpoints[(i+1)%n].y);
}
delete[] gdkpoints;
-};
+}
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 )
{
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)
{
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 )
{
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 )
{
{
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 );
{
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) )
*/
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;
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),
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)
{
GdkFont *font = m_font.GetInternalFont( m_scaleY );
return gdk_string_width( font, "H" );
-};
+}
long wxPaintDC::GetCharHeight(void)
{
GdkFont *font = m_font.GetInternalFont( m_scaleY );
return font->ascent + font->descent;
-};
+}
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 )
{
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 )
{
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
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 )
{
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 )
{
m_textForegroundColour.CalcPixel( m_cmap );
gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() );
-};
+}
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 )
{
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 )
{
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)
{
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)
{
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 ----------------------------------------
wx_spline_add_point( x2, y2 );
wx_spline_draw_point_array( this );
-};
+}
//-----------------------------------------------------------------------------
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)
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;
};
};
-void wxDialog::OnOk( wxCommandEvent &WXUNUSED(event) )
+void wxDialog::OnOK( wxCommandEvent &WXUNUSED(event) )
{
if ( Validate() && TransferDataFromWindow())
{
};
};
+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)
return;
}
- dialog->OnOk( event );
+ dialog->OnOK( event );
};
void gtk_filedialog_cancel_callback( GtkWidget *WXUNUSED(widget), gpointer data )
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 );
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
clientData, helpString1, helpString2 );
- GdkPixmap *pixmap = bitmap.GetPixmap();
-
- GdkBitmap *mask = NULL;
- if (bitmap.GetMask()) mask = bitmap.GetMask()->GetBitmap();
+ 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();
- 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;
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()
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,
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();
PostCreation();
- if ( bMultiLine ) {
+ if (bMultiLine)
+ {
gtk_widget_realize(m_text);
gtk_widget_show(m_text);
}
}
else
{
- if ( bMultiLine )
+ if (bMultiLine)
gtk_text_set_editable( GTK_TEXT(m_text), 1 );
}
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) )
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);
+}
#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"
//-----------------------------------------------------------------------------
// 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)
//-----------------------------------------------------------------------------
// 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;
//-----------------------------------------------------------------------------
// 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;
if (!m_parent)
{
- printf( _("wxWindow::SetSize error.\n") );
+ wxFAIL_MSG( _("wxWindow::SetSize error.\n") );
return;
}
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;
+++ /dev/null
-#! /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