Copied isql.h and isqlext.h to /include/wx/unix and make

it get installed.
  New code for "best_visual" under SGI and Sun.
  Typos in PostScrip code: HelvO and CourO.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5713 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2000-01-27 19:50:46 +00:00
parent d71fa6fb2e
commit d76fe38b29
13 changed files with 1492 additions and 72 deletions

View File

@@ -1,5 +1,5 @@
#
# This file was automatically generated by tmake at 23:25, 2000/01/24
# This file was automatically generated by tmake at 19:55, 2000/01/27
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE UNX.T!
#
@@ -559,6 +559,7 @@ MSW_HEADERS = \
msw/menu.h \
msw/menuitem.h \
msw/metafile.h \
msw/mimetype.h \
msw/minifram.h \
msw/msgdlg.h \
msw/msvcrt.h \
@@ -676,6 +677,8 @@ UNIX_HEADERS = \
unix/execute.h \
unix/fontutil.h \
unix/gsockunx.h \
unix/isql.h \
unix/isqlext.h \
unix/mimetype.h
GENERIC_HEADERS = \

View File

@@ -1040,6 +1040,8 @@ fontutil.h S
execute.h S
mimetype.h S B
gsockunx.h S
isql.h S
isqlext.h S
file.h P
ftp.h P

View File

