1. wxMotif toolbar works; the toggle buttons have the same width as the other
ones and not twice as big 2. wxMotif::wxBitmap(from XPM) ctor now takes either "char **" or "const char **", as in wxGTK 3. added an X error handler to wxMotif (debug only) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4995 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -64,8 +64,8 @@ public:
|
|||||||
wxBitmap();
|
wxBitmap();
|
||||||
wxBitmap( int width, int height, int depth = -1 );
|
wxBitmap( int width, int height, int depth = -1 );
|
||||||
wxBitmap( const char bits[], int width, int height, int depth = 1 );
|
wxBitmap( const char bits[], int width, int height, int depth = 1 );
|
||||||
wxBitmap( const char **bits );
|
wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); }
|
||||||
wxBitmap( char **bits );
|
wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
|
||||||
wxBitmap( const wxBitmap& bmp );
|
wxBitmap( const wxBitmap& bmp );
|
||||||
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
|
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
|
||||||
~wxBitmap();
|
~wxBitmap();
|
||||||
@@ -99,6 +99,9 @@ public:
|
|||||||
GdkPixmap *GetPixmap() const;
|
GdkPixmap *GetPixmap() const;
|
||||||
GdkBitmap *GetBitmap() const;
|
GdkBitmap *GetBitmap() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool CreateFromXpm(const char **bits);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
||||||
};
|
};
|
||||||
|
@@ -64,8 +64,8 @@ public:
|
|||||||
wxBitmap();
|
wxBitmap();
|
||||||
wxBitmap( int width, int height, int depth = -1 );
|
wxBitmap( int width, int height, int depth = -1 );
|
||||||
wxBitmap( const char bits[], int width, int height, int depth = 1 );
|
wxBitmap( const char bits[], int width, int height, int depth = 1 );
|
||||||
wxBitmap( const char **bits );
|
wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); }
|
||||||
wxBitmap( char **bits );
|
wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
|
||||||
wxBitmap( const wxBitmap& bmp );
|
wxBitmap( const wxBitmap& bmp );
|
||||||
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
|
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
|
||||||
~wxBitmap();
|
~wxBitmap();
|
||||||
@@ -99,6 +99,9 @@ public:
|
|||||||
GdkPixmap *GetPixmap() const;
|
GdkPixmap *GetPixmap() const;
|
||||||
GdkBitmap *GetBitmap() const;
|
GdkBitmap *GetBitmap() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool CreateFromXpm(const char **bits);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
||||||
};
|
};
|
||||||
|
@@ -140,8 +140,12 @@ public:
|
|||||||
// Initialize with raw XBM data
|
// Initialize with raw XBM data
|
||||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||||
|
|
||||||
// Initialize with XPM data
|
// from XPM
|
||||||
wxBitmap(char **data, wxControl* control = NULL);
|
wxBitmap(const char **data) { (void)CreateFromXpm(data); }
|
||||||
|
wxBitmap(char **data) { (void)CreateFromXpm((const char **)data); }
|
||||||
|
|
||||||
|
// Initialize with XPM data -- deprecated
|
||||||
|
wxBitmap(char **data, wxControl* control);
|
||||||
|
|
||||||
// Load a file or resource
|
// Load a file or resource
|
||||||
wxBitmap(const wxString& name, long type = wxBITMAP_TYPE_XPM);
|
wxBitmap(const wxString& name, long type = wxBITMAP_TYPE_XPM);
|
||||||
@@ -201,6 +205,9 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
static wxList sm_handlers;
|
static wxList sm_handlers;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool CreateFromXpm(const char **bits);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Creates a bitmap with transparent areas drawn in
|
// Creates a bitmap with transparent areas drawn in
|
||||||
|
@@ -217,13 +217,6 @@ void MyFrame::RecreateToolbar()
|
|||||||
wxBitmap toolBarBitmaps[8];
|
wxBitmap toolBarBitmaps[8];
|
||||||
|
|
||||||
toolBarBitmaps[0] = wxBITMAP(new);
|
toolBarBitmaps[0] = wxBITMAP(new);
|
||||||
#if 0
|
|
||||||
toolBar->AddTool(wxID_NEW, toolBarBitmaps[0], wxNullBitmap, FALSE, -1, -1,
|
|
||||||
(wxObject *) NULL, "New file");
|
|
||||||
toolBar->Realize();
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
toolBarBitmaps[1] = wxBITMAP(open);
|
toolBarBitmaps[1] = wxBITMAP(open);
|
||||||
if ( !m_smallToolbar )
|
if ( !m_smallToolbar )
|
||||||
{
|
{
|
||||||
|
@@ -245,9 +245,9 @@ wxBitmap::wxBitmap( int width, int height, int depth )
|
|||||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmap::wxBitmap( const char **bits )
|
bool wxBitmap::CreateFromXpm( const char **bits )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( bits != NULL, wxT("invalid bitmap data") )
|
wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") )
|
||||||
|
|
||||||
m_refData = new wxBitmapRefData();
|
m_refData = new wxBitmapRefData();
|
||||||
|
|
||||||
@@ -256,6 +256,8 @@ wxBitmap::wxBitmap( const char **bits )
|
|||||||
|
|
||||||
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( parent, &mask, NULL, (gchar **) bits );
|
||||||
|
|
||||||
|
wxCHECK_MSG( M_BMPDATA->m_pixmap, FALSE, wxT("couldn't create pixmap") );
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
M_BMPDATA->m_mask = new wxMask();
|
M_BMPDATA->m_mask = new wxMask();
|
||||||
@@ -266,31 +268,8 @@ wxBitmap::wxBitmap( const char **bits )
|
|||||||
|
|
||||||
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ?
|
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ?
|
||||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||||
}
|
|
||||||
|
|
||||||
wxBitmap::wxBitmap( char **bits )
|
return TRUE;
|
||||||
{
|
|
||||||
wxCHECK_RET( bits != NULL, wxT("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, wxT("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 )
|
wxBitmap::wxBitmap( const wxBitmap& bmp )
|
||||||
|
@@ -245,9 +245,9 @@ wxBitmap::wxBitmap( int width, int height, int depth )
|
|||||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmap::wxBitmap( const char **bits )
|
bool wxBitmap::CreateFromXpm( const char **bits )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( bits != NULL, wxT("invalid bitmap data") )
|
wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") )
|
||||||
|
|
||||||
m_refData = new wxBitmapRefData();
|
m_refData = new wxBitmapRefData();
|
||||||
|
|
||||||
@@ -256,6 +256,8 @@ wxBitmap::wxBitmap( const char **bits )
|
|||||||
|
|
||||||
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( parent, &mask, NULL, (gchar **) bits );
|
||||||
|
|
||||||
|
wxCHECK_MSG( M_BMPDATA->m_pixmap, FALSE, wxT("couldn't create pixmap") );
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
M_BMPDATA->m_mask = new wxMask();
|
M_BMPDATA->m_mask = new wxMask();
|
||||||
@@ -266,31 +268,8 @@ wxBitmap::wxBitmap( const char **bits )
|
|||||||
|
|
||||||
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ?
|
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ?
|
||||||
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
|
||||||
}
|
|
||||||
|
|
||||||
wxBitmap::wxBitmap( char **bits )
|
return TRUE;
|
||||||
{
|
|
||||||
wxCHECK_RET( bits != NULL, wxT("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, wxT("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 )
|
wxBitmap::wxBitmap( const wxBitmap& bmp )
|
||||||
|
@@ -68,6 +68,18 @@ BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
|
|||||||
EVT_IDLE(wxApp::OnIdle)
|
EVT_IDLE(wxApp::OnIdle)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
#ifdef __WXDEBUG__
|
||||||
|
typedef int (*XErrorHandlerFunc)(Display *, XErrorEvent *);
|
||||||
|
|
||||||
|
XErrorHandlerFunc gs_pfnXErrorHandler = 0;
|
||||||
|
|
||||||
|
static int wxXErrorHandler(Display *dpy, XErrorEvent *xevent)
|
||||||
|
{
|
||||||
|
// just forward to the default handler for now
|
||||||
|
return gs_pfnXErrorHandler(dpy, xevent);
|
||||||
|
}
|
||||||
|
#endif // __WXDEBUG__
|
||||||
|
|
||||||
long wxApp::sm_lastMessageTime = 0;
|
long wxApp::sm_lastMessageTime = 0;
|
||||||
|
|
||||||
bool wxApp::Initialize()
|
bool wxApp::Initialize()
|
||||||
@@ -575,6 +587,11 @@ bool wxApp::OnInitGui()
|
|||||||
}
|
}
|
||||||
m_initialDisplay = (WXDisplay*) dpy;
|
m_initialDisplay = (WXDisplay*) dpy;
|
||||||
|
|
||||||
|
#ifdef __WXDEBUG__
|
||||||
|
// install the X error handler
|
||||||
|
gs_pfnXErrorHandler = XSetErrorHandler(wxXErrorHandler);
|
||||||
|
#endif // __WXDEBUG__
|
||||||
|
|
||||||
wxTheApp->m_topLevelWidget = (WXWidget) XtAppCreateShell((String)NULL, (const char*) wxTheApp->GetClassName(),
|
wxTheApp->m_topLevelWidget = (WXWidget) XtAppCreateShell((String)NULL, (const char*) wxTheApp->GetClassName(),
|
||||||
applicationShellWidgetClass,dpy,
|
applicationShellWidgetClass,dpy,
|
||||||
NULL,0) ;
|
NULL,0) ;
|
||||||
|
@@ -37,8 +37,8 @@
|
|||||||
#include <X11/xpm.h>
|
#include <X11/xpm.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
|
||||||
|
|
||||||
wxBitmapRefData::wxBitmapRefData()
|
wxBitmapRefData::wxBitmapRefData()
|
||||||
{
|
{
|
||||||
@@ -168,6 +168,13 @@ wxBitmap::wxBitmap(char **data, wxControl* control)
|
|||||||
sg_Control = (wxControl*) NULL;
|
sg_Control = (wxControl*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxBitmap::CreateFromXpm(const char **bits)
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( bits, FALSE, _T("NULL pointer in wxBitmap::CreateFromXpm") );
|
||||||
|
|
||||||
|
return Create(bits, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
bool wxBitmap::Create(int w, int h, int d)
|
bool wxBitmap::Create(int w, int h, int d)
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
@@ -828,10 +835,10 @@ WXPixmap wxBitmap::GetLabelPixmap (WXWidget w)
|
|||||||
|
|
||||||
this is a catch22!!
|
this is a catch22!!
|
||||||
|
|
||||||
So, before doing thing really clean, I just do nothing; if the pixmap is
|
So, before doing thing really clean, I just do nothing; if the pixmap is
|
||||||
referenced by many widgets, Motif performs caching functions.
|
referenced by many widgets, Motif performs caching functions.
|
||||||
And if pixmap is referenced with multiples colors, we just have some
|
And if pixmap is referenced with multiples colors, we just have some
|
||||||
memory leaks... I hope we can deal with them...
|
memory leaks... I hope we can deal with them...
|
||||||
*/
|
*/
|
||||||
// Must be destroyed, because colours can have been changed!
|
// Must be destroyed, because colours can have been changed!
|
||||||
if (M_BITMAPDATA->m_labelPixmap)
|
if (M_BITMAPDATA->m_labelPixmap)
|
||||||
@@ -860,26 +867,27 @@ WXPixmap wxBitmap::GetArmPixmap (WXWidget w)
|
|||||||
|
|
||||||
Display *dpy = (Display*) M_BITMAPDATA->m_display;
|
Display *dpy = (Display*) M_BITMAPDATA->m_display;
|
||||||
#ifdef FOO
|
#ifdef FOO
|
||||||
See GetLabelPixmap () comment
|
// See GetLabelPixmap () comment
|
||||||
// Must be destroyed, because colours can have been changed!
|
|
||||||
if (M_BITMAPDATA->m_armPixmap)
|
// Must be destroyed, because colours can have been changed!
|
||||||
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), M_BITMAPDATA->m_armPixmap);
|
if (M_BITMAPDATA->m_armPixmap)
|
||||||
|
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), M_BITMAPDATA->m_armPixmap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char tmp[128];
|
char tmp[128];
|
||||||
sprintf (tmp, "Im%x", (unsigned int) M_BITMAPDATA->m_image);
|
sprintf (tmp, "Im%x", (unsigned int) M_BITMAPDATA->m_image);
|
||||||
|
|
||||||
Pixel fg, bg;
|
Pixel fg, bg;
|
||||||
Widget widget = (Widget) w;
|
Widget widget = (Widget) w;
|
||||||
|
|
||||||
XtVaGetValues (widget, XmNarmColor, &bg, NULL);
|
XtVaGetValues (widget, XmNarmColor, &bg, NULL);
|
||||||
while (XmIsGadget (widget))
|
while (XmIsGadget (widget))
|
||||||
widget = XtParent (widget);
|
widget = XtParent (widget);
|
||||||
XtVaGetValues (widget, XmNforeground, &fg, NULL);
|
XtVaGetValues (widget, XmNforeground, &fg, NULL);
|
||||||
|
|
||||||
M_BITMAPDATA->m_armPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
|
M_BITMAPDATA->m_armPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
|
||||||
|
|
||||||
return M_BITMAPDATA->m_armPixmap;
|
return M_BITMAPDATA->m_armPixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
WXPixmap wxBitmap::GetInsensPixmap (WXWidget w)
|
WXPixmap wxBitmap::GetInsensPixmap (WXWidget w)
|
||||||
@@ -908,19 +916,19 @@ WXPixmap wxBitmap::GetInsensPixmap (WXWidget w)
|
|||||||
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), (Pixmap) M_BITMAPDATA->m_insensPixmap);
|
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), (Pixmap) M_BITMAPDATA->m_insensPixmap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char tmp[128];
|
char tmp[128];
|
||||||
sprintf (tmp, "Not%x", (unsigned int) M_BITMAPDATA->m_insensImage);
|
sprintf (tmp, "Not%x", (unsigned int) M_BITMAPDATA->m_insensImage);
|
||||||
|
|
||||||
Pixel fg, bg;
|
Pixel fg, bg;
|
||||||
Widget widget = (Widget) w;
|
Widget widget = (Widget) w;
|
||||||
|
|
||||||
while (XmIsGadget (widget))
|
while (XmIsGadget (widget))
|
||||||
widget = XtParent (widget);
|
widget = XtParent (widget);
|
||||||
XtVaGetValues (widget, XmNbackground, &bg, XmNforeground, &fg, NULL);
|
XtVaGetValues (widget, XmNbackground, &bg, XmNforeground, &fg, NULL);
|
||||||
|
|
||||||
M_BITMAPDATA->m_insensPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
|
M_BITMAPDATA->m_insensPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
|
||||||
|
|
||||||
return M_BITMAPDATA->m_insensPixmap;
|
return M_BITMAPDATA->m_insensPixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We may need this sometime...
|
// We may need this sometime...
|
||||||
@@ -930,30 +938,30 @@ WXPixmap wxBitmap::GetInsensPixmap (WXWidget w)
|
|||||||
NAME
|
NAME
|
||||||
XCreateInsensitivePixmap - create a grayed-out copy of a pixmap
|
XCreateInsensitivePixmap - create a grayed-out copy of a pixmap
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap )
|
Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap )
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
This function creates a grayed-out copy of the argument pixmap, suitable
|
This function creates a grayed-out copy of the argument pixmap, suitable
|
||||||
for use as a XmLabel's XmNlabelInsensitivePixmap resource.
|
for use as a XmLabel's XmNlabelInsensitivePixmap resource.
|
||||||
|
|
||||||
RETURN VALUES
|
RETURN VALUES
|
||||||
The return value is the new Pixmap id or zero on error. Errors include
|
The return value is the new Pixmap id or zero on error. Errors include
|
||||||
a NULL display argument or an invalid Pixmap argument.
|
a NULL display argument or an invalid Pixmap argument.
|
||||||
|
|
||||||
ERRORS
|
ERRORS
|
||||||
If one of the XLib functions fail, it will produce a X error. The
|
If one of the XLib functions fail, it will produce a X error. The
|
||||||
default X error handler prints a diagnostic and calls exit().
|
default X error handler prints a diagnostic and calls exit().
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
XCopyArea(3), XCreateBitmapFromData(3), XCreateGC(3), XCreatePixmap(3),
|
XCopyArea(3), XCreateBitmapFromData(3), XCreateGC(3), XCreatePixmap(3),
|
||||||
XFillRectangle(3), exit(2)
|
XFillRectangle(3), exit(2)
|
||||||
|
|
||||||
AUTHOR
|
AUTHOR
|
||||||
John R Veregge - john@puente.jpl.nasa.gov
|
John R Veregge - john@puente.jpl.nasa.gov
|
||||||
Advanced Engineering and Prototyping Group (AEG)
|
Advanced Engineering and Prototyping Group (AEG)
|
||||||
Information Systems Technology Section (395)
|
Information Systems Technology Section (395)
|
||||||
Jet Propulsion Lab - Calif Institute of Technology
|
Jet Propulsion Lab - Calif Institute of Technology
|
||||||
|
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
@@ -961,14 +969,13 @@ Pixmap
|
|||||||
XCreateInsensitivePixmap( Display *display, Pixmap pixmap )
|
XCreateInsensitivePixmap( Display *display, Pixmap pixmap )
|
||||||
|
|
||||||
{
|
{
|
||||||
static
|
static char stipple_data[] =
|
||||||
char stipple_data[] =
|
{
|
||||||
{
|
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA,
|
||||||
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA,
|
|
||||||
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA,
|
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA,
|
||||||
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA,
|
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA,
|
||||||
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA
|
0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA
|
||||||
};
|
};
|
||||||
GC gc;
|
GC gc;
|
||||||
Pixmap ipixmap, stipple;
|
Pixmap ipixmap, stipple;
|
||||||
unsigned width, height, depth;
|
unsigned width, height, depth;
|
||||||
@@ -983,30 +990,30 @@ XCreateInsensitivePixmap( Display *display, Pixmap pixmap )
|
|||||||
return ipixmap;
|
return ipixmap;
|
||||||
|
|
||||||
if ( 0 == XGetGeometry( display, pixmap, &window, &x, &y,
|
if ( 0 == XGetGeometry( display, pixmap, &window, &x, &y,
|
||||||
&width, &height, &border, &depth )
|
&width, &height, &border, &depth )
|
||||||
)
|
)
|
||||||
return ipixmap; /* BadDrawable: probably an invalid pixmap */
|
return ipixmap; /* BadDrawable: probably an invalid pixmap */
|
||||||
|
|
||||||
/* Get the stipple pixmap to be used to 'gray-out' the argument pixmap.
|
/* Get the stipple pixmap to be used to 'gray-out' the argument pixmap.
|
||||||
*/
|
*/
|
||||||
stipple = XCreateBitmapFromData( display, pixmap, stipple_data, 16, 16 );
|
stipple = XCreateBitmapFromData( display, pixmap, stipple_data, 16, 16 );
|
||||||
if ( 0 != stipple )
|
if ( 0 != stipple )
|
||||||
{
|
{
|
||||||
gc = XCreateGC( display, pixmap, (XtGCMask)0, (XGCValues*)NULL );
|
gc = XCreateGC( display, pixmap, (XtGCMask)0, (XGCValues*)NULL );
|
||||||
if ( NULL != gc )
|
if ( NULL != gc )
|
||||||
{
|
{
|
||||||
/* Create an identical copy of the argument pixmap.
|
/* Create an identical copy of the argument pixmap.
|
||||||
*/
|
*/
|
||||||
ipixmap = XCreatePixmap( display, pixmap, width, height, depth );
|
ipixmap = XCreatePixmap( display, pixmap, width, height, depth );
|
||||||
if ( 0 != ipixmap )
|
if ( 0 != ipixmap )
|
||||||
{
|
{
|
||||||
/* Copy the argument pixmap into the new pixmap.
|
/* Copy the argument pixmap into the new pixmap.
|
||||||
*/
|
*/
|
||||||
XCopyArea( display, pixmap, ipixmap,
|
XCopyArea( display, pixmap, ipixmap,
|
||||||
gc, 0, 0, width, height, 0, 0 );
|
gc, 0, 0, width, height, 0, 0 );
|
||||||
|
|
||||||
/* Refill the new pixmap using the stipple algorithm/pixmap.
|
/* Refill the new pixmap using the stipple algorithm/pixmap.
|
||||||
*/
|
*/
|
||||||
XSetStipple( display, gc, stipple );
|
XSetStipple( display, gc, stipple );
|
||||||
XSetFillStyle( display, gc, FillStippled );
|
XSetFillStyle( display, gc, FillStippled );
|
||||||
XFillRectangle( display, ipixmap, gc, 0, 0, width, height );
|
XFillRectangle( display, ipixmap, gc, 0, 0, width, height );
|
||||||
|
@@ -282,7 +282,12 @@ bool wxToolBar::Realize()
|
|||||||
button = XtVaCreateWidget("toggleButton",
|
button = XtVaCreateWidget("toggleButton",
|
||||||
xmToggleButtonWidgetClass, (Widget) m_mainWidget,
|
xmToggleButtonWidgetClass, (Widget) m_mainWidget,
|
||||||
XmNx, currentX, XmNy, currentY,
|
XmNx, currentX, XmNy, currentY,
|
||||||
// XmNpushButtonEnabled, True,
|
XmNindicatorOn, False,
|
||||||
|
XmNshadowThickness, 2,
|
||||||
|
XmNborderWidth, 0,
|
||||||
|
XmNspacing, 0,
|
||||||
|
XmNmarginWidth, 0,
|
||||||
|
XmNmarginHeight, 0,
|
||||||
XmNmultiClick, XmMULTICLICK_KEEP,
|
XmNmultiClick, XmMULTICLICK_KEEP,
|
||||||
XmNlabelType, XmPIXMAP,
|
XmNlabelType, XmPIXMAP,
|
||||||
NULL);
|
NULL);
|
||||||
@@ -325,9 +330,9 @@ bool wxToolBar::Realize()
|
|||||||
wxColour col;
|
wxColour col;
|
||||||
col.SetPixel(backgroundPixel);
|
col.SetPixel(backgroundPixel);
|
||||||
|
|
||||||
wxBitmap newBitmap = wxCreateMaskedBitmap(bmp, col);
|
bmp = wxCreateMaskedBitmap(bmp, col);
|
||||||
|
|
||||||
tool->SetBitmap1(newBitmap);
|
tool->SetBitmap1(bmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a selected/toggled bitmap. If there isn't a 2nd
|
// Create a selected/toggled bitmap. If there isn't a 2nd
|
||||||
@@ -388,12 +393,6 @@ bool wxToolBar::Realize()
|
|||||||
tool->SetPixmap(pixmap2);
|
tool->SetPixmap(pixmap2);
|
||||||
|
|
||||||
XtVaSetValues (button,
|
XtVaSetValues (button,
|
||||||
XmNindicatorOn, False,
|
|
||||||
XmNshadowThickness, 2,
|
|
||||||
// XmNborderWidth, 0,
|
|
||||||
// XmNspacing, 0,
|
|
||||||
XmNmarginWidth, 0,
|
|
||||||
XmNmarginHeight, 0,
|
|
||||||
XmNfillOnSelect, True,
|
XmNfillOnSelect, True,
|
||||||
XmNlabelPixmap, pixmap,
|
XmNlabelPixmap, pixmap,
|
||||||
XmNselectPixmap, pixmap2,
|
XmNselectPixmap, pixmap2,
|
||||||
|
@@ -1718,7 +1718,7 @@ bool wxAddWindowToTable(Widget w, wxWindow *win)
|
|||||||
|
|
||||||
wxWidgetHashTable->Put((long) w, win);
|
wxWidgetHashTable->Put((long) w, win);
|
||||||
|
|
||||||
wxLogDebug("Widget 0x%08x <-> window %p (%s)",
|
wxLogTrace("widget", "Widget 0x%08x <-> window %p (%s)",
|
||||||
w, win, win->GetClassInfo()->GetClassName());
|
w, win, win->GetClassInfo()->GetClassName());
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Reference in New Issue
Block a user