first pass of wxUniv merge - nothing works, most parts don't even compile

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10673 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-06-26 20:59:19 +00:00
parent aeb313f31c
commit 1e6feb95a7
409 changed files with 42065 additions and 6675 deletions

View File

@@ -1,91 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: accel.cpp
// Purpose:
// Author: Robert Roebling
// Id: $id:$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "accel.h"
#endif
#include "wx/accel.h"
#if wxUSE_ACCEL
#include <ctype.h>
//-----------------------------------------------------------------------------
// wxAcceleratorTable
//-----------------------------------------------------------------------------
class wxAccelRefData: public wxObjectRefData
{
public:
wxAccelRefData();
wxList m_accels;
};
wxAccelRefData::wxAccelRefData()
{
m_accels.DeleteContents( TRUE );
}
//-----------------------------------------------------------------------------
#define M_ACCELDATA ((wxAccelRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable,wxObject)
wxAcceleratorTable::wxAcceleratorTable()
{
}
wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] )
{
m_refData = new wxAccelRefData();
for (int i = 0; i < n; i++)
{
int flag = entries[i].GetFlags();
int keycode = entries[i].GetKeyCode();
int command = entries[i].GetCommand();
if ((keycode >= (int)'a') && (keycode <= (int)'z')) keycode = (int)toupper( (char)keycode );
M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( flag, keycode, command ) );
}
}
wxAcceleratorTable::~wxAcceleratorTable()
{
}
bool wxAcceleratorTable::Ok() const
{
return (m_refData != NULL);
}
int wxAcceleratorTable::GetCommand( wxKeyEvent &event )
{
if (!Ok()) return -1;
wxNode *node = M_ACCELDATA->m_accels.First();
while (node)
{
wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data();
if ((event.m_keyCode == entry->GetKeyCode()) &&
(((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) &&
(((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) &&
(((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown() || event.MetaDown()))
{
return entry->GetCommand();
}
node = node->Next();
}
return -1;
}
#endif

View File

@@ -309,11 +309,6 @@ END_EVENT_TABLE()
wxApp::wxApp()
{
wxTheApp = this;
m_topWindow = (wxWindow *) NULL;
m_exitOnFrameDelete = TRUE;
m_idleTag = 0;
wxapp_install_idle_handler();
@@ -323,8 +318,6 @@ wxApp::wxApp()
#endif
m_colorCube = (unsigned char*) NULL;
m_useBestVisual = FALSE;
}
wxApp::~wxApp()
@@ -340,6 +333,9 @@ wxApp::~wxApp()
bool wxApp::OnInitGui()
{
if ( !wxAppBase::OnInitGui() )
return FALSE;
GdkVisual *visual = gdk_visual_get_system();
/* on some machines, the default visual is just 256 colours, so

View File

@@ -324,7 +324,6 @@ bool wxBitmap::CreateFromXpm( const char **bits )
return TRUE;
}
bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
{
wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") )

View File

@@ -11,10 +11,12 @@
#pragma implementation "bmpbuttn.h"
#endif
#include "wx/bmpbuttn.h"
#include "wx/defs.h"
#if wxUSE_BMPBUTTON
#include "wx/bmpbuttn.h"
#include <gdk/gdk.h>
#include <gtk/gtk.h>
@@ -119,9 +121,6 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
m_needParent = TRUE;
m_acceptsFocus = TRUE;
m_marginX =
m_marginY = 0;
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, validator, name ))
{
@@ -129,10 +128,10 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
return FALSE;
}
m_bitmap = bitmap;
m_disabled = bitmap;
m_focus = bitmap;
m_selected = bitmap;
m_bmpNormal =
m_bmpDisabled =
m_bmpFocus =
m_bmpSelected = bitmap;
m_widget = gtk_button_new();
@@ -141,7 +140,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
#endif
if (m_bitmap.Ok())
if (m_bmpNormal.Ok())
{
wxSize newSize = size;
int border = (style & wxNO_BORDER) ? 4 : 10;
@@ -205,7 +204,7 @@ void wxBitmapButton::ApplyWidgetStyle()
void wxBitmapButton::SetBitmap()
{
wxCHECK_RET( m_widget != NULL, wxT("invalid button") );
wxCHECK_RET( m_widget != NULL, wxT("invalid bitmap button") );
wxBitmap the_one;
if (!m_isEnabled)
@@ -215,9 +214,21 @@ void wxBitmapButton::SetBitmap()
else if (m_hasFocus)
the_one = m_focus;
else
the_one = m_bitmap;
{
if (m_isSelected)
{
the_one = m_bmpSelected;
}
else
{
if (m_hasFocus)
the_one = m_bmpFocus;
else
the_one = m_bmpNormal;
}
}
if (!the_one.Ok()) the_one = m_bitmap;
if (!the_one.Ok()) the_one = m_bmpNormal;
if (!the_one.Ok()) return;
GdkBitmap *mask = (GdkBitmap *) NULL;

View File

@@ -11,6 +11,10 @@
#pragma implementation "button.h"
#endif
#include "wx/defs.h"
#if wxUSE_BUTTON
#include "wx/button.h"
#include <gdk/gdk.h>
@@ -186,3 +190,5 @@ wxSize wxButton::DoGetBestSize() const
return ret;
}
#endif // wxUSE_BUTTON

View File

@@ -12,10 +12,12 @@
#pragma implementation "checkbox.h"
#endif
#include "wx/checkbox.h"
#include "wx/defs.h"
#if wxUSE_CHECKBOX
#include "wx/checkbox.h"
#include <gdk/gdk.h>
#include <gtk/gtk.h>

View File

@@ -11,10 +11,12 @@
#pragma implementation "checklst.h"
#endif
#include "wx/checklst.h"
#include "wx/defs.h"
#if wxUSE_CHECKLISTBOX
#include "wx/checklst.h"
#include <gdk/gdk.h>
#include <gtk/gtk.h>

View File

@@ -12,10 +12,12 @@
#pragma implementation "choice.h"
#endif
#include "wx/choice.h"
#include "wx/defs.h"
#if wxUSE_CHOICE
#include "wx/choice.h"
#include <gdk/gdk.h>
#include <gtk/gtk.h>

View File

@@ -11,6 +11,10 @@
#pragma implementation "control.h"
#endif
#include "wx/defs.h"
#if wxUSE_CONTROLS
#include "wx/control.h"
#include <gtk/gtk.h>
@@ -79,3 +83,5 @@ wxSize wxControl::DoGetBestSize() const
return wxSize(req.width, req.height);
}
#endif // wxUSE_CONTROLS

View File

@@ -77,15 +77,15 @@ static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; }
#include "gdk/gdkprivate.h"
void gdk_wx_draw_bitmap (GdkDrawable *drawable,
GdkGC *gc,
GdkDrawable *src,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height)
void gdk_wx_draw_bitmap(GdkDrawable *drawable,
GdkGC *gc,
GdkDrawable *src,
gint xsrc,
gint ysrc,
gint xdest,
gint ydest,
gint width,
gint height)
{
gint src_width, src_height;
#ifndef __WXGTK20__
@@ -1085,9 +1085,12 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
}
}
bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
int logical_func, bool useMask )
bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
int logical_func,
bool useMask )
{
/* this is the nth try to get this utterly useless function to
work. it now completely ignores the scaling or translation
@@ -1100,6 +1103,12 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
if (!m_window) return FALSE;
#if 0
// transform the source DC coords to the device ones
xsrc = XLOG2DEV(xsrc);
ysrc = YLOG2DEV(ysrc);
#endif
wxClientDC *srcDC = (wxClientDC*)source;
wxMemoryDC *memDC = (wxMemoryDC*)source;
@@ -2069,14 +2078,19 @@ wxPaintDC::wxPaintDC( wxWindow *win )
GdkRegion *region = m_paintClippingRegion.GetRegion();
if ( region )
{
m_currentClippingRegion.Union( m_paintClippingRegion );
m_paintClippingRegion = win->GetUpdateRegion();
GdkRegion *region = m_paintClippingRegion.GetRegion();
if ( region )
{
m_currentClippingRegion.Union( m_paintClippingRegion );
gdk_gc_set_clip_region( m_penGC, region );
gdk_gc_set_clip_region( m_brushGC, region );
gdk_gc_set_clip_region( m_textGC, region );
gdk_gc_set_clip_region( m_bgGC, region );
gdk_gc_set_clip_region( m_penGC, region );
gdk_gc_set_clip_region( m_brushGC, region );
gdk_gc_set_clip_region( m_textGC, region );
gdk_gc_set_clip_region( m_bgGC, region );
}
}
#endif
#endif // USE_PAINT_REGION
}
//-----------------------------------------------------------------------------
@@ -2088,13 +2102,12 @@ IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
wxClientDC::wxClientDC( wxWindow *win )
: wxWindowDC( win )
{
}
void wxClientDC::DoGetSize(int *width, int *height) const
{
wxCHECK_RET( m_owner, _T("GetSize() doesn't work without window") );
m_owner->GetClientSize( width, height );
#ifdef __WXUNIVERSAL__
wxPoint ptOrigin = win->GetClientAreaOrigin();
SetDeviceOrigin(ptOrigin.x, ptOrigin.y);
wxSize size = win->GetClientSize();
SetClippingRegion(wxPoint(0, 0), size);
#endif // __WXUNIVERSAL__
}
// ----------------------------------------------------------------------------

View File

@@ -1,6 +1,7 @@
# This file was automatically generated by tmake at 01:54, 2001/06/22
# This file was automatically generated by tmake at 21:02, 2001/06/26
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
ALL_SOURCES = \
generic/accel.cpp \
generic/busyinfo.cpp \
generic/calctrl.cpp \
generic/caret.cpp \
@@ -47,6 +48,7 @@ ALL_SOURCES = \
common/choiccmn.cpp \
common/clipcmn.cpp \
common/cmdline.cpp \
common/cmdproc.cpp \
common/cmndata.cpp \
common/config.cpp \
common/cshelp.cpp \
@@ -151,7 +153,6 @@ ALL_SOURCES = \
common/xpmdecod.cpp \
common/zipstrm.cpp \
common/zstream.cpp \
gtk/accel.cpp \
gtk/app.cpp \
gtk/bitmap.cpp \
gtk/bmpbuttn.cpp \
@@ -259,6 +260,7 @@ ALL_HEADERS = \
choice.h \
clipbrd.h \
cmdline.h \
cmdproc.h \
cmndata.h \
colordlg.h \
colour.h \
@@ -584,6 +586,7 @@ COMMONOBJS = \
choiccmn.o \
clipcmn.o \
cmdline.o \
cmdproc.o \
cmndata.o \
config.o \
cshelp.o \
@@ -695,6 +698,7 @@ COMMONDEPS = \
choiccmn.d \
clipcmn.d \
cmdline.d \
cmdproc.d \
cmndata.d \
config.d \
cshelp.d \
@@ -801,6 +805,7 @@ COMMONDEPS = \
zstream.d
GENERICOBJS = \
accel.o \
busyinfo.o \
calctrl.o \
caret.o \
@@ -845,6 +850,7 @@ GENERICOBJS = \
wizard.o
GENERICDEPS = \
accel.d \
busyinfo.d \
calctrl.d \
caret.d \
@@ -889,7 +895,6 @@ GENERICDEPS = \
wizard.d
GUIOBJS = \
accel.o \
app.o \
bitmap.o \
bmpbuttn.o \
@@ -951,7 +956,6 @@ GUIOBJS = \
window.o
GUIDEPS = \
accel.d \
app.d \
bitmap.d \
bmpbuttn.d \
@@ -1012,6 +1016,60 @@ GUIDEPS = \
win_gtk.d \
window.d
GUI_LOWLEVEL_OBJS = \
app.o \
bitmap.o \
brush.o \
clipbrd.o \
colour.o \
cursor.o \
data.o \
dataobj.o \
dc.o \
dcclient.o \
dcmemory.o \
dcscreen.o \
dialog.o \
font.o \
frame.o \
gdiobj.o \
icon.o \
main.o \
pen.o \
region.o \
settings.o \
timer.o \
utilsgtk.o \
win_gtk.o \
window.o
GUI_LOWLEVEL_DEPS = \
app.d \
bitmap.d \
brush.d \
clipbrd.d \
colour.d \
cursor.d \
data.d \
dataobj.d \
dc.d \
dcclient.d \
dcmemory.d \
dcscreen.d \
dialog.d \
font.d \
frame.d \
gdiobj.d \
icon.d \
main.d \
pen.d \
region.d \
settings.d \
timer.d \
utilsgtk.d \
win_gtk.d \
window.d
UNIXOBJS = \
dialup.o \
dir.o \

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: fontdlg.cpp
// Name: gtk/fontdlg.cpp
// Purpose: wxFontDialog
// Author: Robert Roebling
// Id: $Id$
@@ -11,6 +11,10 @@
#pragma implementation "fontdlg.h"
#endif
#include "wx/defs.h"
#if wxUSE_FONTDLG
#include "wx/fontutil.h"
#include "wx/fontdlg.h"
#include "wx/utils.h"
@@ -201,3 +205,5 @@ wxFontDialog::~wxFontDialog()
{
}
#endif // wxUSE_FONTDLG

View File

@@ -64,7 +64,11 @@ extern int g_openDialogs;
// event tables
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
#ifdef __WXUNIVERSAL__
IMPLEMENT_DYNAMIC_CLASS(wxFrameGTK, wxWindow)
#else
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
#endif
// ----------------------------------------------------------------------------
// data
@@ -108,7 +112,7 @@ static gint gtk_frame_focus_callback( GtkWidget *widget, GtkDirectionType WXUNUS
// "size_allocate"
//-----------------------------------------------------------------------------
static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrameGTK *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
@@ -139,7 +143,7 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
// "delete_event"
//-----------------------------------------------------------------------------
static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxFrame *win )
static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxFrameGTK *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
@@ -150,11 +154,12 @@ static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WX
return TRUE;
}
#if wxUSE_MENUS
//-----------------------------------------------------------------------------
// "child_attached" of menu bar
//-----------------------------------------------------------------------------
static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrameGTK *win )
{
if (!win->m_hasVMT) return;
@@ -166,20 +171,21 @@ static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *
// "child_detached" of menu bar
//-----------------------------------------------------------------------------
static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrameGTK *win )
{
if (!win->m_hasVMT) return;
win->m_menuBarDetached = TRUE;
win->GtkUpdateSize();
}
#endif // wxUSE_MENUS
#if wxUSE_TOOLBAR
//-----------------------------------------------------------------------------
// "child_attached" of tool bar
//-----------------------------------------------------------------------------
static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrameGTK *win )
{
if (!win->m_hasVMT) return;
@@ -192,7 +198,7 @@ static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
// "child_detached" of tool bar
//-----------------------------------------------------------------------------
static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrameGTK *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
@@ -210,9 +216,9 @@ static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidge
static gint
#if (GTK_MINOR_VERSION > 0)
gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxFrame *win )
gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxFrameGTK *win )
#else
gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrameGTK *win )
#endif
{
if (g_isIdle)
@@ -247,7 +253,7 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *ev
so we do this directly after realization */
static void
gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxFrame *win )
gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget), wxFrameGTK *win )
{
if (g_isIdle)
wxapp_install_idle_handler();
@@ -375,26 +381,26 @@ static void gtk_window_draw_callback( GtkWidget *widget, GdkRectangle *rect, wxW
}
// ----------------------------------------------------------------------------
// wxFrame itself
// wxFrameGTK itself
// ----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// InsertChild for wxFrame
// InsertChild for wxFrameGTK
//-----------------------------------------------------------------------------
/* Callback for wxFrame. This very strange beast has to be used because
/* Callback for wxFrameGTK. This very strange beast has to be used because
* C++ has no virtual methods in a constructor. We have to emulate a
* virtual function here as wxWindows requires different ways to insert
* a child in container classes. */
static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
static void wxInsertChildInFrame( wxFrameGTK* parent, wxWindow* child )
{
wxASSERT( GTK_IS_WIDGET(child->m_widget) );
if (!parent->m_insertInClientArea)
{
/* these are outside the client area */
wxFrame* frame = (wxFrame*) parent;
wxFrameGTK* frame = (wxFrameGTK*) parent;
gtk_pizza_put( GTK_PIZZA(frame->m_mainWidget),
GTK_WIDGET(child->m_widget),
child->m_x,
@@ -435,10 +441,10 @@ static void wxInsertChildInFrame( wxFrame* parent, wxWindow* child )
}
// ----------------------------------------------------------------------------
// wxFrame creation
// wxFrameGTK creation
// ----------------------------------------------------------------------------
void wxFrame::Init()
void wxFrameGTK::Init()
{
m_sizeSet = FALSE;
m_miniEdge = 0;
@@ -453,7 +459,7 @@ void wxFrame::Init()
m_themeEnabled = TRUE;
}
bool wxFrame::Create( wxWindow *parent,
bool wxFrameGTK::Create( wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
@@ -480,7 +486,7 @@ bool wxFrame::Create( wxWindow *parent,
if (!PreCreation( parent, pos, size ) ||
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxFrame creation failed") );
wxFAIL_MSG( wxT("wxFrameGTK creation failed") );
return FALSE;
}
@@ -502,7 +508,7 @@ bool wxFrame::Create( wxWindow *parent,
gtk_window_set_wmclass( GTK_WINDOW(m_widget), name.mb_str(), name.mb_str() );
#ifdef __WXDEBUG__
debug_focus_in( m_widget, wxT("wxFrame::m_widget"), name );
debug_focus_in( m_widget, wxT("wxFrameGTK::m_widget"), name );
#endif
gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() );
@@ -524,7 +530,7 @@ bool wxFrame::Create( wxWindow *parent,
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
#ifdef __WXDEBUG__
debug_focus_in( m_mainWidget, wxT("wxFrame::m_mainWidget"), name );
debug_focus_in( m_mainWidget, wxT("wxFrameGTK::m_mainWidget"), name );
#endif
/* m_wxwindow only represents the client area without toolbar and menubar */
@@ -533,7 +539,7 @@ bool wxFrame::Create( wxWindow *parent,
gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow );
#ifdef __WXDEBUG__
debug_focus_in( m_wxwindow, wxT("wxFrame::m_wxwindow"), name );
debug_focus_in( m_wxwindow, wxT("wxFrameGTK::m_wxwindow"), name );
#endif
/* we donm't allow the frame to get the focus as otherwise
@@ -578,7 +584,7 @@ bool wxFrame::Create( wxWindow *parent,
return TRUE;
}
wxFrame::~wxFrame()
wxFrameGTK::~wxFrameGTK()
{
m_isBeingDeleted = TRUE;
@@ -642,7 +648,7 @@ bool wxFrame::ShowFullScreen(bool show, long style )
// overridden wxWindow methods
// ----------------------------------------------------------------------------
bool wxFrame::Show( bool show )
bool wxFrameGTK::Show( bool show )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
@@ -659,16 +665,16 @@ bool wxFrame::Show( bool show )
return wxWindow::Show( show );
}
void wxFrame::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) )
void wxFrameGTK::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(width), int WXUNUSED(height) )
{
wxFAIL_MSG( wxT("DoMoveWindow called for wxFrame") );
wxFAIL_MSG( wxT("DoMoveWindow called for wxFrameGTK") );
}
void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
void wxFrameGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
/* this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
/* this shouldn't happen: wxFrameGTK, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
/* avoid recursions */
@@ -735,13 +741,14 @@ void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags )
m_resizing = FALSE;
}
void wxFrame::DoGetClientSize( int *width, int *height ) const
void wxFrameGTK::DoGetClientSize( int *width, int *height ) const
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
wxWindow::DoGetClientSize( width, height );
if (height)
{
#if wxUSE_MENUS
/* menu bar */
if (m_frameMenuBar)
{
@@ -750,6 +757,7 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const
else
(*height) -= wxPLACE_HOLDER;
}
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
/* status bar */
@@ -789,10 +797,11 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const
}
}
void wxFrame::DoSetClientSize( int width, int height )
void wxFrameGTK::DoSetClientSize( int width, int height )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
#if wxUSE_MENUS
/* menu bar */
if (m_frameMenuBar)
{
@@ -801,6 +810,7 @@ void wxFrame::DoSetClientSize( int width, int height )
else
height += wxPLACE_HOLDER;
}
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
/* status bar */
@@ -834,7 +844,7 @@ void wxFrame::DoSetClientSize( int width, int height )
DoSetSize( -1, -1, width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle, 0 );
}
void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
void wxFrameGTK::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
int width, int height )
{
// due to a bug in gtk, x,y are always 0
@@ -845,7 +855,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
if (m_resizing) return;
m_resizing = TRUE;
/* this shouldn't happen: wxFrame, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
/* this shouldn't happen: wxFrameGTK, wxMDIParentFrame and wxMDIChildFrame have m_wxwindow */
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
m_width = width;
@@ -855,9 +865,9 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
int client_area_x_offset = 0,
client_area_y_offset = 0;
/* wxMDIChildFrame derives from wxFrame but it _is_ a wxWindow as it uses
/* wxMDIChildFrame derives from wxFrameGTK but it _is_ a wxWindow as it uses
wxWindow::Create to create it's GTK equivalent. m_mainWidget is only
set in wxFrame::Create so it is used to check what kind of frame we
set in wxFrameGTK::Create so it is used to check what kind of frame we
have here. if m_mainWidget is NULL it is a wxMDIChildFrame and so we
skip the part which handles m_frameMenuBar, m_frameToolBar and (most
importantly) m_mainWidget */
@@ -889,6 +899,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
* this hurts in the eye, but I don't want to call SetSize()
* because I don't want to call any non-native functions here. */
#if wxUSE_MENUS
if (m_frameMenuBar)
{
int xx = m_miniEdge;
@@ -905,6 +916,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
xx, yy, ww, hh );
client_area_y_offset += hh;
}
#endif // wxUSE_MENUS
#if wxUSE_TOOLBAR
if ((m_frameToolBar) && m_frameToolBar->IsShown() &&
@@ -912,6 +924,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
{
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
#if wxUSE_MENUS
if (m_frameMenuBar)
{
if (!m_menuBarDetached)
@@ -919,6 +932,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
else
yy += wxPLACE_HOLDER;
}
#endif // wxUSE_MENUS
m_frameToolBar->m_x = xx;
m_frameToolBar->m_y = yy;
@@ -978,7 +992,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
xx, yy, ww, hh );
gtk_widget_draw( m_frameStatusBar->m_widget, (GdkRectangle*) NULL );
}
#endif
#endif // wxUSE_STATUSBAR
m_sizeSet = TRUE;
@@ -987,6 +1001,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
#if wxUSE_STATUSBAR
// send size event to status bar
if (m_frameStatusBar)
{
@@ -994,11 +1009,12 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y),
event2.SetEventObject( m_frameStatusBar );
m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 );
}
#endif // wxUSE_STATUSBAR
m_resizing = FALSE;
}
void wxFrame::MakeModal( bool modal )
void wxFrameGTK::MakeModal( bool modal )
{
if (modal)
gtk_grab_add( m_widget );
@@ -1006,7 +1022,7 @@ void wxFrame::MakeModal( bool modal )
gtk_grab_remove( m_widget );
}
void wxFrame::OnInternalIdle()
void wxFrameGTK::OnInternalIdle()
{
if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow))
{
@@ -1018,7 +1034,9 @@ void wxFrame::OnInternalIdle()
return;
}
#if wxUSE_MENUS
if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle();
#endif // wxUSE_MENUS
#if wxUSE_TOOLBAR
if (m_frameToolBar) m_frameToolBar->OnInternalIdle();
#endif
@@ -1033,7 +1051,9 @@ void wxFrame::OnInternalIdle()
// menu/tool/status bar stuff
// ----------------------------------------------------------------------------
void wxFrame::SetMenuBar( wxMenuBar *menuBar )
#if wxUSE_MENUS
void wxFrameGTK::SetMenuBar( wxMenuBar *menuBar )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
@@ -1089,8 +1109,11 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
m_sizeSet = FALSE;
}
#endif // wxUSE_MENUS
#if wxUSE_TOOLBAR
wxToolBar* wxFrame::CreateToolBar( long style, wxWindowID id, const wxString& name )
wxToolBar* wxFrameGTK::CreateToolBar( long style, wxWindowID id, const wxString& name )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
@@ -1105,7 +1128,7 @@ wxToolBar* wxFrame::CreateToolBar( long style, wxWindowID id, const wxString& na
return m_frameToolBar;
}
void wxFrame::SetToolBar(wxToolBar *toolbar)
void wxFrameGTK::SetToolBar(wxToolBar *toolbar)
{
wxFrameBase::SetToolBar(toolbar);
@@ -1127,7 +1150,7 @@ void wxFrame::SetToolBar(wxToolBar *toolbar)
#if wxUSE_STATUSBAR
wxStatusBar* wxFrame::CreateStatusBar(int number,
wxStatusBar* wxFrameGTK::CreateStatusBar(int number,
long style,
wxWindowID id,
const wxString& name)
@@ -1140,7 +1163,7 @@ wxStatusBar* wxFrame::CreateStatusBar(int number,
return wxFrameBase::CreateStatusBar( number, style, id, name );
}
void wxFrame::PositionStatusBar()
void wxFrameGTK::PositionStatusBar()
{
if ( !m_frameStatusBar )
return;
@@ -1153,7 +1176,7 @@ void wxFrame::PositionStatusBar()
// frame title/icon
// ----------------------------------------------------------------------------
void wxFrame::SetTitle( const wxString &title )
void wxFrameGTK::SetTitle( const wxString &title )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
@@ -1161,7 +1184,7 @@ void wxFrame::SetTitle( const wxString &title )
gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() );
}
void wxFrame::SetIcon( const wxIcon &icon )
void wxFrameGTK::SetIcon( const wxIcon &icon )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
@@ -1184,12 +1207,12 @@ void wxFrame::SetIcon( const wxIcon &icon )
// frame state: maximized/iconized/normal
// ----------------------------------------------------------------------------
void wxFrame::Maximize(bool WXUNUSED(maximize))
void wxFrameGTK::Maximize(bool WXUNUSED(maximize))
{
wxFAIL_MSG( _T("not implemented") );
}
bool wxFrame::IsMaximized() const
bool wxFrameGTK::IsMaximized() const
{
// wxFAIL_MSG( _T("not implemented") );
@@ -1197,12 +1220,12 @@ bool wxFrame::IsMaximized() const
return FALSE;
}
void wxFrame::Restore()
void wxFrameGTK::Restore()
{
wxFAIL_MSG( _T("not implemented") );
}
void wxFrame::Iconize( bool iconize )
void wxFrameGTK::Iconize( bool iconize )
{
if (iconize)
{
@@ -1212,7 +1235,7 @@ void wxFrame::Iconize( bool iconize )
}
}
bool wxFrame::IsIconized() const
bool wxFrameGTK::IsIconized() const
{
return m_isIconized;
}

View File

@@ -374,7 +374,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
gtk_widget_show( GTK_WIDGET(m_list) );
SetSizeOrDefault( size );
SetBestSize( size );
if ( style & wxLB_SORT )
{
@@ -682,7 +682,7 @@ void wxListBox::Delete( int n )
wxNode *node = m_clientList.Nth( n );
if ( node )
{
if ( m_clientDataItemsType == ClientData_Object )
if ( m_clientDataItemsType == wxClientData_Object )
{
wxClientData *cd = (wxClientData*)node->Data();
delete cd;

View File

@@ -578,12 +578,14 @@ void wxMenuBar::SetLabelTop( size_t pos, const wxString& label )
static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
{
if (g_isIdle) wxapp_install_idle_handler();
if (g_isIdle)
wxapp_install_idle_handler();
int id = menu->FindMenuIdByMenuItem(widget);
/* should find it for normal (not popup) menu */
wxASSERT( (id != -1) || (menu->GetInvokingWindow() != NULL) );
wxASSERT_MSG( (id != -1) || (menu->GetInvokingWindow() != NULL),
_T("menu item not found in gtk_menu_clicked_callback") );
if (!menu->IsEnabled(id))
return;
@@ -607,25 +609,7 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
}
}
wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id );
event.SetEventObject( menu );
if (item->IsCheckable())
event.SetInt( item->IsChecked() );
#if wxUSE_MENU_CALLBACK
if (menu->GetCallback())
{
(void) (*(menu->GetCallback())) (*menu, event);
return;
}
#endif // wxUSE_MENU_CALLBACK
if (menu->GetEventHandler()->ProcessEvent(event))
return;
wxWindow *win = menu->GetInvokingWindow();
if (win)
win->GetEventHandler()->ProcessEvent( event );
menu->SendEvent(item->GetId(), item->IsCheckable() ? item->IsChecked() : -1);
}
//-----------------------------------------------------------------------------

View File

@@ -404,25 +404,6 @@ int wxNotebook::SetSelection( int page )
return selOld;
}
void wxNotebook::AdvanceSelection( bool forward )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid notebook") );
int max = GetPageCount();
if ( !max )
{
// nothing to do with empty notebook
return;
}
int sel = GetSelection();
if (forward)
SetSelection( sel == max - 1 ? 0 : sel + 1 );
else
SetSelection( sel == 0 ? max - 1 : sel - 1 );
}
void wxNotebook::SetImageList( wxImageList* imageList )
{
if (m_ownsImageList) delete m_imageList;
@@ -584,11 +565,11 @@ bool wxNotebook::DeletePage( int page )
return TRUE;
}
bool wxNotebook::RemovePage( int page )
wxNotebookPage *wxNotebook::DoRemovePage( int page )
{
wxGtkNotebookPage* nb_page = GetNotebookPage(page);
wxCHECK_MSG( nb_page, FALSE, _T("wxNotebook::RemovePage: invalid page") );
wxCHECK_MSG( nb_page, NULL, _T("wxNotebook::RemovePage: invalid page") );
gtk_widget_ref( nb_page->m_client->m_widget );
gtk_widget_unrealize( nb_page->m_client->m_widget );
@@ -596,9 +577,10 @@ bool wxNotebook::RemovePage( int page )
gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
wxNotebookPage *pageRemoved = (wxNotebookPage *)m_pages[page];
m_pages.DeleteObject( nb_page );
return TRUE;
return pageRemoved;
}
bool wxNotebook::InsertPage( int position, wxNotebookPage* win, const wxString& text,
@@ -700,17 +682,6 @@ void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
event.Skip();
}
wxNotebookPage *wxNotebook::GetPage( int page ) const
{
wxCHECK_MSG( m_widget != NULL, (wxWindow*) NULL, wxT("invalid notebook") );
wxGtkNotebookPage* nb_page = GetNotebookPage(page);
if (!nb_page)
return (wxNotebookPage *) NULL;
else
return nb_page->m_client;
}
#if wxUSE_CONSTRAINTS
// override these 2 functions to do nothing: everything is done in OnSize