@@ -51,8 +51,8 @@
#if wxMAJOR_VERSION == 2
extern "C" {
#include "../../src/iodbc/isql.h"
#include "../../src/iodbc/isqlext.h"
#include "wx/unix/isql.h"
#include "wx/unix/isqlext.h"
}
#else // version == 1
extern "C" {

230
include/wx/unix/isql.h Normal file
View File

@@ -0,0 +1,230 @@
/*
* isql.h
*
* $Id$
*
* iODBC defines
*
* The iODBC driver manager.
*
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _ISQL_H
#define _ISQL_H
#ifdef WIN32
#define SQL_API __stdcall
#else
#define FAR
#define EXPORT
#define CALLBACK
#define SQL_API EXPORT CALLBACK
typedef void *HWND;
#endif
typedef void *SQLHWND;
typedef unsigned char UCHAR;
typedef long int SDWORD;
typedef short int SWORD;
typedef unsigned long int UDWORD;
typedef unsigned short int UWORD;
typedef void FAR *PTR;
typedef void FAR *HENV;
typedef void FAR *HDBC;
typedef void FAR *HSTMT;
typedef signed short RETCODE;
#define SQLRETURN RETCODE
#define ODBCVER 0x0250
#define SQL_MAX_MESSAGE_LENGTH 512
#define SQL_MAX_DSN_LENGTH 32
/*
* Function return codes
*/
#define SQL_INVALID_HANDLE (-2)
#define SQL_ERROR (-1)
#define SQL_SUCCESS 0
#define SQL_SUCCESS_WITH_INFO 1
#define SQL_NO_DATA_FOUND 100
/*
* Standard SQL datatypes, using ANSI type numbering
*/
#define SQL_CHAR 1
#define SQL_NUMERIC 2
#define SQL_DECIMAL 3
#define SQL_INTEGER 4
#define SQL_SMALLINT 5
#define SQL_FLOAT 6
#define SQL_REAL 7
#define SQL_DOUBLE 8
#define SQL_VARCHAR 12
#define SQL_TYPE_MIN SQL_CHAR
#define SQL_TYPE_NULL 0
#define SQL_TYPE_MAX SQL_VARCHAR
/*
* C datatype to SQL datatype mapping
*/
#define SQL_C_CHAR SQL_CHAR
#define SQL_C_LONG SQL_INTEGER
#define SQL_C_SHORT SQL_SMALLINT
#define SQL_C_FLOAT SQL_REAL
#define SQL_C_DOUBLE SQL_DOUBLE
#define SQL_C_DEFAULT 99
/*
* NULL status constants.
*/
#define SQL_NO_NULLS 0
#define SQL_NULLABLE 1
#define SQL_NULLABLE_UNKNOWN 2
/*
* Special length values
*/
#define SQL_NULL_DATA (-1)
#define SQL_DATA_AT_EXEC (-2)
#define SQL_NTS (-3)
/*
* SQLFreeStmt
*/
#define SQL_CLOSE 0
#define SQL_DROP 1
#define SQL_UNBIND 2
#define SQL_RESET_PARAMS 3
/*
* SQLTransact
*/
#define SQL_COMMIT 0
#define SQL_ROLLBACK 1
/*
* SQLColAttributes
*/
#define SQL_COLUMN_COUNT 0
#define SQL_COLUMN_NAME 1
#define SQL_COLUMN_TYPE 2
#define SQL_COLUMN_LENGTH 3
#define SQL_COLUMN_PRECISION 4
#define SQL_COLUMN_SCALE 5
#define SQL_COLUMN_DISPLAY_SIZE 6
#define SQL_COLUMN_NULLABLE 7
#define SQL_COLUMN_UNSIGNED 8
#define SQL_COLUMN_MONEY 9
#define SQL_COLUMN_UPDATABLE 10
#define SQL_COLUMN_AUTO_INCREMENT 11
#define SQL_COLUMN_CASE_SENSITIVE 12
#define SQL_COLUMN_SEARCHABLE 13
#define SQL_COLUMN_TYPE_NAME 14
#define SQL_COLUMN_TABLE_NAME 15
#define SQL_COLUMN_OWNER_NAME 16
#define SQL_COLUMN_QUALIFIER_NAME 17
#define SQL_COLUMN_LABEL 18
#define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL
#define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT
#define SQL_COLUMN_DRIVER_START 1000
/*
* SQLColAttributes : SQL_COLUMN_UPDATABLE
*/
#define SQL_ATTR_READONLY 0
#define SQL_ATTR_WRITE 1
#define SQL_ATTR_READWRITE_UNKNOWN 2
/*
* SQLColAttributes : SQL_COLUMN_SEARCHABLE
*/
#define SQL_UNSEARCHABLE 0
#define SQL_LIKE_ONLY 1
#define SQL_ALL_EXCEPT_LIKE 2
#define SQL_SEARCHABLE 3
/*
* NULL Handles
*/
#define SQL_NULL_HENV 0
#define SQL_NULL_HDBC 0
#define SQL_NULL_HSTMT 0
/*
* Function Prototypes
*/
#ifdef __cplusplus
extern "C"
{
#endif
RETCODE SQL_API SQLAllocConnect (HENV henv, HDBC FAR * phdbc);
RETCODE SQL_API SQLAllocEnv (HENV FAR * phenv);
RETCODE SQL_API SQLAllocStmt (HDBC hdbc, HSTMT FAR * phstmt);
RETCODE SQL_API SQLBindCol (HSTMT hstmt, UWORD icol, SWORD fCType,
PTR rgbValue, SDWORD cbValueMax, SDWORD FAR * pcbValue);
RETCODE SQL_API SQLCancel (HSTMT hstmt);
RETCODE SQL_API SQLColAttributes (HSTMT hstmt, UWORD icol, UWORD fDescType,
PTR rgbDesc, SWORD cbDescMax, SWORD FAR * pcbDesc, SDWORD FAR * pfDesc);
RETCODE SQL_API SQLConnect (HDBC hdbc, UCHAR FAR * szDSN, SWORD cbDSN,
UCHAR FAR * szUID, SWORD cbUID, UCHAR FAR * szAuthStr, SWORD cbAuthStr);
RETCODE SQL_API SQLDescribeCol (HSTMT hstmt, UWORD icol,
UCHAR FAR * szColName, SWORD cbColNameMax, SWORD FAR * pcbColName,
SWORD FAR * pfSqlType, UDWORD FAR * pcbColDef, SWORD FAR * pibScale,
SWORD FAR * pfNullable);
RETCODE SQL_API SQLDisconnect (HDBC hdbc);
RETCODE SQL_API SQLError (HENV henv, HDBC hdbc, HSTMT hstmt,
UCHAR FAR * szSqlState, SDWORD FAR * pfNativeError, UCHAR FAR * szErrorMsg,
SWORD cbErrorMsgMax, SWORD FAR * pcbErrorMsg);
RETCODE SQL_API SQLExecDirect (HSTMT hstmt, UCHAR FAR * szSqlStr,
SDWORD cbSqlStr);
RETCODE SQL_API SQLExecute (HSTMT hstmt);
RETCODE SQL_API SQLFetch (HSTMT hstmt);
RETCODE SQL_API SQLFreeConnect (HDBC hdbc);
RETCODE SQL_API SQLFreeEnv (HENV henv);
RETCODE SQL_API SQLFreeStmt (HSTMT hstmt, UWORD fOption);
RETCODE SQL_API SQLGetCursorName (HSTMT hstmt, UCHAR FAR * szCursor,
SWORD cbCursorMax, SWORD FAR * pcbCursor);
RETCODE SQL_API SQLNumResultCols (HSTMT hstmt, SWORD FAR * pccol);
RETCODE SQL_API SQLPrepare (HSTMT hstmt, UCHAR FAR * szSqlStr,
SDWORD cbSqlStr);
RETCODE SQL_API SQLRowCount (HSTMT hstmt, SDWORD FAR * pcrow);
RETCODE SQL_API SQLSetCursorName (HSTMT hstmt, UCHAR FAR * szCursor,
SWORD cbCursor);
RETCODE SQL_API SQLTransact (HENV henv, HDBC hdbc, UWORD fType);
/*
* Depreciated ODBC 1.0 function - Use SQLBindParameter
*/
RETCODE SQL_API SQLSetParam (HSTMT hstmt, UWORD ipar, SWORD fCType,
SWORD fSqlType, UDWORD cbColDef, SWORD ibScale, PTR rgbValue,
SDWORD FAR * pcbValue);
#ifdef __cplusplus
}
#endif
#endif

1177
include/wx/unix/isqlext.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1290,6 +1290,8 @@ wxImage::wxImage( const wxBitmap &bitmap )
#include <gdk/gdkrgb.h>
#endif
extern GtkWidget *wxRootWindow;
wxBitmap wxImage::ConvertToMonoBitmap( unsigned char red, unsigned char green, unsigned char blue )
{
wxBitmap bitmap;
@@ -1302,7 +1304,7 @@ wxBitmap wxImage::ConvertToMonoBitmap( unsigned char red, unsigned char green, u
bitmap.SetHeight( height );
bitmap.SetWidth( width );
bitmap.SetBitmap( gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, 1 ) );
bitmap.SetBitmap( gdk_pixmap_new( wxRootWindow->window, width, height, 1 ) );
bitmap.SetDepth( 1 );
@@ -1324,7 +1326,7 @@ wxBitmap wxImage::ConvertToMonoBitmap( unsigned char red, unsigned char green, u
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 );
mask->m_bitmap = gdk_pixmap_new( wxRootWindow->window, width, height, 1 );
bitmap.SetMask( mask );
}
@@ -1400,7 +1402,7 @@ wxBitmap wxImage::ConvertToBitmap() const
bitmap.SetHeight( height );
bitmap.SetWidth( width );
bitmap.SetPixmap( gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, -1 ) );
bitmap.SetPixmap( gdk_pixmap_new( wxRootWindow->window, width, height, -1 ) );
// Retrieve depth
@@ -1458,7 +1460,7 @@ wxBitmap wxImage::ConvertToBitmap() const
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 );
mask->m_bitmap = gdk_pixmap_new( wxRootWindow->window, width, height, 1 );
bitmap.SetMask( mask );
}
@@ -1646,7 +1648,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
{
GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() );
if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent );
if (visual == NULL) visual = gdk_window_get_visual( wxRootWindow->window );
bpp = visual->depth;
if (bpp == 16) bpp = visual->red_prec + visual->green_prec + visual->blue_prec;
red_shift_right = visual->red_shift;

