"wxGDIObject * => &" related changes (see mail to the list)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1142 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@@ -213,8 +213,8 @@ bool wxApp::SendIdleEvents(void)
|
||||
wxNode* node = wxTopLevelWindows.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow* win = (wxWindow*) node->Data();
|
||||
if (SendIdleEvents(win))
|
||||
wxWindow* win = (wxWindow*) node->Data();
|
||||
if (SendIdleEvents(win))
|
||||
needMore = TRUE;
|
||||
node = node->Next();
|
||||
}
|
||||
@@ -225,22 +225,22 @@ bool wxApp::SendIdleEvents( wxWindow* win )
|
||||
{
|
||||
bool needMore = FALSE;
|
||||
|
||||
wxIdleEvent event;
|
||||
event.SetEventObject(win);
|
||||
win->ProcessEvent(event);
|
||||
wxIdleEvent event;
|
||||
event.SetEventObject(win);
|
||||
win->ProcessEvent(event);
|
||||
|
||||
if (event.MoreRequested())
|
||||
needMore = TRUE;
|
||||
|
||||
wxNode* node = win->GetChildren()->First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow* win = (wxWindow*) node->Data();
|
||||
if (SendIdleEvents(win))
|
||||
wxNode* node = win->GetChildren().First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow* win = (wxWindow*) node->Data();
|
||||
if (SendIdleEvents(win))
|
||||
needMore = TRUE;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
return needMore ;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// Author: Robert Roebling
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMask,wxObject)
|
||||
|
||||
wxMask::wxMask(void)
|
||||
wxMask::wxMask()
|
||||
{
|
||||
m_bitmap = (GdkBitmap *) NULL;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap) )
|
||||
{
|
||||
}
|
||||
|
||||
wxMask::~wxMask(void)
|
||||
wxMask::~wxMask()
|
||||
{
|
||||
if (m_bitmap) gdk_bitmap_unref( m_bitmap );
|
||||
}
|
||||
@@ -50,7 +50,7 @@ GdkBitmap *wxMask::GetBitmap(void) const
|
||||
{
|
||||
return m_bitmap;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxBitmap
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -60,7 +60,7 @@ class wxBitmapRefData: public wxObjectRefData
|
||||
public:
|
||||
wxBitmapRefData(void);
|
||||
~wxBitmapRefData(void);
|
||||
|
||||
|
||||
GdkPixmap *m_pixmap;
|
||||
GdkBitmap *m_bitmap;
|
||||
wxMask *m_mask;
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
wxPalette *m_palette;
|
||||
};
|
||||
|
||||
wxBitmapRefData::wxBitmapRefData(void)
|
||||
wxBitmapRefData::wxBitmapRefData()
|
||||
{
|
||||
m_pixmap = (GdkPixmap *) NULL;
|
||||
m_bitmap = (GdkBitmap *) NULL;
|
||||
@@ -81,7 +81,7 @@ wxBitmapRefData::wxBitmapRefData(void)
|
||||
m_palette = (wxPalette *) NULL;
|
||||
}
|
||||
|
||||
wxBitmapRefData::~wxBitmapRefData(void)
|
||||
wxBitmapRefData::~wxBitmapRefData()
|
||||
{
|
||||
if (m_pixmap) gdk_pixmap_unref( m_pixmap );
|
||||
if (m_bitmap) gdk_bitmap_unref( m_bitmap );
|
||||
@@ -95,95 +95,88 @@ wxBitmapRefData::~wxBitmapRefData(void)
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject)
|
||||
|
||||
wxBitmap::wxBitmap(void)
|
||||
wxBitmap::wxBitmap()
|
||||
{
|
||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
|
||||
wxBitmap::wxBitmap( int width, int height, int depth )
|
||||
{
|
||||
wxCHECK_RET( (width > 0) && (height > 0), "invalid bitmap size" )
|
||||
wxCHECK_RET( (depth > 0) || (depth == -1), "invalid bitmap depth" )
|
||||
|
||||
m_refData = new wxBitmapRefData();
|
||||
|
||||
|
||||
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
|
||||
|
||||
|
||||
M_BMPDATA->m_mask = (wxMask *) NULL;
|
||||
M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth );
|
||||
M_BMPDATA->m_width = width;
|
||||
M_BMPDATA->m_height = height;
|
||||
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth;
|
||||
|
||||
|
||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap( const char **bits )
|
||||
{
|
||||
wxCHECK_RET( bits != NULL, "invalid bitmap data" )
|
||||
|
||||
|
||||
m_refData = new wxBitmapRefData();
|
||||
|
||||
GdkBitmap *mask = (GdkBitmap*) NULL;
|
||||
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
|
||||
|
||||
|
||||
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( parent, &mask, NULL, (gchar **) bits );
|
||||
|
||||
|
||||
if (mask)
|
||||
{
|
||||
M_BMPDATA->m_mask = new wxMask();
|
||||
M_BMPDATA->m_mask->m_bitmap = mask;
|
||||
}
|
||||
|
||||
|
||||
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
|
||||
|
||||
|
||||
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ?
|
||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
|
||||
wxBitmap::wxBitmap( char **bits )
|
||||
{
|
||||
wxCHECK_RET( bits != NULL, "invalid bitmap data" )
|
||||
|
||||
|
||||
m_refData = new wxBitmapRefData();
|
||||
|
||||
GdkBitmap *mask = (GdkBitmap*) NULL;
|
||||
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
|
||||
|
||||
|
||||
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( parent, &mask, NULL, (gchar **) bits );
|
||||
|
||||
|
||||
wxCHECK_RET( M_BMPDATA->m_pixmap, "couldn't create pixmap" );
|
||||
|
||||
|
||||
if (mask)
|
||||
{
|
||||
M_BMPDATA->m_mask = new wxMask();
|
||||
M_BMPDATA->m_mask->m_bitmap = mask;
|
||||
}
|
||||
|
||||
|
||||
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
|
||||
|
||||
|
||||
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ?
|
||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
|
||||
wxBitmap::wxBitmap( const wxBitmap& bmp )
|
||||
{
|
||||
Ref( bmp );
|
||||
|
||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap( const wxBitmap* bmp )
|
||||
{
|
||||
if (bmp) Ref( *bmp );
|
||||
|
||||
|
||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap( const wxString &filename, int type )
|
||||
{
|
||||
LoadFile( filename, type );
|
||||
|
||||
|
||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
@@ -192,44 +185,44 @@ wxBitmap::wxBitmap( const char bits[], int width, int height, int WXUNUSED(depth
|
||||
m_refData = new wxBitmapRefData();
|
||||
|
||||
M_BMPDATA->m_mask = (wxMask *) NULL;
|
||||
M_BMPDATA->m_bitmap =
|
||||
M_BMPDATA->m_bitmap =
|
||||
gdk_bitmap_create_from_data( (GdkWindow*) &gdk_root_parent, (gchar *) bits, width, height );
|
||||
M_BMPDATA->m_width = width;
|
||||
M_BMPDATA->m_height = height;
|
||||
M_BMPDATA->m_bpp = 1;
|
||||
|
||||
wxCHECK_RET( M_BMPDATA->m_bitmap, "couldn't create bitmap" );
|
||||
|
||||
|
||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
wxBitmap::~wxBitmap(void)
|
||||
|
||||
wxBitmap::~wxBitmap()
|
||||
{
|
||||
if (wxTheBitmapList) wxTheBitmapList->DeleteObject(this);
|
||||
}
|
||||
|
||||
|
||||
wxBitmap& wxBitmap::operator = ( const wxBitmap& bmp )
|
||||
{
|
||||
if (*this == bmp) return (*this);
|
||||
Ref( bmp );
|
||||
return *this;
|
||||
if (*this == bmp) return (*this);
|
||||
Ref( bmp );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
bool wxBitmap::operator == ( const wxBitmap& bmp )
|
||||
{
|
||||
return m_refData == bmp.m_refData;
|
||||
return m_refData == bmp.m_refData;
|
||||
}
|
||||
|
||||
|
||||
bool wxBitmap::operator != ( const wxBitmap& bmp )
|
||||
{
|
||||
return m_refData != bmp.m_refData;
|
||||
return m_refData != bmp.m_refData;
|
||||
}
|
||||
|
||||
|
||||
bool wxBitmap::Ok(void) const
|
||||
{
|
||||
return (m_refData != NULL);
|
||||
}
|
||||
|
||||
|
||||
int wxBitmap::GetHeight(void) const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), -1, "invalid bitmap" );
|
||||
@@ -240,69 +233,69 @@ int wxBitmap::GetHeight(void) const
|
||||
int wxBitmap::GetWidth(void) const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), -1, "invalid bitmap" );
|
||||
|
||||
|
||||
return M_BMPDATA->m_width;
|
||||
}
|
||||
|
||||
int wxBitmap::GetDepth(void) const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), -1, "invalid bitmap" );
|
||||
|
||||
|
||||
return M_BMPDATA->m_bpp;
|
||||
}
|
||||
|
||||
wxMask *wxBitmap::GetMask(void) const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), (wxMask *) NULL, "invalid bitmap" );
|
||||
|
||||
|
||||
return M_BMPDATA->m_mask;
|
||||
}
|
||||
|
||||
void wxBitmap::SetMask( wxMask *mask )
|
||||
{
|
||||
wxCHECK_RET( Ok(), "invalid bitmap" );
|
||||
|
||||
|
||||
if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask;
|
||||
|
||||
|
||||
M_BMPDATA->m_mask = mask;
|
||||
}
|
||||
|
||||
bool wxBitmap::SaveFile( const wxString &name, int type, wxPalette *WXUNUSED(palette) )
|
||||
{
|
||||
wxCHECK_MSG( Ok(), FALSE, "invalid bitmap" );
|
||||
|
||||
|
||||
if (type == wxBITMAP_TYPE_PNG)
|
||||
{
|
||||
wxImage image( *this );
|
||||
if (image.Ok()) return image.SaveFile( name, type );
|
||||
}
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxBitmap::LoadFile( const wxString &name, int type )
|
||||
{
|
||||
UnRef();
|
||||
|
||||
|
||||
if (!wxFileExists(name)) return FALSE;
|
||||
|
||||
|
||||
if (type == wxBITMAP_TYPE_XPM)
|
||||
{
|
||||
m_refData = new wxBitmapRefData();
|
||||
|
||||
|
||||
GdkBitmap *mask = (GdkBitmap*) NULL;
|
||||
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
|
||||
|
||||
|
||||
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm( parent, &mask, NULL, name );
|
||||
|
||||
|
||||
if (mask)
|
||||
{
|
||||
M_BMPDATA->m_mask = new wxMask();
|
||||
M_BMPDATA->m_mask->m_bitmap = mask;
|
||||
}
|
||||
|
||||
|
||||
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
|
||||
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth;
|
||||
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth;
|
||||
}
|
||||
else if (type == wxBITMAP_TYPE_PNG)
|
||||
{
|
||||
@@ -316,16 +309,16 @@ bool wxBitmap::LoadFile( const wxString &name, int type )
|
||||
image.LoadFile( name, type );
|
||||
if (image.Ok()) *this = image.ConvertToBitmap();
|
||||
}
|
||||
else
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
wxPalette *wxBitmap::GetPalette(void) const
|
||||
{
|
||||
if (!Ok()) return (wxPalette *) NULL;
|
||||
|
||||
|
||||
return M_BMPDATA->m_palette;
|
||||
}
|
||||
|
||||
@@ -360,17 +353,17 @@ void wxBitmap::SetPixmap( GdkPixmap *pixmap )
|
||||
GdkPixmap *wxBitmap::GetPixmap(void) const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), (GdkPixmap *) NULL, "invalid bitmap" );
|
||||
|
||||
|
||||
return M_BMPDATA->m_pixmap;
|
||||
}
|
||||
|
||||
|
||||
GdkBitmap *wxBitmap::GetBitmap(void) const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), (GdkBitmap *) NULL, "invalid bitmap" );
|
||||
|
||||
|
||||
return M_BMPDATA->m_bitmap;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxImage
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -383,46 +376,46 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
|
||||
int width = GetWidth();
|
||||
int height = GetHeight();
|
||||
|
||||
|
||||
bitmap.SetHeight( height );
|
||||
bitmap.SetWidth( width );
|
||||
|
||||
|
||||
// Create picture
|
||||
|
||||
GdkImage *data_image =
|
||||
|
||||
GdkImage *data_image =
|
||||
gdk_image_new( GDK_IMAGE_FASTEST, gdk_visual_get_system(), width, height );
|
||||
|
||||
|
||||
bitmap.SetPixmap( gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, -1 ) );
|
||||
|
||||
// Create mask
|
||||
|
||||
|
||||
GdkImage *mask_image = (GdkImage*) NULL;
|
||||
|
||||
|
||||
if (HasMask())
|
||||
{
|
||||
unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
|
||||
|
||||
|
||||
mask_image = gdk_image_new_bitmap( gdk_visual_get_system(), mask_data, width, height );
|
||||
|
||||
|
||||
wxMask *mask = new wxMask();
|
||||
mask->m_bitmap = gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, 1 );
|
||||
|
||||
|
||||
bitmap.SetMask( mask );
|
||||
}
|
||||
|
||||
// Retrieve depth
|
||||
|
||||
|
||||
// Retrieve depth
|
||||
|
||||
GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() );
|
||||
if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent );
|
||||
int bpp = visual->depth;
|
||||
if ((bpp == 16) && (visual->red_mask != 0xf800)) bpp = 15;
|
||||
if (bpp < 8) bpp = 8;
|
||||
|
||||
|
||||
// Render
|
||||
|
||||
enum byte_order { RGB, RBG, BRG, BGR, GRB, GBR };
|
||||
byte_order b_o = RGB;
|
||||
|
||||
|
||||
if (bpp >= 24)
|
||||
{
|
||||
GdkVisual *visual = gdk_visual_get_system();
|
||||
@@ -433,13 +426,13 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
else if ((visual->green_mask > visual->red_mask) && (visual->red_mask > visual->blue_mask)) b_o = GRB;
|
||||
else if ((visual->green_mask > visual->blue_mask) && (visual->blue_mask > visual->red_mask)) b_o = GBR;
|
||||
}
|
||||
|
||||
|
||||
int r_mask = GetMaskRed();
|
||||
int g_mask = GetMaskGreen();
|
||||
int b_mask = GetMaskBlue();
|
||||
|
||||
|
||||
unsigned char* data = GetData();
|
||||
|
||||
|
||||
int index = 0;
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
@@ -451,7 +444,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
index++;
|
||||
int b = data[index];
|
||||
index++;
|
||||
|
||||
|
||||
if (HasMask())
|
||||
{
|
||||
if ((r == r_mask) && (b == b_mask) && (g == g_mask))
|
||||
@@ -459,7 +452,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
else
|
||||
gdk_image_put_pixel( mask_image, x, y, 0 );
|
||||
}
|
||||
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
case 8:
|
||||
@@ -477,9 +470,9 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
||||
if (sum < max) { index = i; max = sum; }
|
||||
}
|
||||
|
||||
|
||||
gdk_image_put_pixel( data_image, x, y, index );
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case 15:
|
||||
@@ -513,68 +506,68 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
}
|
||||
} // for
|
||||
} // for
|
||||
|
||||
|
||||
// Blit picture
|
||||
|
||||
|
||||
GdkGC *data_gc = gdk_gc_new( bitmap.GetPixmap() );
|
||||
|
||||
|
||||
gdk_draw_image( bitmap.GetPixmap(), data_gc, data_image, 0, 0, 0, 0, width, height );
|
||||
|
||||
|
||||
gdk_image_destroy( data_image );
|
||||
gdk_gc_unref( data_gc );
|
||||
|
||||
|
||||
// Blit mask
|
||||
|
||||
|
||||
if (HasMask())
|
||||
{
|
||||
GdkGC *mask_gc = gdk_gc_new( bitmap.GetMask()->GetBitmap() );
|
||||
|
||||
|
||||
gdk_draw_image( bitmap.GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
|
||||
|
||||
|
||||
gdk_image_destroy( mask_image );
|
||||
gdk_gc_unref( mask_gc );
|
||||
}
|
||||
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
wxImage::wxImage( const wxBitmap &bitmap )
|
||||
{
|
||||
wxCHECK_RET( bitmap.Ok(), "invalid bitmap" );
|
||||
|
||||
GdkImage *gdk_image = gdk_image_get( bitmap.GetPixmap(),
|
||||
0, 0,
|
||||
|
||||
GdkImage *gdk_image = gdk_image_get( bitmap.GetPixmap(),
|
||||
0, 0,
|
||||
bitmap.GetWidth(), bitmap.GetHeight() );
|
||||
|
||||
|
||||
wxCHECK_RET( gdk_image, "couldn't create image" );
|
||||
|
||||
|
||||
Create( bitmap.GetWidth(), bitmap.GetHeight() );
|
||||
char unsigned *data = GetData();
|
||||
|
||||
|
||||
if (!data)
|
||||
{
|
||||
gdk_image_destroy( gdk_image );
|
||||
wxFAIL_MSG( "couldn't create image" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
GdkImage *gdk_image_mask = (GdkImage*) NULL;
|
||||
if (bitmap.GetMask())
|
||||
{
|
||||
gdk_image_mask = gdk_image_get( bitmap.GetMask()->GetBitmap(),
|
||||
0, 0,
|
||||
gdk_image_mask = gdk_image_get( bitmap.GetMask()->GetBitmap(),
|
||||
0, 0,
|
||||
bitmap.GetWidth(), bitmap.GetHeight() );
|
||||
|
||||
SetMaskColour( 16, 16, 16 ); // anything unlikely and dividable
|
||||
}
|
||||
|
||||
|
||||
GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() );
|
||||
if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent );
|
||||
int bpp = visual->depth;
|
||||
if ((bpp == 16) && (visual->red_mask != 0xf800)) bpp = 15;
|
||||
|
||||
GdkColormap *cmap = gtk_widget_get_default_colormap();
|
||||
|
||||
|
||||
long pos = 0;
|
||||
for (int j = 0; j < bitmap.GetHeight(); j++)
|
||||
{
|
||||
@@ -602,7 +595,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
||||
data[pos+1] = (pixel >> 8) & 0xff;
|
||||
data[pos+2] = pixel & 0xff;
|
||||
}
|
||||
|
||||
|
||||
if (gdk_image_mask)
|
||||
{
|
||||
int mask_pixel = gdk_image_get_pixel( gdk_image_mask, i, j );
|
||||
@@ -613,11 +606,11 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
||||
data[pos+2] = 16;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pos += 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gdk_image_destroy( gdk_image );
|
||||
if (gdk_image_mask) gdk_image_destroy( gdk_image_mask );
|
||||
}
|
||||
|
||||
@@ -20,16 +20,16 @@
|
||||
class wxBrushRefData: public wxObjectRefData
|
||||
{
|
||||
public:
|
||||
|
||||
wxBrushRefData(void);
|
||||
|
||||
wxBrushRefData();
|
||||
wxBrushRefData( const wxBrushRefData& data );
|
||||
|
||||
|
||||
int m_style;
|
||||
wxBitmap m_stipple;
|
||||
wxColour m_colour;
|
||||
};
|
||||
|
||||
wxBrushRefData::wxBrushRefData(void)
|
||||
wxBrushRefData::wxBrushRefData()
|
||||
{
|
||||
m_style = 0;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ wxBrushRefData::wxBrushRefData( const wxBrushRefData& data )
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
|
||||
|
||||
wxBrush::wxBrush(void)
|
||||
wxBrush::wxBrush()
|
||||
{
|
||||
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
|
||||
}
|
||||
@@ -57,7 +57,7 @@ wxBrush::wxBrush( const wxColour &colour, int style )
|
||||
m_refData = new wxBrushRefData();
|
||||
M_BRUSHDATA->m_style = style;
|
||||
M_BRUSHDATA->m_colour = colour;
|
||||
|
||||
|
||||
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
|
||||
}
|
||||
|
||||
@@ -67,52 +67,45 @@ wxBrush::wxBrush( const wxBitmap &stippleBitmap )
|
||||
M_BRUSHDATA->m_style = wxSTIPPLE;
|
||||
M_BRUSHDATA->m_colour = *wxBLACK;
|
||||
M_BRUSHDATA->m_stipple = stippleBitmap;
|
||||
|
||||
|
||||
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
|
||||
}
|
||||
|
||||
wxBrush::wxBrush( const wxBrush &brush )
|
||||
{
|
||||
Ref( brush );
|
||||
|
||||
|
||||
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
|
||||
}
|
||||
|
||||
wxBrush::wxBrush( const wxBrush *brush )
|
||||
{
|
||||
if (brush) Ref( *brush );
|
||||
|
||||
if (wxTheBrushList) wxTheBrushList->Append( this );
|
||||
}
|
||||
|
||||
wxBrush::~wxBrush(void)
|
||||
wxBrush::~wxBrush()
|
||||
{
|
||||
if (wxTheBrushList) wxTheBrushList->RemoveBrush( this );
|
||||
}
|
||||
|
||||
wxBrush& wxBrush::operator = ( const wxBrush& brush )
|
||||
{
|
||||
if (*this == brush) return (*this);
|
||||
Ref( brush );
|
||||
return *this;
|
||||
if (*this == brush) return (*this);
|
||||
Ref( brush );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
bool wxBrush::operator == ( const wxBrush& brush )
|
||||
{
|
||||
return m_refData == brush.m_refData;
|
||||
return m_refData == brush.m_refData;
|
||||
}
|
||||
|
||||
bool wxBrush::operator != ( const wxBrush& brush )
|
||||
{
|
||||
return m_refData != brush.m_refData;
|
||||
return m_refData != brush.m_refData;
|
||||
}
|
||||
|
||||
bool wxBrush::Ok(void) const
|
||||
bool wxBrush::Ok() const
|
||||
{
|
||||
return ((m_refData) && M_BRUSHDATA->m_colour.Ok());
|
||||
}
|
||||
|
||||
int wxBrush::GetStyle(void) const
|
||||
int wxBrush::GetStyle() const
|
||||
{
|
||||
if (m_refData == NULL)
|
||||
{
|
||||
@@ -123,25 +116,25 @@ int wxBrush::GetStyle(void) const
|
||||
return M_BRUSHDATA->m_style;
|
||||
}
|
||||
|
||||
wxColour &wxBrush::GetColour(void) const
|
||||
wxColour &wxBrush::GetColour() const
|
||||
{
|
||||
if (m_refData == NULL)
|
||||
{
|
||||
wxFAIL_MSG( "invalid brush" );
|
||||
return wxNullColour;
|
||||
}
|
||||
|
||||
|
||||
return M_BRUSHDATA->m_colour;
|
||||
}
|
||||
|
||||
wxBitmap *wxBrush::GetStipple(void) const
|
||||
wxBitmap *wxBrush::GetStipple() const
|
||||
{
|
||||
if (m_refData == NULL)
|
||||
{
|
||||
wxFAIL_MSG( "invalid brush" );
|
||||
return &wxNullBitmap;
|
||||
}
|
||||
|
||||
|
||||
return &M_BRUSHDATA->m_stipple;
|
||||
}
|
||||
|
||||
@@ -169,7 +162,7 @@ void wxBrush::SetStipple( const wxBitmap& stipple )
|
||||
M_BRUSHDATA->m_stipple = stipple;
|
||||
}
|
||||
|
||||
void wxBrush::Unshare(void)
|
||||
void wxBrush::Unshare()
|
||||
{
|
||||
if (!m_refData)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -23,15 +23,15 @@
|
||||
class wxColourRefData: public wxObjectRefData
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
wxColourRefData();
|
||||
~wxColourRefData();
|
||||
void FreeColour();
|
||||
|
||||
|
||||
GdkColor m_color;
|
||||
GdkColormap *m_colormap;
|
||||
bool m_hasPixel;
|
||||
|
||||
|
||||
friend wxColour;
|
||||
};
|
||||
|
||||
@@ -75,17 +75,17 @@ wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
|
||||
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
|
||||
M_COLDATA->m_color.pixel = 0;
|
||||
}
|
||||
|
||||
|
||||
void wxColour::InitFromName( const wxString &colourName )
|
||||
{
|
||||
wxNode *node = (wxNode *) NULL;
|
||||
if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
|
||||
if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
|
||||
{
|
||||
wxColour *col = (wxColour*)node->Data();
|
||||
UnRef();
|
||||
if (col) Ref( *col );
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
m_refData = new wxColourRefData();
|
||||
if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
|
||||
@@ -98,34 +98,29 @@ void wxColour::InitFromName( const wxString &colourName )
|
||||
}
|
||||
|
||||
wxColour::wxColour( const wxColour& col )
|
||||
{
|
||||
Ref( col );
|
||||
}
|
||||
|
||||
wxColour::wxColour( const wxColour* col )
|
||||
{
|
||||
if (col) Ref( *col );
|
||||
{
|
||||
Ref( col );
|
||||
}
|
||||
|
||||
wxColour::~wxColour()
|
||||
{
|
||||
}
|
||||
|
||||
wxColour& wxColour::operator = ( const wxColour& col )
|
||||
{
|
||||
if (*this == col) return (*this);
|
||||
Ref( col );
|
||||
return *this;
|
||||
wxColour& wxColour::operator = ( const wxColour& col )
|
||||
{
|
||||
if (*this == col) return (*this);
|
||||
Ref( col );
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool wxColour::operator == ( const wxColour& col )
|
||||
{
|
||||
return m_refData == col.m_refData;
|
||||
bool wxColour::operator == ( const wxColour& col )
|
||||
{
|
||||
return m_refData == col.m_refData;
|
||||
}
|
||||
|
||||
bool wxColour::operator != ( const wxColour& col)
|
||||
{
|
||||
return m_refData != col.m_refData;
|
||||
bool wxColour::operator != ( const wxColour& col)
|
||||
{
|
||||
return m_refData != col.m_refData;
|
||||
}
|
||||
|
||||
void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
|
||||
@@ -145,7 +140,7 @@ unsigned char wxColour::Red() const
|
||||
wxFAIL_MSG( "invalid colour" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return (unsigned char)(M_COLDATA->m_color.red >> SHIFT);
|
||||
}
|
||||
|
||||
@@ -156,7 +151,7 @@ unsigned char wxColour::Green() const
|
||||
wxFAIL_MSG( "invalid colour" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return (unsigned char)(M_COLDATA->m_color.green >> SHIFT);
|
||||
}
|
||||
|
||||
@@ -167,7 +162,7 @@ unsigned char wxColour::Blue() const
|
||||
wxFAIL_MSG( "invalid colour" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
|
||||
}
|
||||
|
||||
@@ -179,10 +174,10 @@ bool wxColour::Ok() const
|
||||
void wxColour::CalcPixel( GdkColormap *cmap )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
|
||||
if ((M_COLDATA->m_hasPixel) && (M_COLDATA->m_colormap == cmap)) return;
|
||||
M_COLDATA->FreeColour();
|
||||
|
||||
|
||||
GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap;
|
||||
if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
|
||||
(private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR))
|
||||
@@ -199,7 +194,7 @@ void wxColour::CalcPixel( GdkColormap *cmap )
|
||||
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
|
||||
if (sum < max) { index = i; max = sum; }
|
||||
}
|
||||
|
||||
|
||||
M_COLDATA->m_hasPixel = TRUE;
|
||||
M_COLDATA->m_color.pixel = index;
|
||||
}
|
||||
@@ -207,21 +202,21 @@ void wxColour::CalcPixel( GdkColormap *cmap )
|
||||
{
|
||||
M_COLDATA->m_hasPixel = gdk_color_alloc( cmap, &M_COLDATA->m_color );
|
||||
}
|
||||
|
||||
|
||||
M_COLDATA->m_colormap = cmap;
|
||||
}
|
||||
|
||||
int wxColour::GetPixel() const
|
||||
{
|
||||
if (!Ok()) return 0;
|
||||
|
||||
|
||||
return M_COLDATA->m_color.pixel;
|
||||
}
|
||||
|
||||
GdkColor *wxColour::GetColor() const
|
||||
{
|
||||
if (!Ok()) return (GdkColor *) NULL;
|
||||
|
||||
|
||||
return &M_COLDATA->m_color;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -21,19 +21,19 @@
|
||||
class wxCursorRefData: public wxObjectRefData
|
||||
{
|
||||
public:
|
||||
|
||||
wxCursorRefData(void);
|
||||
~wxCursorRefData(void);
|
||||
|
||||
|
||||
wxCursorRefData();
|
||||
~wxCursorRefData();
|
||||
|
||||
GdkCursor *m_cursor;
|
||||
};
|
||||
|
||||
wxCursorRefData::wxCursorRefData(void)
|
||||
wxCursorRefData::wxCursorRefData()
|
||||
{
|
||||
m_cursor = (GdkCursor *) NULL;
|
||||
}
|
||||
|
||||
wxCursorRefData::~wxCursorRefData(void)
|
||||
wxCursorRefData::~wxCursorRefData()
|
||||
{
|
||||
if (m_cursor) gdk_cursor_destroy( m_cursor );
|
||||
}
|
||||
@@ -44,14 +44,14 @@ wxCursorRefData::~wxCursorRefData(void)
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxCursor,wxObject)
|
||||
|
||||
wxCursor::wxCursor(void)
|
||||
wxCursor::wxCursor()
|
||||
{
|
||||
}
|
||||
|
||||
wxCursor::wxCursor( int cursorId )
|
||||
{
|
||||
m_refData = new wxCursorRefData();
|
||||
|
||||
|
||||
GdkCursorType gdk_cur = GDK_LEFT_PTR;
|
||||
switch (cursorId)
|
||||
{
|
||||
@@ -67,12 +67,12 @@ wxCursor::wxCursor( int cursorId )
|
||||
case wxCURSOR_PENCIL: gdk_cur = GDK_PENCIL; break;
|
||||
case wxCURSOR_NO_ENTRY: gdk_cur = GDK_PIRATE; break;
|
||||
}
|
||||
|
||||
|
||||
M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur );
|
||||
|
||||
|
||||
/*
|
||||
do that yourself
|
||||
|
||||
|
||||
wxCURSOR_BULLSEYE,
|
||||
wxCURSOR_CHAR,
|
||||
wxCURSOR_LEFT_BUTTON,
|
||||
@@ -95,7 +95,7 @@ wxCursor::wxCursor( int cursorId )
|
||||
wxCURSOR_BASED_ARROW_UP,
|
||||
wxCURSOR_BASED_ARROW_DOWN
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
wxCursor::wxCursor( const wxCursor &cursor )
|
||||
@@ -103,39 +103,33 @@ wxCursor::wxCursor( const wxCursor &cursor )
|
||||
Ref( cursor );
|
||||
}
|
||||
|
||||
wxCursor::wxCursor( const wxCursor *cursor )
|
||||
{
|
||||
UnRef();
|
||||
if (cursor) Ref( *cursor );
|
||||
}
|
||||
|
||||
wxCursor::~wxCursor(void)
|
||||
wxCursor::~wxCursor()
|
||||
{
|
||||
}
|
||||
|
||||
wxCursor& wxCursor::operator = ( const wxCursor& cursor )
|
||||
{
|
||||
if (*this == cursor) return (*this);
|
||||
Ref( cursor );
|
||||
return *this;
|
||||
if (*this == cursor) return (*this);
|
||||
Ref( cursor );
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool wxCursor::operator == ( const wxCursor& cursor )
|
||||
bool wxCursor::operator == ( const wxCursor& cursor ) const
|
||||
{
|
||||
return m_refData == cursor.m_refData;
|
||||
return m_refData == cursor.m_refData;
|
||||
}
|
||||
|
||||
bool wxCursor::operator != ( const wxCursor& cursor )
|
||||
bool wxCursor::operator != ( const wxCursor& cursor ) const
|
||||
{
|
||||
return m_refData != cursor.m_refData;
|
||||
return m_refData != cursor.m_refData;
|
||||
}
|
||||
|
||||
bool wxCursor::Ok(void) const
|
||||
bool wxCursor::Ok() const
|
||||
{
|
||||
return (m_refData != NULL);
|
||||
}
|
||||
|
||||
GdkCursor *wxCursor::GetCursor(void) const
|
||||
GdkCursor *wxCursor::GetCursor() const
|
||||
{
|
||||
return M_CURSORDATA->m_cursor;
|
||||
}
|
||||
@@ -146,7 +140,7 @@ GdkCursor *wxCursor::GetCursor(void) const
|
||||
|
||||
bool g_isBusy = FALSE;
|
||||
|
||||
void wxEndBusyCursor(void)
|
||||
void wxEndBusyCursor()
|
||||
{
|
||||
g_isBusy = FALSE;
|
||||
}
|
||||
@@ -156,7 +150,7 @@ void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
|
||||
g_isBusy = TRUE;
|
||||
}
|
||||
|
||||
bool wxIsBusy(void)
|
||||
bool wxIsBusy()
|
||||
{
|
||||
return g_isBusy;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -42,14 +42,14 @@ extern wxList wxPendingDelete;
|
||||
static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
|
||||
{
|
||||
if (!win->HasVMT()) return;
|
||||
|
||||
|
||||
/*
|
||||
printf( "OnFrameResize from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
printf( win->GetClassInfo()->GetClassName() );
|
||||
printf( ".\n" );
|
||||
*/
|
||||
|
||||
|
||||
if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
|
||||
{
|
||||
win->m_sizeSet = FALSE;
|
||||
@@ -83,10 +83,10 @@ static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WX
|
||||
static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
|
||||
{
|
||||
if (!win->HasVMT()) return FALSE;
|
||||
|
||||
|
||||
win->m_x = event->x;
|
||||
win->m_y = event->y;
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
long style, const wxString &name )
|
||||
{
|
||||
wxTopLevelWindows.Append( this );
|
||||
|
||||
|
||||
m_needParent = FALSE;
|
||||
|
||||
PreCreation( parent, id, pos, size, style, name );
|
||||
@@ -139,9 +139,9 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
|
||||
GtkWindowType win_type = GTK_WINDOW_TOPLEVEL;
|
||||
if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP;
|
||||
|
||||
|
||||
m_widget = gtk_window_new( win_type );
|
||||
|
||||
|
||||
if ((size.x != -1) && (size.y != -1))
|
||||
gtk_widget_set_usize( m_widget, m_width, m_height );
|
||||
if ((pos.x != -1) && (pos.y != -1))
|
||||
@@ -166,11 +166,11 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
|
||||
GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
|
||||
|
||||
|
||||
if (m_parent) m_parent->AddChild( this );
|
||||
|
||||
|
||||
PostCreation();
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -187,17 +187,17 @@ wxFrame::~wxFrame()
|
||||
bool wxFrame::Show( bool show )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
|
||||
|
||||
if (show && !m_sizeSet)
|
||||
{
|
||||
// by calling GtkOnSize here, we don't have to call
|
||||
// either after showing the frame, which would entail
|
||||
// much ugly flicker nor from within the size_allocate
|
||||
// handler, because GTK 1.1.X forbids that.
|
||||
|
||||
// by calling GtkOnSize here, we don't have to call
|
||||
// either after showing the frame, which would entail
|
||||
// much ugly flicker nor from within the size_allocate
|
||||
// handler, because GTK 1.1.X forbids that.
|
||||
|
||||
GtkOnSize( m_x, m_y, m_width, m_height );
|
||||
}
|
||||
|
||||
|
||||
return wxWindow::Show( show );
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ void wxFrame::OnCloseWindow( wxCloseEvent &event )
|
||||
bool wxFrame::Destroy()
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
|
||||
|
||||
if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
|
||||
|
||||
return TRUE;
|
||||
@@ -236,7 +236,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const
|
||||
void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
||||
|
||||
|
||||
// Don't do anything for children of wxMDIChildFrame
|
||||
if (!m_wxwindow) return;
|
||||
|
||||
@@ -247,7 +247,7 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
|
||||
int old_y = m_y;
|
||||
int old_width = m_width;
|
||||
int old_height = m_height;
|
||||
|
||||
|
||||
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
|
||||
{
|
||||
if (x != -1) m_x = x;
|
||||
@@ -272,7 +272,7 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
|
||||
{
|
||||
if (height == -1) m_height = 26;
|
||||
}
|
||||
|
||||
|
||||
if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
|
||||
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
|
||||
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
|
||||
@@ -280,15 +280,15 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
|
||||
|
||||
if ((m_x != -1) || (m_y != -1))
|
||||
{
|
||||
if ((m_x != old_x) || (m_y != old_y))
|
||||
if ((m_x != old_x) || (m_y != old_y))
|
||||
gtk_widget_set_uposition( m_widget, m_x, m_y );
|
||||
}
|
||||
|
||||
|
||||
if ((m_width != old_width) || (m_height != old_height))
|
||||
{
|
||||
gtk_widget_set_usize( m_widget, m_width, m_height );
|
||||
}
|
||||
|
||||
|
||||
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent( event );
|
||||
@@ -304,20 +304,20 @@ void wxFrame::SetSize( int width, int height )
|
||||
void wxFrame::Centre( int direction )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
|
||||
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
|
||||
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
|
||||
|
||||
|
||||
Move( x, y );
|
||||
}
|
||||
|
||||
void wxFrame::GetClientSize( int *width, int *height ) const
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
|
||||
|
||||
wxWindow::GetClientSize( width, height );
|
||||
if (height)
|
||||
{
|
||||
@@ -340,7 +340,7 @@ void wxFrame::GetClientSize( int *width, int *height ) const
|
||||
void wxFrame::SetClientSize( int const width, int const height )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
|
||||
|
||||
int h = height;
|
||||
if (m_frameMenuBar) h += wxMENU_HEIGHT;
|
||||
if (m_frameStatusBar) h += wxSTATUS_HEIGHT;
|
||||
@@ -361,35 +361,35 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
||||
|
||||
if (m_resizing) return;
|
||||
m_resizing = TRUE;
|
||||
|
||||
|
||||
if (!m_wxwindow) return;
|
||||
|
||||
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
|
||||
|
||||
if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
|
||||
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
|
||||
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
|
||||
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
|
||||
|
||||
gtk_widget_set_usize( m_widget, m_width, m_height );
|
||||
|
||||
|
||||
// this emulates the new wxMSW behaviour of placing all
|
||||
// frame-subwindows (menu, toolbar..) on one native window
|
||||
// OK, 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 (m_frameMenuBar)
|
||||
{
|
||||
int xx = m_miniEdge;
|
||||
int yy = m_miniEdge + m_miniTitle;
|
||||
int ww = m_width - 2*m_miniEdge;
|
||||
int hh = wxMENU_HEIGHT;
|
||||
int yy = m_miniEdge + m_miniTitle;
|
||||
int ww = m_width - 2*m_miniEdge;
|
||||
int hh = wxMENU_HEIGHT;
|
||||
m_frameMenuBar->m_x = xx;
|
||||
m_frameMenuBar->m_y = yy;
|
||||
m_frameMenuBar->m_width = ww;
|
||||
m_frameMenuBar->m_height = hh;
|
||||
|
||||
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy );
|
||||
gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh );
|
||||
}
|
||||
@@ -397,42 +397,42 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
||||
if (m_frameToolBar)
|
||||
{
|
||||
int xx = m_miniEdge;
|
||||
int yy = m_miniEdge + m_miniTitle;
|
||||
int yy = m_miniEdge + m_miniTitle;
|
||||
if (m_frameMenuBar) yy += wxMENU_HEIGHT;
|
||||
int ww = m_width - 2*m_miniEdge;
|
||||
int ww = m_width - 2*m_miniEdge;
|
||||
int hh = m_frameToolBar->m_height;
|
||||
|
||||
m_frameToolBar->m_x = xx;
|
||||
|
||||
m_frameToolBar->m_x = xx;
|
||||
m_frameToolBar->m_y = yy;
|
||||
m_frameToolBar->m_height = hh;
|
||||
m_frameToolBar->m_width = ww;
|
||||
|
||||
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, xx, yy );
|
||||
gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh );
|
||||
}
|
||||
|
||||
|
||||
if (m_frameStatusBar)
|
||||
{
|
||||
int xx = 0 + m_miniEdge;
|
||||
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge;
|
||||
int ww = m_width - 2*m_miniEdge;
|
||||
int hh = wxSTATUS_HEIGHT;
|
||||
|
||||
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge;
|
||||
int ww = m_width - 2*m_miniEdge;
|
||||
int hh = wxSTATUS_HEIGHT;
|
||||
|
||||
m_frameStatusBar->m_x = xx;
|
||||
m_frameStatusBar->m_y = yy;
|
||||
m_frameStatusBar->m_width = ww;
|
||||
m_frameStatusBar->m_height = hh;
|
||||
|
||||
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy );
|
||||
gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh );
|
||||
}
|
||||
|
||||
|
||||
m_sizeSet = TRUE;
|
||||
|
||||
|
||||
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent( event );
|
||||
|
||||
|
||||
m_resizing = FALSE;
|
||||
}
|
||||
|
||||
@@ -440,23 +440,23 @@ void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
|
||||
{
|
||||
if (!m_sizeSet)
|
||||
GtkOnSize( m_x, m_y, m_width, m_height );
|
||||
|
||||
|
||||
DoMenuUpdates();
|
||||
}
|
||||
|
||||
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
|
||||
|
||||
if (GetAutoLayout())
|
||||
{
|
||||
Layout();
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// no child: go out !
|
||||
if (!GetChildren().First()) return;
|
||||
|
||||
|
||||
// do we have exactly one child?
|
||||
wxWindow *child = (wxWindow *) NULL;
|
||||
for(wxNode *node = GetChildren().First(); node; node = node->Next())
|
||||
@@ -470,7 +470,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// it's the second one: do nothing
|
||||
// it's the second one: do nothing
|
||||
if (child) return;
|
||||
child = win;
|
||||
}
|
||||
@@ -500,9 +500,9 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" );
|
||||
|
||||
|
||||
m_frameMenuBar = menuBar;
|
||||
|
||||
|
||||
if (m_frameMenuBar)
|
||||
{
|
||||
wxNode *node = m_frameMenuBar->m_menus.First();
|
||||
@@ -512,7 +512,7 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
|
||||
SetInvokingWindow( menu, this );
|
||||
node = node->Next();
|
||||
}
|
||||
|
||||
|
||||
if (m_frameMenuBar->m_parent != this)
|
||||
{
|
||||
m_frameMenuBar->m_parent = this;
|
||||
@@ -520,11 +520,11 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
|
||||
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
|
||||
}
|
||||
|
||||
wxMenuBar *wxFrame::GetMenuBar(void) const
|
||||
wxMenuBar *wxFrame::GetMenuBar() const
|
||||
{
|
||||
return m_frameMenuBar;
|
||||
}
|
||||
@@ -532,15 +532,15 @@ wxMenuBar *wxFrame::GetMenuBar(void) const
|
||||
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
|
||||
|
||||
wxCHECK_MSG( m_frameToolBar == NULL, FALSE, "recreating toolbar in wxFrame" );
|
||||
|
||||
m_frameToolBar = OnCreateToolBar( style, id, name );
|
||||
|
||||
|
||||
GetChildren().DeleteObject( m_frameToolBar );
|
||||
|
||||
|
||||
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
|
||||
|
||||
|
||||
return m_frameToolBar;
|
||||
}
|
||||
|
||||
@@ -549,33 +549,33 @@ wxToolBar* wxFrame::OnCreateToolBar( long style, wxWindowID id, const wxString&
|
||||
return new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
|
||||
}
|
||||
|
||||
wxToolBar *wxFrame::GetToolBar(void) const
|
||||
{
|
||||
return m_frameToolBar;
|
||||
wxToolBar *wxFrame::GetToolBar() const
|
||||
{
|
||||
return m_frameToolBar;
|
||||
}
|
||||
|
||||
wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
|
||||
|
||||
wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, "recreating status bar in wxFrame" );
|
||||
|
||||
m_frameStatusBar = OnCreateStatusBar( number, style, id, name );
|
||||
|
||||
|
||||
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
|
||||
|
||||
|
||||
return m_frameStatusBar;
|
||||
}
|
||||
|
||||
wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
|
||||
{
|
||||
wxStatusBar *statusBar = (wxStatusBar *) NULL;
|
||||
|
||||
|
||||
statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20), style, name);
|
||||
|
||||
|
||||
// Set the height according to the font and the border size
|
||||
wxClientDC dc(statusBar);
|
||||
dc.SetFont( *statusBar->GetFont() );
|
||||
dc.SetFont( statusBar->GetFont() );
|
||||
|
||||
long x, y;
|
||||
dc.GetTextExtent( "X", &x, &y );
|
||||
@@ -591,7 +591,7 @@ wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id,
|
||||
void wxFrame::SetStatusText(const wxString& text, int number)
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
|
||||
|
||||
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
|
||||
|
||||
m_frameStatusBar->SetStatusText(text, number);
|
||||
@@ -600,13 +600,13 @@ void wxFrame::SetStatusText(const wxString& text, int number)
|
||||
void wxFrame::SetStatusWidths(int n, const int widths_field[] )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
|
||||
|
||||
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
|
||||
|
||||
m_frameStatusBar->SetStatusWidths(n, widths_field);
|
||||
}
|
||||
|
||||
wxStatusBar *wxFrame::GetStatusBar(void) const
|
||||
wxStatusBar *wxFrame::GetStatusBar() const
|
||||
{
|
||||
return m_frameStatusBar;
|
||||
}
|
||||
@@ -614,7 +614,7 @@ wxStatusBar *wxFrame::GetStatusBar(void) const
|
||||
void wxFrame::SetTitle( const wxString &title )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
|
||||
|
||||
m_title = title;
|
||||
if (m_title.IsNull()) m_title = "";
|
||||
gtk_window_set_title( GTK_WINDOW(m_widget), title );
|
||||
@@ -623,14 +623,14 @@ void wxFrame::SetTitle( const wxString &title )
|
||||
void wxFrame::SetIcon( const wxIcon &icon )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
|
||||
|
||||
|
||||
m_icon = icon;
|
||||
if (!icon.Ok()) return;
|
||||
|
||||
|
||||
wxMask *mask = icon.GetMask();
|
||||
GdkBitmap *bm = (GdkBitmap *) NULL;
|
||||
if (mask) bm = mask->GetBitmap();
|
||||
|
||||
|
||||
gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
|
||||
}
|
||||
|
||||
|
||||
@@ -19,34 +19,29 @@
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap)
|
||||
|
||||
wxIcon::wxIcon( const char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
|
||||
wxBitmap( bits )
|
||||
wxIcon::wxIcon( const char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
|
||||
wxBitmap( bits )
|
||||
{
|
||||
}
|
||||
|
||||
wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
|
||||
wxBitmap( bits )
|
||||
|
||||
wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
|
||||
wxBitmap( bits )
|
||||
{
|
||||
}
|
||||
|
||||
wxIcon::wxIcon() : wxBitmap()
|
||||
{
|
||||
|
||||
wxIcon::wxIcon() : wxBitmap()
|
||||
{
|
||||
}
|
||||
|
||||
wxIcon::wxIcon( const wxIcon& icon ) : wxBitmap()
|
||||
{
|
||||
Ref(icon);
|
||||
}
|
||||
|
||||
wxIcon::wxIcon( const wxIcon* icon ) : wxBitmap()
|
||||
{
|
||||
if (icon) Ref(*icon);
|
||||
{
|
||||
Ref(icon);
|
||||
}
|
||||
|
||||
wxIcon& wxIcon::operator = ( const wxIcon& icon )
|
||||
{
|
||||
if (*this == icon) return (*this);
|
||||
Ref(icon);
|
||||
return *this;
|
||||
{
|
||||
if (*this == icon) return (*this);
|
||||
Ref(icon);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ wxMenuBar::wxMenuBar()
|
||||
m_menus.DeleteContents( TRUE );
|
||||
|
||||
m_menubar = gtk_menu_bar_new();
|
||||
|
||||
|
||||
m_widget = GTK_WIDGET(m_menubar);
|
||||
|
||||
PostCreation();
|
||||
@@ -159,7 +159,7 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
|
||||
wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id );
|
||||
event.SetEventObject( menu );
|
||||
event.SetInt(id );
|
||||
|
||||
|
||||
if (menu->m_callback)
|
||||
{
|
||||
(void) (*(menu->m_callback)) (*menu, event);
|
||||
@@ -187,7 +187,7 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu )
|
||||
wxCommandEvent event( wxEVT_MENU_HIGHLIGHT, id );
|
||||
event.SetEventObject( menu );
|
||||
event.SetInt(id );
|
||||
|
||||
|
||||
/* wxMSW doesn't call callback here either
|
||||
if (menu->m_callback)
|
||||
{
|
||||
@@ -218,22 +218,24 @@ wxMenuItem::wxMenuItem()
|
||||
m_menuItem = (GtkWidget *) NULL;
|
||||
}
|
||||
|
||||
// it's valid for this function to be called even if m_menuItem == NULL
|
||||
void wxMenuItem::SetName(const wxString& str)
|
||||
{
|
||||
wxCHECK_RET( m_menuItem, "invalid menu item" );
|
||||
|
||||
m_text = "";
|
||||
for ( const char *pc = str; *pc != '\0'; pc++ )
|
||||
for ( const char *pc = str; *pc != '\0'; pc++ )
|
||||
{
|
||||
if ( *pc == '&' )
|
||||
pc++; // skip it
|
||||
|
||||
m_text << *pc;
|
||||
}
|
||||
|
||||
GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child );
|
||||
|
||||
gtk_label_set( label, m_text.c_str());
|
||||
|
||||
if ( m_menuItem )
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child );
|
||||
|
||||
gtk_label_set( label, m_text.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void wxMenuItem::Check( bool check )
|
||||
@@ -246,12 +248,12 @@ void wxMenuItem::Check( bool check )
|
||||
gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check );
|
||||
}
|
||||
|
||||
void wxMenuItem::Enable( bool enable )
|
||||
{
|
||||
void wxMenuItem::Enable( bool enable )
|
||||
{
|
||||
wxCHECK_RET( m_menuItem, "invalid menu item" );
|
||||
|
||||
gtk_widget_set_sensitive( m_menuItem, enable );
|
||||
m_isEnabled = enable;
|
||||
m_isEnabled = enable;
|
||||
}
|
||||
|
||||
bool wxMenuItem::IsChecked() const
|
||||
@@ -279,11 +281,11 @@ wxMenu::wxMenu( const wxString& title, const wxFunction func )
|
||||
m_items.DeleteContents( TRUE );
|
||||
m_invokingWindow = (wxWindow *) NULL;
|
||||
m_menu = gtk_menu_new(); // Do not show!
|
||||
|
||||
|
||||
m_callback = func;
|
||||
m_eventHandler = this;
|
||||
m_clientData = (void*) NULL;
|
||||
|
||||
|
||||
if (m_title.IsNull()) m_title = "";
|
||||
if (m_title != "")
|
||||
{
|
||||
@@ -325,7 +327,7 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool
|
||||
const char *text = mitem->GetText();
|
||||
GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text)
|
||||
: gtk_menu_item_new_with_label(text);
|
||||
|
||||
|
||||
mitem->SetMenuItem(menuItem);
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
|
||||
@@ -466,7 +468,7 @@ wxMenuItem *wxMenu::FindItem(int id) const
|
||||
// Not finding anything here can be correct
|
||||
// when search the entire menu system for
|
||||
// an entry -> no error message.
|
||||
|
||||
|
||||
return (wxMenuItem *) NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,19 +22,19 @@
|
||||
class wxPaletteRefData: public wxObjectRefData
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
wxPaletteRefData(void);
|
||||
~wxPaletteRefData(void);
|
||||
|
||||
|
||||
GdkColormap *m_colormap;
|
||||
};
|
||||
|
||||
wxPaletteRefData::wxPaletteRefData(void)
|
||||
wxPaletteRefData::wxPaletteRefData()
|
||||
{
|
||||
m_colormap = (GdkColormap *) NULL;
|
||||
};
|
||||
|
||||
wxPaletteRefData::~wxPaletteRefData(void)
|
||||
wxPaletteRefData::~wxPaletteRefData()
|
||||
{
|
||||
if (m_colormap) gdk_colormap_unref( m_colormap );
|
||||
};
|
||||
@@ -45,7 +45,7 @@ wxPaletteRefData::~wxPaletteRefData(void)
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject)
|
||||
|
||||
wxPalette::wxPalette(void)
|
||||
wxPalette::wxPalette()
|
||||
{
|
||||
};
|
||||
|
||||
@@ -60,31 +60,25 @@ wxPalette::wxPalette( const wxPalette& palette )
|
||||
Ref( palette );
|
||||
};
|
||||
|
||||
wxPalette::wxPalette( const wxPalette* palette )
|
||||
{
|
||||
UnRef();
|
||||
if (palette) Ref( *palette );
|
||||
};
|
||||
|
||||
wxPalette::~wxPalette(void)
|
||||
wxPalette::~wxPalette()
|
||||
{
|
||||
};
|
||||
|
||||
wxPalette& wxPalette::operator = ( const wxPalette& palette )
|
||||
{
|
||||
if (*this == palette) return (*this);
|
||||
Ref( palette );
|
||||
return *this;
|
||||
if (*this == palette) return (*this);
|
||||
Ref( palette );
|
||||
return *this;
|
||||
};
|
||||
|
||||
bool wxPalette::operator == ( const wxPalette& palette )
|
||||
{
|
||||
return m_refData == palette.m_refData;
|
||||
return m_refData == palette.m_refData;
|
||||
};
|
||||
|
||||
bool wxPalette::operator != ( const wxPalette& palette )
|
||||
{
|
||||
return m_refData != palette.m_refData;
|
||||
return m_refData != palette.m_refData;
|
||||
};
|
||||
|
||||
bool wxPalette::Ok(void) const
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
class wxPenRefData: public wxObjectRefData
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
wxPenRefData(void);
|
||||
wxPenRefData(const wxPenRefData& data);
|
||||
|
||||
|
||||
int m_width;
|
||||
int m_style;
|
||||
int m_joinStyle;
|
||||
@@ -55,7 +55,7 @@ wxPenRefData::wxPenRefData( const wxPenRefData& data )
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject)
|
||||
|
||||
wxPen::wxPen(void)
|
||||
wxPen::wxPen()
|
||||
{
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
}
|
||||
@@ -66,7 +66,7 @@ wxPen::wxPen( const wxColour &colour, int width, int style )
|
||||
M_PENDATA->m_width = width;
|
||||
M_PENDATA->m_style = style;
|
||||
M_PENDATA->m_colour = colour;
|
||||
|
||||
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
}
|
||||
|
||||
@@ -76,14 +76,6 @@ wxPen::wxPen( const wxPen& pen )
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
}
|
||||
|
||||
wxPen::wxPen( const wxPen* pen )
|
||||
{
|
||||
UnRef();
|
||||
if (pen) Ref( *pen );
|
||||
|
||||
if (wxThePenList) wxThePenList->AddPen( this );
|
||||
}
|
||||
|
||||
wxPen::~wxPen()
|
||||
{
|
||||
if (wxThePenList) wxThePenList->RemovePen( this );
|
||||
@@ -91,19 +83,19 @@ wxPen::~wxPen()
|
||||
|
||||
wxPen& wxPen::operator = ( const wxPen& pen )
|
||||
{
|
||||
if (*this == pen) return (*this);
|
||||
Ref( pen );
|
||||
return *this;
|
||||
if (*this == pen) return (*this);
|
||||
Ref( pen );
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool wxPen::operator == ( const wxPen& pen )
|
||||
{
|
||||
return m_refData == pen.m_refData;
|
||||
return m_refData == pen.m_refData;
|
||||
}
|
||||
|
||||
bool wxPen::operator != ( const wxPen& pen )
|
||||
{
|
||||
return m_refData != pen.m_refData;
|
||||
return m_refData != pen.m_refData;
|
||||
}
|
||||
|
||||
void wxPen::SetColour( const wxColour &colour )
|
||||
@@ -145,35 +137,35 @@ void wxPen::SetWidth( int width )
|
||||
int wxPen::GetCap() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), -1, "invalid pen" );
|
||||
|
||||
|
||||
return M_PENDATA->m_capStyle;
|
||||
}
|
||||
|
||||
int wxPen::GetJoin() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), -1, "invalid pen" );
|
||||
|
||||
|
||||
return M_PENDATA->m_joinStyle;
|
||||
}
|
||||
|
||||
int wxPen::GetStyle() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), -1, "invalid pen" );
|
||||
|
||||
|
||||
return M_PENDATA->m_style;
|
||||
}
|
||||
|
||||
int wxPen::GetWidth() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), -1, "invalid pen" );
|
||||
|
||||
|
||||
return M_PENDATA->m_width;
|
||||
}
|
||||
|
||||
wxColour &wxPen::GetColour() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), wxNullColour, "invalid pen" );
|
||||
|
||||
|
||||
return M_PENDATA->m_colour;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
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;
|
||||
@@ -89,7 +89,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
0, 0);
|
||||
|
||||
// put the horizontal scrollbar in the lower left hand corner
|
||||
if (bHasHScrollbar)
|
||||
if (bHasHScrollbar)
|
||||
{
|
||||
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
|
||||
gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
|
||||
@@ -107,7 +107,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
0, 0);
|
||||
gtk_widget_show( vscrollbar );
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// a single-line text control: no need for scrollbars
|
||||
m_widget =
|
||||
@@ -122,10 +122,10 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
m_parent->AddChild( this );
|
||||
|
||||
(m_parent->m_insertCallback)( m_parent, this );
|
||||
|
||||
|
||||
PostCreation();
|
||||
|
||||
if (multi_line)
|
||||
if (multi_line)
|
||||
{
|
||||
gtk_widget_realize(m_text);
|
||||
gtk_widget_show(m_text);
|
||||
@@ -148,9 +148,9 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
if (!multi_line)
|
||||
gtk_entry_set_visibility( GTK_ENTRY(m_text), FALSE );
|
||||
}
|
||||
|
||||
|
||||
if (style & wxTE_READONLY)
|
||||
{
|
||||
{
|
||||
if (!multi_line)
|
||||
gtk_entry_set_editable( GTK_ENTRY(m_text), FALSE );
|
||||
}
|
||||
@@ -171,7 +171,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
wxString wxTextCtrl::GetValue() const
|
||||
{
|
||||
wxCHECK_MSG( m_text != NULL, "", "invalid text ctrl" );
|
||||
|
||||
|
||||
wxString tmp;
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
@@ -190,7 +190,7 @@ wxString wxTextCtrl::GetValue() const
|
||||
void wxTextCtrl::SetValue( const wxString &value )
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
|
||||
wxString tmp = "";
|
||||
if (!value.IsNull()) tmp = value;
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
@@ -209,7 +209,7 @@ void wxTextCtrl::SetValue( const wxString &value )
|
||||
void wxTextCtrl::WriteText( const wxString &text )
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
|
||||
if (text.IsNull()) return;
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
@@ -226,14 +226,14 @@ void wxTextCtrl::WriteText( const wxString &text )
|
||||
bool wxTextCtrl::LoadFile( const wxString &file )
|
||||
{
|
||||
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
|
||||
|
||||
|
||||
if (!wxFileExists(file)) return FALSE;
|
||||
|
||||
Clear();
|
||||
|
||||
FILE *fp = NULL;
|
||||
struct stat statb;
|
||||
|
||||
|
||||
if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG ||
|
||||
!(fp = fopen ((char*) (const char*) file, "r")))
|
||||
{
|
||||
@@ -254,7 +254,7 @@ bool wxTextCtrl::LoadFile( const wxString &file )
|
||||
fclose (fp);
|
||||
|
||||
text[len] = 0;
|
||||
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
gtk_editable_insert_text( GTK_EDITABLE(m_text), text, 0, &len );
|
||||
@@ -263,7 +263,7 @@ bool wxTextCtrl::LoadFile( const wxString &file )
|
||||
{
|
||||
gtk_entry_set_text( GTK_ENTRY(m_text), text );
|
||||
}
|
||||
|
||||
|
||||
free (text);
|
||||
m_modified = FALSE;
|
||||
return TRUE;
|
||||
@@ -274,9 +274,9 @@ bool wxTextCtrl::LoadFile( const wxString &file )
|
||||
bool wxTextCtrl::SaveFile( const wxString &file )
|
||||
{
|
||||
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
|
||||
|
||||
|
||||
if (file == "") return FALSE;
|
||||
|
||||
|
||||
FILE *fp;
|
||||
|
||||
if (!(fp = fopen ((char*) (const char*) file, "w")))
|
||||
@@ -287,7 +287,7 @@ bool wxTextCtrl::SaveFile( const wxString &file )
|
||||
{
|
||||
char *text = NULL;
|
||||
gint len = 0;
|
||||
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
len = gtk_text_get_length( GTK_TEXT(m_text) );
|
||||
@@ -297,20 +297,20 @@ bool wxTextCtrl::SaveFile( const wxString &file )
|
||||
{
|
||||
text = gtk_entry_get_text( GTK_ENTRY(m_text) );
|
||||
}
|
||||
|
||||
|
||||
if (fwrite (text, sizeof (char), len, fp) != (size_t) len)
|
||||
{
|
||||
// Did not write whole file
|
||||
}
|
||||
|
||||
|
||||
// Make sure newline terminates the file
|
||||
if (text[len - 1] != '\n')
|
||||
fputc ('\n', fp);
|
||||
|
||||
fclose (fp);
|
||||
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE) g_free( text );
|
||||
|
||||
|
||||
m_modified = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
@@ -337,7 +337,7 @@ wxString wxTextCtrl::GetLineText( long lineNo ) const
|
||||
int j;
|
||||
for (j = 0; text[i] && text[i] != '\n'; i++, j++ )
|
||||
buf += text[i];
|
||||
|
||||
|
||||
g_free( text );
|
||||
return buf;
|
||||
}
|
||||
@@ -366,7 +366,7 @@ long wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
|
||||
return 0;
|
||||
if( pos >= len)
|
||||
return pos=len-1;
|
||||
|
||||
|
||||
*x=1; // Col 1
|
||||
*y=1; // Line 1
|
||||
for (int i = 0; i < pos; i++ )
|
||||
@@ -378,7 +378,7 @@ long wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
|
||||
}
|
||||
else
|
||||
(*x)++;
|
||||
}
|
||||
}
|
||||
g_free( text );
|
||||
return 1;
|
||||
}
|
||||
@@ -388,7 +388,7 @@ long wxTextCtrl::XYToPosition(long x, long y ) const
|
||||
if (!(m_windowStyle & wxTE_MULTILINE))
|
||||
return 0;
|
||||
long pos=0;
|
||||
|
||||
|
||||
for(int i=1;i<y;i++)
|
||||
pos +=GetLineLength(i);
|
||||
pos +=x-1; // Pos start with 0
|
||||
@@ -414,7 +414,7 @@ int wxTextCtrl::GetNumberOfLines() const
|
||||
for (int i = 0; i < len; i++ )
|
||||
if (text[i] == '\n')
|
||||
currentLine++;
|
||||
|
||||
|
||||
g_free( text );
|
||||
return currentLine;
|
||||
}
|
||||
@@ -430,7 +430,7 @@ int wxTextCtrl::GetNumberOfLines() const
|
||||
void wxTextCtrl::SetInsertionPoint( long pos )
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
|
||||
int tmp = (int) pos;
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
gtk_text_set_point( GTK_TEXT(m_text), tmp );
|
||||
@@ -441,7 +441,7 @@ void wxTextCtrl::SetInsertionPoint( long pos )
|
||||
void wxTextCtrl::SetInsertionPointEnd()
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
|
||||
int pos = 0;
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
pos = gtk_text_get_length( GTK_TEXT(m_text) );
|
||||
@@ -453,7 +453,7 @@ void wxTextCtrl::SetInsertionPointEnd()
|
||||
void wxTextCtrl::SetEditable( bool editable )
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
gtk_text_set_editable( GTK_TEXT(m_text), editable );
|
||||
else
|
||||
@@ -463,7 +463,7 @@ void wxTextCtrl::SetEditable( bool editable )
|
||||
void wxTextCtrl::SetSelection( long from, long to )
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
|
||||
gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
|
||||
}
|
||||
|
||||
@@ -475,14 +475,14 @@ void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
|
||||
long wxTextCtrl::GetInsertionPoint() const
|
||||
{
|
||||
wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" );
|
||||
|
||||
|
||||
return (long) GTK_EDITABLE(m_text)->current_pos;
|
||||
}
|
||||
|
||||
long wxTextCtrl::GetLastPosition() const
|
||||
{
|
||||
wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" );
|
||||
|
||||
|
||||
int pos = 0;
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
pos = gtk_text_get_length( GTK_TEXT(m_text) );
|
||||
@@ -494,14 +494,14 @@ long wxTextCtrl::GetLastPosition() const
|
||||
void wxTextCtrl::Remove( long from, long to )
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
|
||||
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
|
||||
}
|
||||
|
||||
void wxTextCtrl::Replace( long from, long to, const wxString &value )
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
|
||||
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
|
||||
if (value.IsNull()) return;
|
||||
gint pos = (gint)to;
|
||||
@@ -511,7 +511,7 @@ void wxTextCtrl::Replace( long from, long to, const wxString &value )
|
||||
void wxTextCtrl::Cut()
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
|
||||
#if (GTK_MINOR_VERSION == 1)
|
||||
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) );
|
||||
#else
|
||||
@@ -522,7 +522,7 @@ void wxTextCtrl::Cut()
|
||||
void wxTextCtrl::Copy()
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
|
||||
#if (GTK_MINOR_VERSION == 1)
|
||||
gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) );
|
||||
#else
|
||||
@@ -533,7 +533,7 @@ void wxTextCtrl::Copy()
|
||||
void wxTextCtrl::Paste()
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
|
||||
#if (GTK_MINOR_VERSION == 1)
|
||||
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) );
|
||||
#else
|
||||
@@ -554,7 +554,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
|
||||
event.SetEventObject(this);
|
||||
if (GetEventHandler()->ProcessEvent(event)) return;
|
||||
}
|
||||
else if (key_event.KeyCode() == WXK_TAB)
|
||||
else if (key_event.KeyCode() == WXK_TAB)
|
||||
{
|
||||
wxNavigationKeyEvent event;
|
||||
event.SetDirection( key_event.m_shiftDown );
|
||||
@@ -659,14 +659,14 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
|
||||
void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) )
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
|
||||
// doesn't work
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) )
|
||||
{
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
|
||||
// doesn't work
|
||||
}
|
||||
|
||||
@@ -675,9 +675,9 @@ void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
|
||||
wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
|
||||
|
||||
wxControl::SetBackgroundColour( colour );
|
||||
|
||||
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
|
||||
if (m_windowStyle & wxTE_MULTILINE)
|
||||
{
|
||||
GdkWindow *window = GTK_TEXT(m_text)->text_area;
|
||||
|
||||
@@ -109,7 +109,7 @@ static char *GetIniFile(char *dest, const char *filename)
|
||||
return dest;
|
||||
}
|
||||
|
||||
static void wxXMergeDatabases(void)
|
||||
static void wxXMergeDatabases()
|
||||
{
|
||||
XrmDatabase homeDB, serverDB, applicationDB;
|
||||
char filenamebuf[1024];
|
||||
@@ -159,7 +159,7 @@ static void wxXMergeDatabases(void)
|
||||
// called on application exit
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void wxFlushResources(void)
|
||||
void wxFlushResources()
|
||||
{
|
||||
char nameBuffer[512];
|
||||
|
||||
|
||||
@@ -86,14 +86,14 @@
|
||||
this is (in most cases) the only GTK widget the class manages. E.g. the
|
||||
wxStatitText class handles only a GtkLabel widget a pointer to which you
|
||||
can find in m_widget (defined in wxWindow)
|
||||
|
||||
|
||||
When the class has a client area for drawing into and for containing children
|
||||
it has to handle the client area widget (of the type GtkMyFixed, defined in
|
||||
win_gtk.c), but there could be any number of widgets, handled by a class
|
||||
The common rule for all windows is only, that the widget that interacts with
|
||||
the rest of GTK must be referenced in m_widget and all other widgets must be
|
||||
children of this widget on the GTK level. The top-most widget, which also
|
||||
represents the client area, must be in the m_wxwindow field and must be of
|
||||
it has to handle the client area widget (of the type GtkMyFixed, defined in
|
||||
win_gtk.c), but there could be any number of widgets, handled by a class
|
||||
The common rule for all windows is only, that the widget that interacts with
|
||||
the rest of GTK must be referenced in m_widget and all other widgets must be
|
||||
children of this widget on the GTK level. The top-most widget, which also
|
||||
represents the client area, must be in the m_wxwindow field and must be of
|
||||
the type GtkMyFixed.
|
||||
|
||||
As I said, the window classes that display a GTK native widget only have
|
||||
@@ -504,7 +504,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
|
||||
|
||||
if (g_blockEventsOnDrag) return TRUE;
|
||||
if (g_blockEventsOnScroll) return TRUE;
|
||||
|
||||
|
||||
if (!win->HasVMT()) return TRUE;
|
||||
|
||||
/*
|
||||
@@ -762,7 +762,7 @@ static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
|
||||
|
||||
float line_step = win->m_hAdjust->step_increment;
|
||||
float page_step = win->m_hAdjust->page_increment;
|
||||
|
||||
|
||||
if (win->m_isScrolling)
|
||||
{
|
||||
command = wxEVT_SCROLL_THUMBTRACK;
|
||||
@@ -839,12 +839,12 @@ static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW
|
||||
// "button_press_event" from scrollbar
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
|
||||
GdkEventButton *WXUNUSED(gdk_event),
|
||||
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
|
||||
GdkEventButton *WXUNUSED(gdk_event),
|
||||
wxWindow *win )
|
||||
{
|
||||
// if (gdk_event->window != widget->slider) return FALSE;
|
||||
|
||||
|
||||
win->m_isScrolling = TRUE;
|
||||
g_blockEventsOnScroll = TRUE;
|
||||
|
||||
@@ -855,8 +855,8 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
|
||||
// "button_release_event" from scrollbar
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
|
||||
GdkEventButton *WXUNUSED(gdk_event),
|
||||
static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
|
||||
GdkEventButton *WXUNUSED(gdk_event),
|
||||
wxWindow *win )
|
||||
{
|
||||
|
||||
@@ -883,7 +883,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Callback for wxWindow. This very strange beast has to be used because
|
||||
// C++ has no virtual methods in a constructor. We have to emulate a
|
||||
// C++ has no virtual methods in a constructor. We have to emulate a
|
||||
// virtual function here as wxNotebook requires a different way to insert
|
||||
// a child in it. I had opted for creating a wxNotebookPage window class
|
||||
// which would have made this superflouus (such in the MDI window system),
|
||||
@@ -891,13 +891,13 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
|
||||
|
||||
static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
|
||||
{
|
||||
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
|
||||
GTK_WIDGET(child->m_widget),
|
||||
child->m_x,
|
||||
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
|
||||
GTK_WIDGET(child->m_widget),
|
||||
child->m_x,
|
||||
child->m_y );
|
||||
|
||||
gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
|
||||
child->m_width,
|
||||
gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
|
||||
child->m_width,
|
||||
child->m_height );
|
||||
}
|
||||
|
||||
@@ -920,7 +920,7 @@ wxWindow::wxWindow()
|
||||
m_wxwindow = (GtkWidget *) NULL;
|
||||
m_parent = (wxWindow *) NULL;
|
||||
m_children.DeleteContents( FALSE );
|
||||
|
||||
|
||||
m_x = 0;
|
||||
m_y = 0;
|
||||
m_width = 0;
|
||||
@@ -929,46 +929,46 @@ wxWindow::wxWindow()
|
||||
m_minHeight = -1;
|
||||
m_maxWidth = -1;
|
||||
m_maxHeight = -1;
|
||||
|
||||
|
||||
m_retCode = 0;
|
||||
|
||||
|
||||
m_eventHandler = this;
|
||||
m_windowValidator = (wxValidator *) NULL;
|
||||
|
||||
|
||||
m_windowId = -1;
|
||||
|
||||
|
||||
m_cursor = (wxCursor *) NULL;
|
||||
m_font = *wxSWISS_FONT;
|
||||
m_windowStyle = 0;
|
||||
m_windowName = "noname";
|
||||
|
||||
|
||||
m_constraints = (wxLayoutConstraints *) NULL;
|
||||
m_constraintsInvolvedIn = (wxList *) NULL;
|
||||
m_windowSizer = (wxSizer *) NULL;
|
||||
m_sizerParent = (wxWindow *) NULL;
|
||||
m_autoLayout = FALSE;
|
||||
|
||||
|
||||
m_sizeSet = FALSE;
|
||||
m_hasVMT = FALSE;
|
||||
m_needParent = TRUE;
|
||||
|
||||
|
||||
m_hasScrolling = FALSE;
|
||||
m_isScrolling = FALSE;
|
||||
m_hAdjust = (GtkAdjustment*) NULL;
|
||||
m_vAdjust = (GtkAdjustment*) NULL;
|
||||
m_oldHorizontalPos = 0.0;
|
||||
m_oldVerticalPos = 0.0;
|
||||
|
||||
|
||||
m_isShown = FALSE;
|
||||
m_isEnabled = TRUE;
|
||||
|
||||
|
||||
m_dropTarget = (wxDropTarget*) NULL;
|
||||
m_resizing = FALSE;
|
||||
m_scrollGC = (GdkGC*) NULL;
|
||||
m_widgetStyle = (GtkStyle*) NULL;
|
||||
|
||||
|
||||
m_insertCallback = wxInsertChildInWindow;
|
||||
|
||||
|
||||
m_clientObject = (wxClientData*) NULL;
|
||||
m_clientData = NULL;
|
||||
}
|
||||
@@ -980,7 +980,7 @@ wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
|
||||
m_insertCallback = wxInsertChildInWindow;
|
||||
Create( parent, id, pos, size, style, name );
|
||||
}
|
||||
|
||||
|
||||
bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
long style, const wxString &name )
|
||||
@@ -1058,7 +1058,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
||||
// these handlers block mouse events to any window during scrolling
|
||||
// such as motion events and prevent GTK and wxWindows from fighting
|
||||
// over where the slider should be
|
||||
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(s_window->vscrollbar), "button_press_event",
|
||||
(GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this );
|
||||
|
||||
@@ -1070,7 +1070,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_release_event",
|
||||
(GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
|
||||
|
||||
|
||||
// these handers het notified when screen updates are required either when
|
||||
// scrolling or when the window size (and therefore scrollbar configuration)
|
||||
// has changed
|
||||
@@ -1086,13 +1086,13 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
|
||||
(GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
|
||||
|
||||
gtk_widget_show( m_wxwindow );
|
||||
|
||||
|
||||
if (m_parent) m_parent->AddChild( this );
|
||||
|
||||
(m_parent->m_insertCallback)( m_parent, this );
|
||||
|
||||
|
||||
PostCreation();
|
||||
|
||||
|
||||
Show( TRUE );
|
||||
|
||||
return TRUE;
|
||||
@@ -1110,13 +1110,13 @@ wxWindow::~wxWindow()
|
||||
DestroyChildren();
|
||||
|
||||
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
|
||||
|
||||
|
||||
if (m_scrollGC) gdk_gc_unref( m_scrollGC );
|
||||
|
||||
|
||||
if (m_wxwindow) gtk_widget_destroy( m_wxwindow );
|
||||
|
||||
if (m_widget) gtk_widget_destroy( m_widget );
|
||||
|
||||
|
||||
if (m_cursor) delete m_cursor;
|
||||
|
||||
DeleteRelatedConstraints();
|
||||
@@ -1147,7 +1147,7 @@ wxWindow::~wxWindow()
|
||||
wxTopLevelWindows.DeleteObject(this);
|
||||
|
||||
if (m_windowValidator) delete m_windowValidator;
|
||||
|
||||
|
||||
if (m_clientObject) delete m_clientObject;
|
||||
}
|
||||
|
||||
@@ -1157,21 +1157,21 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
||||
{
|
||||
if (m_needParent && (parent == NULL))
|
||||
wxFatalError( "Need complete parent.", name );
|
||||
|
||||
|
||||
m_widget = (GtkWidget*) NULL;
|
||||
m_wxwindow = (GtkWidget*) NULL;
|
||||
m_hasVMT = FALSE;
|
||||
m_parent = parent;
|
||||
m_children.DeleteContents( FALSE );
|
||||
|
||||
|
||||
m_width = size.x;
|
||||
if (m_width == -1) m_width = 20;
|
||||
m_height = size.y;
|
||||
if (m_height == -1) m_height = 20;
|
||||
|
||||
|
||||
m_x = (int)pos.x;
|
||||
m_y = (int)pos.y;
|
||||
|
||||
|
||||
if (!m_needParent) // some reasonable defaults
|
||||
{
|
||||
if (m_x == -1)
|
||||
@@ -1185,49 +1185,49 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
||||
if (m_y < 10) m_y = 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_minWidth = -1;
|
||||
m_minHeight = -1;
|
||||
m_maxWidth = -1;
|
||||
m_maxHeight = -1;
|
||||
|
||||
|
||||
m_retCode = 0;
|
||||
|
||||
|
||||
m_eventHandler = this;
|
||||
|
||||
|
||||
m_windowId = id == -1 ? wxNewId() : id;
|
||||
|
||||
|
||||
m_sizeSet = FALSE;
|
||||
|
||||
|
||||
m_cursor = new wxCursor( wxCURSOR_ARROW );
|
||||
m_font = *wxSWISS_FONT;
|
||||
// m_backgroundColour = wxWHITE;
|
||||
// m_foregroundColour = wxBLACK;
|
||||
m_windowStyle = style;
|
||||
m_windowName = name;
|
||||
|
||||
|
||||
m_constraints = (wxLayoutConstraints *) NULL;
|
||||
m_constraintsInvolvedIn = (wxList *) NULL;
|
||||
m_windowSizer = (wxSizer *) NULL;
|
||||
m_sizerParent = (wxWindow *) NULL;
|
||||
m_autoLayout = FALSE;
|
||||
|
||||
|
||||
m_hasScrolling = FALSE;
|
||||
m_isScrolling = FALSE;
|
||||
m_hAdjust = (GtkAdjustment *) NULL;
|
||||
m_vAdjust = (GtkAdjustment *) NULL;
|
||||
m_oldHorizontalPos = 0.0;
|
||||
m_oldVerticalPos = 0.0;
|
||||
|
||||
|
||||
m_isShown = FALSE;
|
||||
m_isEnabled = TRUE;
|
||||
|
||||
|
||||
m_dropTarget = (wxDropTarget *) NULL;
|
||||
m_resizing = FALSE;
|
||||
m_windowValidator = (wxValidator *) NULL;
|
||||
m_scrollGC = (GdkGC*) NULL;
|
||||
m_widgetStyle = (GtkStyle*) NULL;
|
||||
|
||||
|
||||
m_clientObject = (wxClientData*)NULL;
|
||||
m_clientData = NULL;
|
||||
}
|
||||
@@ -1336,7 +1336,7 @@ void wxWindow::AdjustForParentClientOrigin( int& x, int& y, int sizeFlags )
|
||||
if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent())
|
||||
{
|
||||
wxPoint pt(GetParent()->GetClientAreaOrigin());
|
||||
x += pt.x;
|
||||
x += pt.x;
|
||||
y += pt.y;
|
||||
}
|
||||
}
|
||||
@@ -1345,7 +1345,7 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
||||
wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" );
|
||||
|
||||
|
||||
if (m_resizing) return; // I don't like recursions
|
||||
m_resizing = TRUE;
|
||||
|
||||
@@ -1361,7 +1361,7 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
|
||||
{
|
||||
int old_width = m_width;
|
||||
int old_height = m_height;
|
||||
|
||||
|
||||
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
|
||||
{
|
||||
if (x != -1) m_x = x;
|
||||
@@ -1386,7 +1386,7 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
|
||||
{
|
||||
if (height == -1) m_height = 26;
|
||||
}
|
||||
|
||||
|
||||
if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
|
||||
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
|
||||
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
|
||||
@@ -1394,11 +1394,11 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
|
||||
|
||||
wxPoint pt( m_parent->GetClientAreaOrigin() );
|
||||
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y );
|
||||
|
||||
|
||||
if ((old_width != m_width) || (old_height != m_height))
|
||||
gtk_widget_set_usize( m_widget, m_width, m_height );
|
||||
}
|
||||
|
||||
|
||||
m_sizeSet = TRUE;
|
||||
|
||||
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
|
||||
@@ -1457,7 +1457,7 @@ void wxWindow::SetClientSize( int width, int height )
|
||||
|
||||
#ifdef NEW_GTK_SCROLL_CODE
|
||||
GtkWidget *viewport = scroll_window->child;
|
||||
#else
|
||||
#else
|
||||
GtkWidget *viewport = scroll_window->viewport;
|
||||
#endif
|
||||
|
||||
@@ -1522,7 +1522,7 @@ void wxWindow::GetClientSize( int *width, int *height ) const
|
||||
|
||||
#ifdef NEW_GTK_SCROLL_CODE
|
||||
GtkWidget *viewport = scroll_window->child;
|
||||
#else
|
||||
#else
|
||||
GtkWidget *viewport = scroll_window->viewport;
|
||||
#endif
|
||||
|
||||
@@ -1589,7 +1589,7 @@ void wxWindow::ClientToScreen( int *x, int *y )
|
||||
wxPoint pt(GetClientAreaOrigin());
|
||||
org_x += pt.x;
|
||||
org_y += pt.y;
|
||||
|
||||
|
||||
if (x) *x += org_x;
|
||||
if (y) *y += org_y;
|
||||
}
|
||||
@@ -1620,7 +1620,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
|
||||
wxPoint pt(GetClientAreaOrigin());
|
||||
org_x -= pt.x;
|
||||
org_y -= pt.y;
|
||||
|
||||
|
||||
if (x) *x -= org_x;
|
||||
if (y) *y -= org_y;
|
||||
}
|
||||
@@ -1631,7 +1631,7 @@ void wxWindow::Centre( int direction )
|
||||
|
||||
int x = m_x;
|
||||
int y = m_y;
|
||||
|
||||
|
||||
if (m_parent)
|
||||
{
|
||||
int p_w = 0;
|
||||
@@ -1645,7 +1645,7 @@ void wxWindow::Centre( int direction )
|
||||
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
|
||||
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
|
||||
}
|
||||
|
||||
|
||||
Move( x, y );
|
||||
}
|
||||
|
||||
@@ -1655,7 +1655,7 @@ void wxWindow::Fit()
|
||||
|
||||
int maxX = 0;
|
||||
int maxY = 0;
|
||||
wxNode *node = m_childrenFirst();
|
||||
wxNode *node = m_children.First();
|
||||
while ( node )
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
@@ -1803,25 +1803,20 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
m_children.Append( child );
|
||||
}
|
||||
|
||||
wxList& wxWindow::GetChildren() const
|
||||
{
|
||||
return m_children;
|
||||
}
|
||||
|
||||
wxWindow *wxWindow::ReParent( wxWindow *newParent )
|
||||
{
|
||||
wxWindow *oldParent = GetParent();
|
||||
|
||||
|
||||
if (oldParent) oldParent->RemoveChild( this );
|
||||
|
||||
|
||||
gtk_widget_unparent( m_widget );
|
||||
|
||||
|
||||
if (newParent)
|
||||
{
|
||||
newParent->AddChild( this );
|
||||
(newParent->m_insertCallback)( newParent, this );
|
||||
}
|
||||
|
||||
|
||||
return oldParent;
|
||||
}
|
||||
|
||||
@@ -1855,7 +1850,7 @@ void wxWindow::Lower()
|
||||
if (m_widget) gdk_window_lower( m_widget->window );
|
||||
}
|
||||
|
||||
wxEvtHandler *wxWindow::GetEventHandler()
|
||||
wxEvtHandler *wxWindow::GetEventHandler() const
|
||||
{
|
||||
return m_eventHandler;
|
||||
}
|
||||
@@ -1934,7 +1929,7 @@ void wxWindow::SetId( wxWindowID id )
|
||||
m_windowId = id;
|
||||
}
|
||||
|
||||
wxWindowID wxWindow::GetId()
|
||||
wxWindowID wxWindow::GetId() const
|
||||
{
|
||||
return m_windowId;
|
||||
}
|
||||
@@ -1951,7 +1946,8 @@ void wxWindow::SetCursor( const wxCursor &cursor )
|
||||
|
||||
if (cursor.Ok())
|
||||
{
|
||||
if (*((wxCursor*)&cursor) == m_cursor) return;
|
||||
if ( cursor == *m_cursor )
|
||||
return;
|
||||
*m_cursor = cursor;
|
||||
}
|
||||
else
|
||||
@@ -2054,13 +2050,13 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
|
||||
wxCHECK_RET( m_widget != NULL, "invalid window" );
|
||||
|
||||
if (m_backgroundColour == colour) return;
|
||||
|
||||
|
||||
if (!m_backgroundColour.Ok())
|
||||
if (wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) == colour) return;
|
||||
|
||||
|
||||
m_backgroundColour = colour;
|
||||
if (!m_backgroundColour.Ok()) return;
|
||||
|
||||
|
||||
if (m_wxwindow)
|
||||
{
|
||||
GdkWindow *window = m_wxwindow->window;
|
||||
@@ -2068,7 +2064,7 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
|
||||
gdk_window_set_background( window, m_backgroundColour.GetColor() );
|
||||
gdk_window_clear( window );
|
||||
}
|
||||
|
||||
|
||||
ApplyWidgetStyle();
|
||||
}
|
||||
|
||||
@@ -2082,31 +2078,31 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
|
||||
wxCHECK_RET( m_widget != NULL, "invalid window" );
|
||||
|
||||
if (m_foregroundColour == colour) return;
|
||||
|
||||
|
||||
m_foregroundColour = colour;
|
||||
if (!m_foregroundColour.Ok()) return;
|
||||
|
||||
|
||||
ApplyWidgetStyle();
|
||||
}
|
||||
|
||||
GtkStyle *wxWindow::GetWidgetStyle()
|
||||
{
|
||||
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
|
||||
|
||||
m_widgetStyle =
|
||||
gtk_style_copy(
|
||||
|
||||
m_widgetStyle =
|
||||
gtk_style_copy(
|
||||
gtk_widget_get_style( m_widget ) );
|
||||
|
||||
|
||||
return m_widgetStyle;
|
||||
}
|
||||
|
||||
void wxWindow::SetWidgetStyle()
|
||||
{
|
||||
GtkStyle *style = GetWidgetStyle();
|
||||
|
||||
|
||||
gdk_font_unref( style->font );
|
||||
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
|
||||
|
||||
|
||||
if (m_foregroundColour.Ok())
|
||||
{
|
||||
m_foregroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) );
|
||||
@@ -2114,7 +2110,7 @@ void wxWindow::SetWidgetStyle()
|
||||
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
|
||||
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
|
||||
}
|
||||
|
||||
|
||||
if (m_backgroundColour.Ok())
|
||||
{
|
||||
m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) );
|
||||
@@ -2219,7 +2215,7 @@ bool wxWindow::PopupMenu( wxMenu *menu, int WXUNUSED(x), int WXUNUSED(y) )
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" );
|
||||
|
||||
wxCHECK_MSG( menu != NULL, FALSE, "invalid popup-menu" );
|
||||
|
||||
|
||||
SetInvokingWindow( menu, this );
|
||||
gtk_menu_popup(
|
||||
GTK_MENU(menu->m_menu),
|
||||
@@ -2274,13 +2270,8 @@ void wxWindow::SetFont( const wxFont &font )
|
||||
m_font = font;
|
||||
else
|
||||
m_font = *wxSWISS_FONT;
|
||||
|
||||
ApplyWidgetStyle();
|
||||
}
|
||||
|
||||
wxFont *wxWindow::GetFont()
|
||||
{
|
||||
return &m_font;
|
||||
ApplyWidgetStyle();
|
||||
}
|
||||
|
||||
void wxWindow::SetWindowStyleFlag( long flag )
|
||||
@@ -2392,7 +2383,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" );
|
||||
|
||||
if (!m_wxwindow) return;
|
||||
|
||||
|
||||
m_hasScrolling = TRUE;
|
||||
|
||||
if (orient == wxHORIZONTAL)
|
||||
@@ -2556,13 +2547,13 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
|
||||
int d_y = 0;
|
||||
if (dx > 0) d_x = dx;
|
||||
if (dy > 0) d_y = dy;
|
||||
|
||||
|
||||
if (!m_scrollGC)
|
||||
{
|
||||
m_scrollGC = gdk_gc_new( m_wxwindow->window );
|
||||
gdk_gc_set_exposures( m_scrollGC, TRUE );
|
||||
}
|
||||
|
||||
|
||||
gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y,
|
||||
m_wxwindow->window, s_x, s_y, w, h );
|
||||
|
||||
@@ -2795,7 +2786,7 @@ bool wxWindow::DoPhase(int phase)
|
||||
{
|
||||
noChanges = 0;
|
||||
noFailures = 0;
|
||||
wxNode *node = m_children.first();
|
||||
wxNode *node = m_children.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow *)node->Data();
|
||||
|
||||
Reference in New Issue
Block a user