View File

@@ -11,10 +11,12 @@
#pragma implementation "radiobox.h"
#endif
#include "wx/radiobox.h"
#include "wx/defs.h"
#if wxUSE_RADIOBOX
#include "wx/radiobox.h"
#include "wx/dialog.h"
#include "wx/frame.h"
#include "wx/log.h"

View File

@@ -12,10 +12,12 @@
#pragma implementation "radiobut.h"
#endif
#include "wx/radiobut.h"
#include "wx/defs.h"
#if wxUSE_RADIOBOX
#include "wx/radiobut.h"
#include <gdk/gdk.h>
#include <gtk/gtk.h>

View File

@@ -2,15 +2,24 @@
// Name: gtk/region.cpp
// Purpose:
// Author: Robert Roebling
// Modified: VZ at 05.10.00: use Unshare(), comparison fixed
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
#ifdef __GNUG__
#pragma implementation "region.h"
#pragma implementation "region.h"
#endif
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/region.h"
#include <gdk/gdk.h>
@@ -25,15 +34,18 @@
#define OLDCODE 0
#endif
//-----------------------------------------------------------------------------
// wxRegion
//-----------------------------------------------------------------------------
#include "wx/log.h"
class wxRegionRefData: public wxObjectRefData
// ----------------------------------------------------------------------------
// wxRegionRefData: private class containing the information about the region
// ----------------------------------------------------------------------------
class wxRegionRefData : public wxObjectRefData
{
public:
wxRegionRefData();
~wxRegionRefData();
wxRegionRefData(const wxRegionRefData& refData);
virtual ~wxRegionRefData();
GdkRegion *m_region;
#if OLDCODE
@@ -41,11 +53,49 @@ public:
#endif
};
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
#define M_REGIONDATA ((wxRegionRefData *)m_refData)
#define M_REGIONDATA_OF(rgn) ((wxRegionRefData *)(rgn.m_refData))
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject);
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject);
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// wxRegionRefData
// ----------------------------------------------------------------------------
wxRegionRefData::wxRegionRefData()
{
m_region = (GdkRegion *) NULL;
}
wxRegionRefData::wxRegionRefData(const wxRegionRefData& refData)
{
#ifdef __WXGTK20__
m_region = gdk_region_copy(refData.m_region);
#else
m_region = gdk_region_new();
GdkRegion *regCopy = gdk_regions_union(m_region, refData.m_region);
gdk_region_destroy(m_region);
m_region = regCopy;
#endif
wxNode *node = refData.m_rects.First();
while (node)
{
wxRect *r = (wxRect*)node->Data();
m_rects.Append( (wxObject*) new wxRect(*r) );
node = node->Next();
}
}
wxRegionRefData::~wxRegionRefData()
{
if (m_region) gdk_region_destroy( m_region );
@@ -61,12 +111,18 @@ wxRegionRefData::~wxRegionRefData()
#endif
}
//-----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxRegion construction
// ----------------------------------------------------------------------------
#define M_REGIONDATA ((wxRegionRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxRegion,wxGDIObject);
wxRegion::wxRegion()
{
}
wxRegion::wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
{
m_refData = new wxRegionRefData();
@@ -130,24 +186,42 @@ wxRegion::wxRegion( const wxRect& rect )
#endif
}
wxRegion::wxRegion()
{
}
wxRegion::~wxRegion()
{
}
bool wxRegion::operator == ( const wxRegion& region )
bool wxRegion::operator==( const wxRegion& region )
{
return m_refData == region.m_refData;
// VZ: compare the regions themselves, not the pointers to ref data!
return gdk_region_equal(M_REGIONDATA->m_region,
M_REGIONDATA_OF(region)->m_region);
}
bool wxRegion::operator != ( const wxRegion& region )
{
return m_refData != region.m_refData;
return !(*this == region);
}
void wxRegion::Unshare()
{
if ( !m_refData )
{
m_refData = new wxRegionRefData;
M_REGIONDATA->m_region = gdk_region_new();
}
else if ( m_refData->GetRefCount() > 1 )
{
wxRegionRefData *refData = new wxRegionRefData(*M_REGIONDATA);
UnRef();
m_refData = refData;
}
//else: we're not shared
}
// ----------------------------------------------------------------------------
// wxRegion operations
// ----------------------------------------------------------------------------
void wxRegion::Clear()
{
UnRef();
@@ -174,6 +248,8 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
}
else
{
Unshare();
#ifdef __WXGTK20__
gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect );
#else
@@ -182,7 +258,7 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
M_REGIONDATA->m_region = reg;
#endif
}
#if OLDCODE
M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,width,height) );
#endif
@@ -200,11 +276,7 @@ bool wxRegion::Union( const wxRegion& region )
if (region.IsNull())
return FALSE;
if (!m_refData)
{
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
}
Unshare();
#ifdef __WXGTK20__
gdk_region_union( M_REGIONDATA->m_region, region.GetRegion() );
@@ -229,27 +301,33 @@ bool wxRegion::Union( const wxRegion& region )
bool wxRegion::Intersect( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
if (!m_refData)
{
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
}
wxRegion reg( x, y, width, height );
Intersect( reg );
return TRUE;
return Intersect( reg );
}
bool wxRegion::Intersect( const wxRect& rect )
{
if (!m_refData)
{
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
}
wxRegion reg( rect );
Intersect( reg );
return Intersect( reg );
}
// this helper function just computes the region intersection without updating
// the list of rectangles each region maintaints: this allows us to call it
// from Intersect() itself without going into infinite recursion as we would
// if we called Intersect() itself recursively
bool wxRegion::IntersectRegionOnly(const wxRegion& region)
{
Unshare();
#ifdef __WXGTK20__
gdk_region_intersect( M_REGIONDATA->m_region, region.GetRegion() );
#else
GdkRegion *reg = gdk_regions_intersect( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
#endif
return TRUE;
}
@@ -264,41 +342,50 @@ bool wxRegion::Intersect( const wxRegion& region )
M_REGIONDATA->m_region = gdk_region_new();
return TRUE;
}
#ifdef __WXGTK20__
gdk_region_intersect( M_REGIONDATA->m_region, region.GetRegion() );
#else
GdkRegion *reg = gdk_regions_intersect( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
#endif
if ( !IntersectRegionOnly(region) )
{
GetRectList()->Clear();
return FALSE;
}
// we need to update the rect list as well
wxList& list = *GetRectList();
wxNode *node = list.First();
while (node)
{
wxRect *r = (wxRect*)node->Data();
wxRegion regCopy = region;
if ( regCopy.IntersectRegionOnly(*r) )
{
// replace the node with the intersection
*r = regCopy.GetBox();
}
else
{
// TODO remove the rect from the list
r->width = 0;
r->height = 0;
}
node = node->Next();
}
return TRUE;
}
bool wxRegion::Subtract( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
if (!m_refData)
{
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
}
wxRegion reg( x, y, width, height );
Subtract( reg );
return TRUE;
return Subtract( reg );
}
bool wxRegion::Subtract( const wxRect& rect )
{
if (!m_refData)
{
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
}
wxRegion reg( rect );
Subtract( reg );
return TRUE;
return Subtract( reg );
}
bool wxRegion::Subtract( const wxRegion& region )
@@ -312,6 +399,8 @@ bool wxRegion::Subtract( const wxRegion& region )
M_REGIONDATA->m_region = gdk_region_new();
}
Unshare();
#ifdef __WXGTK20__
gdk_region_subtract( M_REGIONDATA->m_region, region.GetRegion() );
#else
@@ -319,33 +408,20 @@ bool wxRegion::Subtract( const wxRegion& region )
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
#endif
return TRUE;
}
bool wxRegion::Xor( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
if (!m_refData)
{
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
}
wxRegion reg( x, y, width, height );
Xor( reg );
return TRUE;
return Xor( reg );
}
bool wxRegion::Xor( const wxRect& rect )
{
if (!m_refData)
{
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
}
wxRegion reg( rect );
Xor( reg );
return TRUE;
return Xor( reg );
}
bool wxRegion::Xor( const wxRegion& region )
@@ -358,6 +434,10 @@ bool wxRegion::Xor( const wxRegion& region )
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
}
else
{
Unshare();
}
#ifdef __WXGTK20__
gdk_region_xor( M_REGIONDATA->m_region, region.GetRegion() );
@@ -380,29 +460,33 @@ bool wxRegion::Xor( const wxRegion& region )
return TRUE;
}
// ----------------------------------------------------------------------------
// wxRegion tests
// ----------------------------------------------------------------------------
void wxRegion::GetBox( wxCoord &x, wxCoord &y, wxCoord &w, wxCoord &h ) const
{
x = 0;
y = 0;
w = -1;
h = -1;
if (!m_refData)
return;
GdkRectangle rect;
gdk_region_get_clipbox( M_REGIONDATA->m_region, &rect );
x = rect.x;
y = rect.y;
w = rect.width;
h = rect.height;
if ( m_refData )
{
GdkRectangle rect;
gdk_region_get_clipbox( M_REGIONDATA->m_region, &rect );
x = rect.x;
y = rect.y;
w = rect.width;
h = rect.height;
}
else
{
x = 0;
y = 0;
w = -1;
h = -1;
}
}
wxRect wxRegion::GetBox() const
{
wxCoord x = 0;
wxCoord y = 0;
wxCoord w = -1;
wxCoord h = -1;
wxCoord x, y, w, h;
GetBox( x, y, w, h );
return wxRect( x, y, w, h );
}
@@ -476,9 +560,9 @@ wxList *wxRegion::GetRectList() const
#endif
}
//-----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxRegionIterator
//-----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#if OLDCODE
@@ -563,7 +647,7 @@ wxCoord wxRegionIterator::GetH() const
struct _XBox {
short x1, x2, y1, y2;
};
struct _XRegion {
long size , numRects;
_XBox *rects, extents;
@@ -682,5 +766,16 @@ wxCoord wxRegionIterator::GetH() const
return ((wxRIRefData*)m_refData)->m_rects[m_current].height;
}
wxRect wxRegionIterator::GetRect() const
{
wxRect r;
wxNode *node = m_region.GetRectList()->Nth( m_current );
if (node)
r = *((wxRect*)node->Data());
return r;
}
#endif