View File

@@ -1901,7 +1901,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
{
if ((Style == wxITALIC) && (Weight == wxBOLD)) name = "CourBoO";
else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = "CourBo";
else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = "Cour0";
else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = "CourO";
else name = "Cour";
}
break;
@@ -1917,7 +1917,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
{
if ((Style == wxITALIC) && (Weight == wxBOLD)) name = "HelvBoO";
else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = "HelvBo";
else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = "Helv0";
else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = "HelvO";
else name = "Helv";
}
break;

View File

@@ -51,6 +51,8 @@ extern bool g_isIdle;
bool g_mainThreadLocked = FALSE;
GtkWidget *wxRootWindow = (GtkWidget*) NULL;
//-----------------------------------------------------------------------------
// local functions
//-----------------------------------------------------------------------------
@@ -268,7 +270,7 @@ bool wxApp::OnInitGui()
/* on some machines, the default visual is just 256 colours, so
we make sure we get the best. this can sometimes be wasteful,
of course, but what do these guys pay $30.000 for? */
/*
if (gdk_visual_get_best() != gdk_visual_get_system())
{
GdkVisual* vis = gdk_visual_get_best();
@@ -279,7 +281,9 @@ bool wxApp::OnInitGui()
visual = vis;
}
*/
wxRootWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_widget_realize( wxRootWindow );
/* Nothing to do for 15, 16, 24, 32 bit displays */
if (visual->depth > 8) return TRUE;