View File

@@ -1,10 +1,10 @@
/////////////////////////////////////////////////////////////////////////////
// Name: scrolbar.cpp
// Name: src/gtk/scrolbar.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -12,10 +12,12 @@
#pragma implementation "scrolbar.h"
#endif
#include "wx/scrolbar.h"
#include "wx/defs.h"
#if wxUSE_SCROLLBAR
#include "wx/scrolbar.h"
#include "wx/utils.h"
#include <math.h>

View File

@@ -1,10 +1,10 @@
/////////////////////////////////////////////////////////////////////////////
// Name: slider.cpp
// Name: gtk/slider.cpp
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -33,7 +33,7 @@ extern bool g_isIdle;
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnDrag;
static const float sensitivity = 0.02;
@@ -64,9 +64,8 @@ static void gtk_slider_callback( GtkAdjustment *adjust, wxSlider *win )
double dvalue = adjust->value;
int value = (int)(dvalue < 0 ? dvalue - 0.5 : dvalue + 0.5);
int orient = wxHORIZONTAL;
if ( (win->GetWindowStyleFlag() & wxSB_VERTICAL) == wxSB_VERTICAL)
orient = wxVERTICAL;
int orient = win->GetWindowStyleFlag() & wxSL_VERTICAL ? wxVERTICAL
: wxHORIZONTAL;
wxScrollEvent event( command, win->GetId(), value, orient );
event.SetEventObject( win );
@@ -245,41 +244,6 @@ int wxSlider::GetLineSize() const
return 0;
}
void wxSlider::SetTick( int WXUNUSED(tickPos) )
{
}
void wxSlider::SetTickFreq( int WXUNUSED(n), int WXUNUSED(pos) )
{
}
int wxSlider::GetTickFreq() const
{
return 0;
}
void wxSlider::ClearTicks()
{
}
void wxSlider::SetSelection( int WXUNUSED(minPos), int WXUNUSED(maxPos) )
{
}
int wxSlider::GetSelEnd() const
{
return 0;
}
int wxSlider::GetSelStart() const
{
return 0;
}
void wxSlider::ClearSel()
{
}
bool wxSlider::IsOwnGtkWindow( GdkWindow *window )
{
GtkRange *range = GTK_RANGE(m_widget);

View File

@@ -11,10 +11,12 @@
#pragma implementation "statbmp.h"
#endif
#include "wx/statbmp.h"
#include "wx/defs.h"
#if wxUSE_STATBMP
#include "wx/statbmp.h"
#include "gdk/gdk.h"
#include "gtk/gtk.h"
@@ -74,7 +76,7 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi
mask = m_bitmap.GetMask()->GetBitmap();
m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
SetSizeOrDefault( size );
SetBestSize( size );
}
else
{
@@ -112,16 +114,9 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
}
SetSizeOrDefault();
SetBestSize(wxSize(bitmap.GetWidth(), bitmap.GetHeight()));
}
}
wxSize wxStaticBitmap::DoGetBestSize() const
{
if ( m_bitmap.Ok() )
return wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight());
else
return wxSize(16, 16); // completely arbitrary
}
#endif // wxUSE_STATBMP
#endif

View File

@@ -11,10 +11,12 @@
#pragma implementation "statbox.h"
#endif
#include "wx/statbox.h"
#include "wx/defs.h"
#if wxUSE_STATBOX
#include "wx/statbox.h"
#include "gdk/gdk.h"
#include "gtk/gtk.h"
@@ -45,22 +47,22 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
!CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
{
wxFAIL_MSG( wxT("wxStaticBox creation failed") );
return FALSE;
return FALSE;
}
m_isStaticBox = TRUE;
if (label.IsEmpty())
m_widget = gtk_frame_new( (char*) NULL );
else
m_widget = gtk_frame_new( m_label.mbc_str() );
m_parent->DoAddChild( this );
PostCreation();
SetLabel(label);
SetFont( parent->GetFont() );
SetBackgroundColour( parent->GetBackgroundColour() );
@@ -84,4 +86,4 @@ void wxStaticBox::ApplyWidgetStyle()
gtk_widget_set_style( m_widget, m_widgetStyle );
}
#endif
#endif // wxUSE_STATBOX

View File

@@ -12,6 +12,10 @@
#pragma implementation "stattext.h"
#endif
#include "wx/defs.h"
#if wxUSE_STATTEXT
#include "wx/stattext.h"
#include "gdk/gdk.h"
@@ -156,3 +160,4 @@ wxSize wxStaticText::DoGetBestSize() const
return wxSize(req.width, req.height);
}
#endif // wxUSE_STATTEXT