View File

@@ -18,15 +18,13 @@
#include "wx/dcmemory.h"
#include <gdk/gdk.h>
#include <gdk/gdkprivate.h>
#include <gtk/gtk.h>
// in GTK+ 1.3 gdk_root_parent was renamed into gdk_parent_root
#ifdef __WXGTK13__
#define gdk_root_parent gdk_parent_root
#else // GTK+ <= 1.2
// need to get the declaration of gdk_root_parent from private header
#include <gdk/gdkx.h>
#endif // GTK+ 1.3/1.2
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern GtkWidget *wxRootWindow;
//-----------------------------------------------------------------------------
// wxMask
@@ -75,8 +73,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
wxImage image( bitmap );
if (!image.Ok()) return FALSE;
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
m_bitmap = gdk_pixmap_new( parent, image.GetWidth(), image.GetHeight(), 1 );
m_bitmap = gdk_pixmap_new( wxRootWindow->window, image.GetWidth(), image.GetHeight(), 1 );
GdkGC *gc = gdk_gc_new( m_bitmap );
GdkColor color;
@@ -175,7 +172,7 @@ bool wxMask::Create( const wxBitmap& bitmap )
wxCHECK_MSG( bitmap.GetBitmap(), FALSE, wxT("Cannot create mask from colour bitmap") );
m_bitmap = gdk_pixmap_new( (GdkWindow*) &gdk_root_parent, bitmap.GetWidth(), bitmap.GetHeight(), 1 );
m_bitmap = gdk_pixmap_new( wxRootWindow->window, bitmap.GetWidth(), bitmap.GetHeight(), 1 );
if (!m_bitmap) return FALSE;
@@ -246,10 +243,9 @@ wxBitmap::wxBitmap( int width, int height, int depth )
{
wxCHECK_RET( (width > 0) && (height > 0), wxT("invalid bitmap size") )
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
if (depth == -1) depth = gdk_window_get_visual( parent )->depth;
if (depth == -1) depth = gdk_window_get_visual( wxRootWindow->window )->depth;
wxCHECK_RET( (depth == gdk_window_get_visual( parent )->depth) ||
wxCHECK_RET( (depth == gdk_window_get_visual( wxRootWindow->window )->depth) ||
(depth == 1), wxT("invalid bitmap depth") )
m_refData = new wxBitmapRefData();
@@ -258,13 +254,13 @@ wxBitmap::wxBitmap( int width, int height, int depth )
M_BMPDATA->m_height = height;
if (depth == 1)
{
M_BMPDATA->m_bitmap = gdk_pixmap_new( parent, width, height, 1 );
M_BMPDATA->m_bitmap = gdk_pixmap_new( wxRootWindow->window, width, height, 1 );
M_BMPDATA->m_bpp = 1;
}
else
{
M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth );
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth;
M_BMPDATA->m_pixmap = gdk_pixmap_new( wxRootWindow->window, width, height, depth );
M_BMPDATA->m_bpp = gdk_window_get_visual( wxRootWindow->window )->depth;
}
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
@@ -277,9 +273,8 @@ bool wxBitmap::CreateFromXpm( const char **bits )
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 );
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( wxRootWindow->window, &mask, NULL, (gchar **) bits );
wxCHECK_MSG( M_BMPDATA->m_pixmap, FALSE, wxT("couldn't create pixmap") );
@@ -291,7 +286,7 @@ bool wxBitmap::CreateFromXpm( const char **bits )
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( wxRootWindow->window )->depth; // ?
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
return TRUE;
@@ -317,7 +312,7 @@ wxBitmap::wxBitmap( const char bits[], int width, int height, int WXUNUSED(depth
M_BMPDATA->m_mask = (wxMask *) NULL;
M_BMPDATA->m_bitmap =
gdk_bitmap_create_from_data( (GdkWindow*) &gdk_root_parent, (gchar *) bits, width, height );
gdk_bitmap_create_from_data( wxRootWindow->window, (gchar *) bits, width, height );
M_BMPDATA->m_width = width;
M_BMPDATA->m_height = height;
M_BMPDATA->m_bpp = 1;
@@ -417,8 +412,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
if (GetMask())
{
wxMask *mask = new wxMask;
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
mask->m_bitmap = gdk_pixmap_new( parent, rect.width, rect.height, 1 );
mask->m_bitmap = gdk_pixmap_new( wxRootWindow->window, rect.width, rect.height, 1 );
GdkGC *gc = gdk_gc_new( mask->m_bitmap );
gdk_draw_bitmap( mask->m_bitmap, gc, M_BMPDATA->m_mask->m_bitmap, 0, 0, rect.x, rect.y, rect.width, rect.height );
@@ -454,9 +448,8 @@ bool wxBitmap::LoadFile( const wxString &name, int type )
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.fn_str() );
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm( wxRootWindow->window, &mask, NULL, name.fn_str() );
if (mask)
{
@@ -465,7 +458,7 @@ bool wxBitmap::LoadFile( const wxString &name, int type )
}
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( wxRootWindow->window )->depth;
}
else // try if wxImage can load it
{

View File

@@ -40,9 +40,15 @@
#undef explicit
#endif // HAVE_X11_XKBLIB_H
// ----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern GtkWidget *wxRootWindow;
//----------------------------------------------------------------------------
// misc.
// ----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void wxBell()
{
@@ -92,7 +98,7 @@ bool wxColourDisplay()
int wxDisplayDepth()
{
return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth;
return gdk_window_get_visual( wxRootWindow->window )->depth;
}
int wxGetOsVersion(int *majorVsn, int *minorVsn)

View File

@@ -51,6 +51,8 @@ extern bool g_isIdle;
bool g_mainThreadLocked = FALSE;
GtkWidget *wxRootWindow = (GtkWidget*) NULL;
//-----------------------------------------------------------------------------
// local functions
//-----------------------------------------------------------------------------
@@ -268,7 +270,7 @@ bool wxApp::OnInitGui()
/* on some machines, the default visual is just 256 colours, so
we make sure we get the best. this can sometimes be wasteful,
of course, but what do these guys pay $30.000 for? */
/*
if (gdk_visual_get_best() != gdk_visual_get_system())
{
GdkVisual* vis = gdk_visual_get_best();
@@ -279,7 +281,9 @@ bool wxApp::OnInitGui()
visual = vis;
}
*/
wxRootWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_widget_realize( wxRootWindow );
/* Nothing to do for 15, 16, 24, 32 bit displays */
if (visual->depth > 8) return TRUE;

View File

@@ -18,15 +18,13 @@
#include "wx/dcmemory.h"
#include <gdk/gdk.h>
#include <gdk/gdkprivate.h>
#include <gtk/gtk.h>
// in GTK+ 1.3 gdk_root_parent was renamed into gdk_parent_root
#ifdef __WXGTK13__
#define gdk_root_parent gdk_parent_root
#else // GTK+ <= 1.2
// need to get the declaration of gdk_root_parent from private header
#include <gdk/gdkx.h>
#endif // GTK+ 1.3/1.2
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern GtkWidget *wxRootWindow;
//-----------------------------------------------------------------------------
// wxMask
@@ -75,8 +73,7 @@ bool wxMask::Create( const wxBitmap& bitmap,
wxImage image( bitmap );
if (!image.Ok()) return FALSE;
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
m_bitmap = gdk_pixmap_new( parent, image.GetWidth(), image.GetHeight(), 1 );
m_bitmap = gdk_pixmap_new( wxRootWindow->window, image.GetWidth(), image.GetHeight(), 1 );
GdkGC *gc = gdk_gc_new( m_bitmap );
GdkColor color;
@@ -175,7 +172,7 @@ bool wxMask::Create( const wxBitmap& bitmap )
wxCHECK_MSG( bitmap.GetBitmap(), FALSE, wxT("Cannot create mask from colour bitmap") );
m_bitmap = gdk_pixmap_new( (GdkWindow*) &gdk_root_parent, bitmap.GetWidth(), bitmap.GetHeight(), 1 );
m_bitmap = gdk_pixmap_new( wxRootWindow->window, bitmap.GetWidth(), bitmap.GetHeight(), 1 );
if (!m_bitmap) return FALSE;
@@ -246,10 +243,9 @@ wxBitmap::wxBitmap( int width, int height, int depth )
{
wxCHECK_RET( (width > 0) && (height > 0), wxT("invalid bitmap size") )
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
if (depth == -1) depth = gdk_window_get_visual( parent )->depth;
if (depth == -1) depth = gdk_window_get_visual( wxRootWindow->window )->depth;
wxCHECK_RET( (depth == gdk_window_get_visual( parent )->depth) ||
wxCHECK_RET( (depth == gdk_window_get_visual( wxRootWindow->window )->depth) ||
(depth == 1), wxT("invalid bitmap depth") )
m_refData = new wxBitmapRefData();
@@ -258,13 +254,13 @@ wxBitmap::wxBitmap( int width, int height, int depth )
M_BMPDATA->m_height = height;
if (depth == 1)
{
M_BMPDATA->m_bitmap = gdk_pixmap_new( parent, width, height, 1 );
M_BMPDATA->m_bitmap = gdk_pixmap_new( wxRootWindow->window, width, height, 1 );
M_BMPDATA->m_bpp = 1;
}
else
{
M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth );
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth;
M_BMPDATA->m_pixmap = gdk_pixmap_new( wxRootWindow->window, width, height, depth );
M_BMPDATA->m_bpp = gdk_window_get_visual( wxRootWindow->window )->depth;
}
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
@@ -277,9 +273,8 @@ bool wxBitmap::CreateFromXpm( const char **bits )
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 );
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( wxRootWindow->window, &mask, NULL, (gchar **) bits );
wxCHECK_MSG( M_BMPDATA->m_pixmap, FALSE, wxT("couldn't create pixmap") );
@@ -291,7 +286,7 @@ bool wxBitmap::CreateFromXpm( const char **bits )
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( wxRootWindow->window )->depth; // ?
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
return TRUE;
@@ -317,7 +312,7 @@ wxBitmap::wxBitmap( const char bits[], int width, int height, int WXUNUSED(depth
M_BMPDATA->m_mask = (wxMask *) NULL;
M_BMPDATA->m_bitmap =
gdk_bitmap_create_from_data( (GdkWindow*) &gdk_root_parent, (gchar *) bits, width, height );
gdk_bitmap_create_from_data( wxRootWindow->window, (gchar *) bits, width, height );
M_BMPDATA->m_width = width;
M_BMPDATA->m_height = height;
M_BMPDATA->m_bpp = 1;
@@ -417,8 +412,7 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
if (GetMask())
{
wxMask *mask = new wxMask;
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
mask->m_bitmap = gdk_pixmap_new( parent, rect.width, rect.height, 1 );
mask->m_bitmap = gdk_pixmap_new( wxRootWindow->window, rect.width, rect.height, 1 );
GdkGC *gc = gdk_gc_new( mask->m_bitmap );
gdk_draw_bitmap( mask->m_bitmap, gc, M_BMPDATA->m_mask->m_bitmap, 0, 0, rect.x, rect.y, rect.width, rect.height );
@@ -454,9 +448,8 @@ bool wxBitmap::LoadFile( const wxString &name, int type )
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.fn_str() );
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm( wxRootWindow->window, &mask, NULL, name.fn_str() );
if (mask)
{
@@ -465,7 +458,7 @@ bool wxBitmap::LoadFile( const wxString &name, int type )
}
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( wxRootWindow->window )->depth;
}
else // try if wxImage can load it
{

View File

@@ -40,9 +40,15 @@
#undef explicit
#endif // HAVE_X11_XKBLIB_H
// ----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern GtkWidget *wxRootWindow;
//----------------------------------------------------------------------------
// misc.
// ----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void wxBell()
{
@@ -92,7 +98,7 @@ bool wxColourDisplay()
int wxDisplayDepth()
{
return gdk_window_get_visual( (GdkWindow*) &gdk_root_parent )->depth;
return gdk_window_get_visual( wxRootWindow->window )->depth;
}
int wxGetOsVersion(int *majorVsn, int *minorVsn)