View File

@@ -926,27 +926,6 @@ void wxTextCtrl::Paste()
#endif
}
bool wxTextCtrl::CanCopy() const
{
// Can copy if there's a selection
long from, to;
GetSelection(& from, & to);
return (from != to) ;
}
bool wxTextCtrl::CanCut() const
{
// Can cut if there's a selection
long from, to;
GetSelection(& from, & to);
return (from != to) && (IsEditable());
}
bool wxTextCtrl::CanPaste() const
{
return IsEditable() ;
}
// Undo/redo
void wxTextCtrl::Undo()
{

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: gtk/timer.cpp
// Purpose:
// Purpose: wxTimer implementation
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
@@ -12,15 +12,19 @@
#pragma implementation "timer.h"
#endif
#include "wx/defs.h"
#if wxUSE_TIMER
#include "wx/timer.h"
#include "gtk/gtk.h"
//-----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxTimer
//-----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxTimer,wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
static gint timeout_callback( gpointer data )
{
@@ -71,3 +75,5 @@ void wxTimer::Stop()
}
}
#endif // wxUSE_TIMER

View File

@@ -521,18 +521,20 @@ gtk_pizza_realize (GtkWidget *widget)
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
#ifndef __WXUNIVERSAL__
if (pizza->shadow_type == GTK_MYSHADOW_NONE)
{
/* no border, no changes to sizes */
} else
if (pizza->shadow_type == GTK_MYSHADOW_THIN)
}
else if (pizza->shadow_type == GTK_MYSHADOW_THIN)
{
/* GTK_MYSHADOW_THIN == wxSIMPLE_BORDER */
attributes.x += 1;
attributes.y += 1;
attributes.width -= 2;
attributes.height -= 2;
} else
}
else
{
/* GTK_MYSHADOW_IN == wxSUNKEN_BORDER */
/* GTK_MYSHADOW_OUT == wxRAISED_BORDER */
@@ -541,6 +543,7 @@ gtk_pizza_realize (GtkWidget *widget)
attributes.width -= 4;
attributes.height -= 4;
}
#endif /* __WXUNIVERSAL__ */
/* minimal size */
if (attributes.width < 2) attributes.width = 2;

File diff suppressed because it is too large Load Diff