Stripped out miscellaneous Motif/Xt-specific code

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2002-02-07 12:06:37 +00:00
parent fe40185d40
commit bc797f4cc8
20 changed files with 368 additions and 975 deletions

View File

@@ -89,13 +89,6 @@ public:
bool m_freePixmap;
unsigned long* m_freeColors;
long m_freeColorsCount;
// These 5 variables are for wxControl
WXPixmap m_insensPixmap ;
WXPixmap m_labelPixmap ;
WXPixmap m_armPixmap ;
WXImage* m_image ;
WXImage* m_insensImage ;
};
#define M_BITMAPDATA ((wxBitmapRefData *)m_refData)
@@ -145,9 +138,6 @@ public:
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
wxBitmap(const wxString& name, long type = wxBITMAP_TYPE_XPM);
@@ -209,9 +199,6 @@ public:
public:
WXDisplay* GetDisplay() const { return M_BITMAPDATA->m_display; }
WXPixmap GetPixmap() const { return (WXPixmap) M_BITMAPDATA->m_pixmap; }
virtual WXPixmap GetLabelPixmap(WXWidget w) ;
virtual WXPixmap GetArmPixmap(WXWidget w) ;
virtual WXPixmap GetInsensPixmap(WXWidget w = (WXWidget) 0) ;
void SetPixmapNull() { M_BITMAPDATA->m_pixmap = 0; }
protected:

View File

@@ -95,11 +95,9 @@ public:
wxXFont *GetInternalFont(double scale = 1.0,
WXDisplay* display = NULL) const;
// These two are helper functions for convenient access of the above.
// Helper function for convenient access of the above.
WXFontStructPtr GetFontStruct(double scale = 1.0,
WXDisplay* display = NULL) const;
WXFontList GetFontList(double scale = 1.0,
WXDisplay* display = NULL) const;
protected:
// common part of all ctors

View File

@@ -22,15 +22,15 @@
// wxWindow class for Motif - see also wxWindowBase
// ----------------------------------------------------------------------------
class wxWindow : public wxWindowBase
class wxWindowX11 : public wxWindowBase
{
friend class WXDLLEXPORT wxDC;
friend class WXDLLEXPORT wxWindowDC;
public:
wxWindow() { Init(); }
wxWindowX11() { Init(); }
wxWindow(wxWindow *parent,
wxWindowX11(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
@@ -103,7 +103,7 @@ public:
virtual void DragAcceptFiles(bool accept);
// Get the unique identifier of a window
virtual WXWidget GetHandle() const { return GetMainWidget(); }
virtual WXWindow GetHandle() const { return GetMainWindow(); }
// implementation from now on
// --------------------------
@@ -112,16 +112,16 @@ public:
// ---------
// Get main widget for this window, e.g. a text widget
virtual WXWidget GetMainWidget() const;
virtual WXWindow GetMainWindow() const;
// Get the widget that corresponds to the label (for font setting, label setting etc.)
virtual WXWidget GetLabelWidget() const;
virtual WXWindow GetLabelWindow() const;
// Get the client widget for this window (something we can create other
// windows on)
virtual WXWidget GetClientWidget() const;
virtual WXWindow GetClientWindow() const;
// Get the top widget for this window, e.g. the scrolled widget parent of a
// multi-line text widget. Top means, top in the window hierarchy that
// implements this window.
virtual WXWidget GetTopWidget() const;
virtual WXWindow GetTopWindow() const;
// Get the underlying X window and display
WXWindow GetXWindow() const;
@@ -164,8 +164,8 @@ public:
void SetUpdateRegion(const wxRegion& region) { m_updateRegion = region; }
// sets the fore/background colour for the given widget
static void DoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
static void DoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
static void DoChangeForegroundColour(WXWindow widget, wxColour& foregroundColour);
static void DoChangeBackgroundColour(WXWindow widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
// For implementation purposes - sometimes decorations make the client area
// smaller
@@ -194,7 +194,7 @@ protected:
void CanvasSetClientSize(int width, int size);
void CanvasSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
void SetMainWidget(WXWidget w) { m_mainWidget = w; }
void SetMainWindow(WXWindow w) { m_mainWindow = w; }
bool CanAddEventHandler() const { return m_canAddEventHandler; }
void SetCanAddEventHandler(bool flag) { m_canAddEventHandler = flag; }
@@ -218,9 +218,9 @@ public:
protected:
// Adds the widget to the hash table and adds event handlers.
bool AttachWidget(wxWindow* parent, WXWidget mainWidget,
WXWidget formWidget, int x, int y, int width, int height);
bool DetachWidget(WXWidget widget);
bool AttachWindow(wxWindow* parent, WXWindow mainWidget,
int x, int y, int width, int height);
bool DetachWindow(WXWindow widget);
// How to implement accelerators. If we find a key event, translate to
// wxWindows wxKeyEvent form. Find a widget for the window. Now find a
@@ -238,13 +238,6 @@ public:
virtual bool ProcessAccelerator(wxKeyEvent& event);
protected:
// unmanage and destroy an X widget f it's !NULL (passing NULL is ok)
void UnmanageAndDestroy(WXWidget widget);
// map or unmap an X widget (passing NULL is ok), returns TRUE if widget was
// mapped/unmapped
bool MapOrUnmap(WXWidget widget, bool map);
// scrolling stuff
// ---------------
@@ -253,7 +246,7 @@ protected:
void DestroyScrollbar(wxOrientation orientation);
// get either hor or vert scrollbar widget
WXWidget GetScrollbar(wxOrientation orient) const
WXWindow GetScrollbar(wxOrientation orient) const
{ return orient == wxHORIZONTAL ? m_hScrollBar : m_vScrollBar; }
// set the scroll pos
@@ -282,12 +275,12 @@ protected:
wxRectList m_updateRects;
protected:
WXWidget m_mainWidget;
WXWidget m_hScrollBar;
WXWidget m_vScrollBar;
WXWidget m_borderWidget;
WXWidget m_scrolledWindow;
WXWidget m_drawingArea;
WXWindow m_mainWidget;
WXWindow m_hScrollBar;
WXWindow m_vScrollBar;
WXWindow m_borderWidget;
WXWindow m_scrolledWindow;
WXWindow m_drawingArea;
bool m_winCaptured;
bool m_hScroll;
bool m_vScroll;
@@ -326,8 +319,8 @@ private:
// common part of all ctors
void Init();
DECLARE_DYNAMIC_CLASS(wxWindow)
DECLARE_NO_COPY_CLASS(wxWindow)
DECLARE_DYNAMIC_CLASS(wxWindowX11)
DECLARE_NO_COPY_CLASS(wxWindowX11)
DECLARE_EVENT_TABLE()
};

View File

@@ -13,10 +13,6 @@
#pragma implementation "bitmap.h"
#endif
#ifdef __VMS
#define XtParent XTPARENT
#endif
#include "wx/setup.h"
#include "wx/utils.h"
#include "wx/palette.h"
@@ -31,12 +27,11 @@
#ifdef __VMS__
#pragma message disable nosimpint
#endif
#include <Xm/Xm.h>
#ifdef __VMS__
#pragma message enable nosimpint
#endif
#include "wx/motif/private.h"
#include "wx/x11/private.h"
#if wxHAVE_LIB_XPM
#include <X11/xpm.h>
@@ -63,38 +58,10 @@ wxBitmapRefData::wxBitmapRefData()
m_freePixmap = TRUE; //TODO: necessary?
m_freeColors = (unsigned long*) 0;
m_freeColorsCount = 0;
// These 5 variables are for wxControl
m_insensPixmap = (WXPixmap) 0;
m_labelPixmap = (WXPixmap) 0;
m_armPixmap = (WXPixmap) 0;
m_image = (WXImage*) 0;
m_insensImage = (WXImage*) 0;
}
wxBitmapRefData::~wxBitmapRefData()
{
if (m_labelPixmap)
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) m_display), (Pixmap) m_labelPixmap);
if (m_armPixmap)
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) m_display), (Pixmap) m_armPixmap);
if (m_insensPixmap)
XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) m_display), (Pixmap) m_insensPixmap);
if (m_image)
{
XmUninstallImage ((XImage*) m_image);
XtFree ((char *) (XImage*) m_image);
}
if (m_insensImage)
{
XmUninstallImage ((XImage*) m_insensImage);
delete[] ((XImage*) m_insensImage)->data;
XtFree ((char *) (XImage*) m_insensImage);
}
if (m_pixmap && m_freePixmap)
XFreePixmap ((Display*) m_display, (Pixmap) m_pixmap);
@@ -148,23 +115,9 @@ wxBitmap::wxBitmap(const wxString& filename, long type)
LoadFile(filename, (int)type);
}
// Create from XPM data
static wxControl* sg_Control = NULL;
wxBitmap::wxBitmap(char **data, wxControl* control)
wxBitmap::wxBitmap(char **data)
{
// Pass the control to the Create function using a global
sg_Control = control;
(void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
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)
@@ -546,57 +499,6 @@ bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags
M_BITMAPHANDLERDATA->m_pixmap = (WXPixmap) XCreateBitmapFromData (dpy, RootWindow (dpy, DefaultScreen (dpy)), (char*) data, width, height);
M_BITMAPHANDLERDATA->m_ok = (M_BITMAPHANDLERDATA->m_pixmap != (WXPixmap) 0) ;
// code for wxControl. TODO: can we avoid doing this until we need it?
// E.g. have CreateButtonPixmaps which is called on demand.
XImage* image = (XImage *) XtMalloc (sizeof (XImage));
image->width = width;
image->height = height;
image->data = (char*) data;
image->depth = 1;
image->xoffset = 0;
image->format = XYBitmap;
image->byte_order = LSBFirst;
image->bitmap_unit = 8;
image->bitmap_bit_order = LSBFirst;
image->bitmap_pad = 8;
image->bytes_per_line = (width + 7) >> 3;
char tmp[128];
sprintf (tmp, "Im%x", (unsigned int) image);
XmInstallImage (image, tmp);
// Build our manually stipped pixmap.
int bpl = (width + 7) / 8;
char *data1 = new char[height * bpl];
char* bits = (char*) data;
int i;
for (i = 0; i < height; i++)
{
int mask = i % 2 ? 0x55 : 0xaa;
int j;
for (j = 0; j < bpl; j++)
data1[i * bpl + j] = bits[i * bpl + j] & mask;
}
XImage* insensImage = (XImage *) XtMalloc (sizeof (XImage));
insensImage->width = width;
insensImage->height = height;
insensImage->data = data1;
insensImage->depth = 1;
insensImage->xoffset = 0;
insensImage->format = XYBitmap;
insensImage->byte_order = LSBFirst;
insensImage->bitmap_unit = 8;
insensImage->bitmap_bit_order = LSBFirst;
insensImage->bitmap_pad = 8;
insensImage->bytes_per_line = bpl;
sprintf (tmp, "Not%x", (unsigned int)insensImage);
XmInstallImage (insensImage, tmp);
M_BITMAPHANDLERDATA->m_image = (WXImage*) image;
M_BITMAPHANDLERDATA->m_insensImage = (WXImage*) insensImage;
return TRUE;
}
@@ -821,122 +723,6 @@ void wxBitmap::InitStandardHandlers()
#endif // wxHAVE_LIB_XPM
}
WXPixmap wxBitmap::GetLabelPixmap (WXWidget w)
{
if (M_BITMAPDATA->m_image == (WXPixmap) 0)
return M_BITMAPDATA->m_pixmap;
Display *dpy = (Display*) M_BITMAPDATA->m_display;
#ifdef FOO
/*
If we do:
if (labelPixmap) return labelPixmap;
things can be wrong, because colors can have been changed.
If we do:
if (labelPixmap)
XmDestroyPixmap(DefaultScreenOfDisplay(dpy),labelPixmap) ;
we got BadDrawable if the pixmap is referenced by multiples widgets
this is a catch22!!
So, before doing thing really clean, I just do nothing; if the pixmap is
referenced by many widgets, Motif performs caching functions.
And if pixmap is referenced with multiples colors, we just have some
memory leaks... I hope we can deal with them...
*/
// Must be destroyed, because colours can have been changed!
if (M_BITMAPDATA->m_labelPixmap)
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), M_BITMAPDATA->m_labelPixmap);
#endif
char tmp[128];
sprintf (tmp, "Im%x", (unsigned int) M_BITMAPDATA->m_image);
Pixel fg, bg;
Widget widget = (Widget) w;
while (XmIsGadget ( widget ))
widget = XtParent (widget);
XtVaGetValues (widget, XmNbackground, &bg, XmNforeground, &fg, NULL);
M_BITMAPDATA->m_labelPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
return M_BITMAPDATA->m_labelPixmap;
}
WXPixmap wxBitmap::GetArmPixmap (WXWidget w)
{
if (M_BITMAPDATA->m_image == (WXPixmap) 0)
return M_BITMAPDATA->m_pixmap;
Display *dpy = (Display*) M_BITMAPDATA->m_display;
#ifdef FOO
// See GetLabelPixmap () comment
// Must be destroyed, because colours can have been changed!
if (M_BITMAPDATA->m_armPixmap)
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), M_BITMAPDATA->m_armPixmap);
#endif
char tmp[128];
sprintf (tmp, "Im%x", (unsigned int) M_BITMAPDATA->m_image);
Pixel fg, bg;
Widget widget = (Widget) w;
XtVaGetValues (widget, XmNarmColor, &bg, NULL);
while (XmIsGadget (widget))
widget = XtParent (widget);
XtVaGetValues (widget, XmNforeground, &fg, NULL);
M_BITMAPDATA->m_armPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
return M_BITMAPDATA->m_armPixmap;
}
WXPixmap wxBitmap::GetInsensPixmap (WXWidget w)
{
Display *dpy = (Display*) M_BITMAPDATA->m_display;
if (M_BITMAPDATA->m_insensPixmap)
return M_BITMAPDATA->m_insensPixmap;
if (!w)
{
M_BITMAPDATA->m_insensPixmap = (WXPixmap) XCreateInsensitivePixmap(dpy, (Pixmap) M_BITMAPDATA->m_pixmap);
if (M_BITMAPDATA->m_insensPixmap)
return M_BITMAPDATA->m_insensPixmap;
else
return M_BITMAPDATA->m_pixmap;
}
if (M_BITMAPDATA->m_insensImage == (WXPixmap) 0)
return M_BITMAPDATA->m_pixmap;
#ifdef FOO
See GetLabelPixmap () comment
// Must be destroyed, because colours can have been changed!
if (M_BITMAPDATA->m_insensPixmap)
XmDestroyPixmap (DefaultScreenOfDisplay (dpy), (Pixmap) M_BITMAPDATA->m_insensPixmap);
#endif
char tmp[128];
sprintf (tmp, "Not%x", (unsigned int) M_BITMAPDATA->m_insensImage);
Pixel fg, bg;
Widget widget = (Widget) w;
while (XmIsGadget (widget))
widget = XtParent (widget);
XtVaGetValues (widget, XmNbackground, &bg, XmNforeground, &fg, NULL);
M_BITMAPDATA->m_insensPixmap = (WXPixmap) XmGetPixmap (DefaultScreenOfDisplay (dpy), tmp, fg, bg);
return M_BITMAPDATA->m_insensPixmap;
}
// We may need this sometime...
/****************************************************************************

View File

@@ -22,13 +22,12 @@
#ifdef __VMS__
#pragma message disable nosimpint
#endif
#include <Xm/Xm.h>
#include <X11/cursorfont.h>
#ifdef __VMS__
#pragma message enable nosimpint
#endif
#include "wx/motif/private.h"
#include "wx/x11/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
IMPLEMENT_DYNAMIC_CLASS(wxXCursor, wxObject)

View File

@@ -21,7 +21,6 @@
#ifdef __VMS__
#pragma message disable nosimpint
#endif
#include <Xm/Xm.h>
#ifdef __VMS__
#pragma message enable nosimpint
#endif

View File

@@ -17,7 +17,7 @@
#include "wx/dcmemory.h"
#include "wx/defs.h"
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
//-----------------------------------------------------------------------------
// constants

View File

@@ -51,12 +51,11 @@
#ifdef __VMS__
#pragma message disable nosimpint
#endif
#include <Xm/Xm.h>
#ifdef __VMS__
#pragma message enable nosimpint
#endif
#include "wx/motif/private.h"
#include "wx/x11/private.h"
#ifdef __EMX__
#include <float.h> // for M_PI

View File

@@ -20,7 +20,6 @@
#ifdef __VMS__
#pragma message disable nosimpint
#endif
#include <Xm/Xm.h>
#ifdef __VMS__
#pragma message enable nosimpint
#endif

View File

@@ -21,12 +21,12 @@
#ifdef __VMS__
#pragma message disable nosimpint
#endif
#include <Xm/Xm.h>
#ifdef __VMS__
#pragma message enable nosimpint
#endif
#include "wx/motif/private.h"
#include "wx/x11/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)

View File

@@ -25,7 +25,7 @@
#pragma message disable nosimpint
#include "wx/vms_x_fix.h"
#endif
#include <Xm/Xm.h>
#ifdef __VMS
#pragma message enable nosimpint
#endif
@@ -54,7 +54,6 @@ public:
~wxXFont();
WXFontStructPtr m_fontStruct; // XFontStruct
WXFontList m_fontList; // Motif XmFontList
WXDisplay* m_display; // XDisplay
int m_scale; // Scale * 100
};
@@ -119,17 +118,12 @@ protected:
wxXFont::wxXFont()
{
m_fontStruct = (WXFontStructPtr) 0;
m_fontList = (WXFontList) 0;
m_display = (WXDisplay*) 0;
m_scale = 100;
}
wxXFont::~wxXFont()
{
XmFontList fontList = (XmFontList) m_fontList;
XmFontListFree (fontList);
// TODO: why does freeing the font produce a segv???
// Note that XFreeFont wasn't called in wxWin 1.68 either.
// XFontStruct* fontStruct = (XFontStruct*) m_fontStruct;
@@ -529,7 +523,6 @@ wxXFont* wxFont::GetInternalFont(double scale, WXDisplay* display) const
f->m_fontStruct = (WXFontStructPtr)font;
f->m_display = ( display ? display : wxGetDisplay() );
f->m_scale = intScale;
f->m_fontList = XmFontListCreate ((XFontStruct*) font, XmSTRING_DEFAULT_CHARSET);
M_FONTDATA->m_fonts.Append(f);
return f;
@@ -542,10 +535,3 @@ WXFontStructPtr wxFont::GetFontStruct(double scale, WXDisplay* display) const
return (f ? f->m_fontStruct : (WXFontStructPtr) 0);
}
WXFontList wxFont::GetFontList(double scale, WXDisplay* display) const
{
wxXFont* f = GetInternalFont(scale, display);
return (f ? f->m_fontList : (WXFontList) 0);
}

View File

@@ -1,7 +1,7 @@
/* -------------------------------------------------------------------------
* Project: GSocket (Generic Socket) for WX
* Name: gsockmot.c
* Purpose: GSocket: Motif part
* Purpose: GSocket: X11 part
* CVSID: $Id$
* ------------------------------------------------------------------------- */
@@ -10,10 +10,13 @@
#if wxUSE_SOCKETS
#include <stdlib.h>
#include <X11/Intrinsic.h>
// #include <X11/Intrinsic.h>
#include "wx/gsocket.h"
#include "wx/unix/gsockunx.h"
// TODO: Raw X11 version
#if 0
extern XtAppContext wxGetAppContext();
static void _GSocket_Motif_Input(XtPointer data, int *fid,
@@ -123,4 +126,7 @@ void _GSocket_Disable_Events(GSocket *socket)
/* some compilers don't like having empty source files */
static int wxDummyGsockVar = 0;
#endif
// 0
#endif /* wxUSE_SOCKETS/!wxUSE_SOCKETS */

View File

@@ -19,13 +19,12 @@
#ifdef __VMS__
#pragma message disable nosimpint
#endif
#include <Xm/Xm.h>
#include <X11/cursorfont.h>
#ifdef __VMS__
#pragma message enable nosimpint
#endif
#include "wx/motif/private.h"
#include "wx/x11/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)

View File

@@ -13,7 +13,7 @@
#pragma implementation "joystick.h"
#endif
// Not implemented in wxMotif
// Not implemented in X11
#if 0
#include "wx/joystick.h"

View File

@@ -46,7 +46,7 @@ not the functionality that wxPalette::Create() aims to provide.
#ifdef __VMS__
#pragma message disable nosimpint
#endif
#include <Xm/Xm.h>
#ifdef __VMS__
#pragma message enable nosimpint
#endif

View File

@@ -18,11 +18,11 @@
#ifdef __VMS__
#pragma message disable nosimpint
#endif
#include <Xm/Xm.h>
#ifdef __VMS__
#pragma message enable nosimpint
#endif
// #include "wx/motif/private.h"
// #include "wx/x11/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)

View File

@@ -20,12 +20,12 @@
#ifdef __VMS__
#pragma message disable nosimpint
#endif
#include <Xm/Xm.h>
#ifdef __VMS__
#pragma message enable nosimpint
#endif
#include "wx/motif/private.h"
#include "wx/x11/private.h"
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)

View File

@@ -33,26 +33,23 @@
#ifdef __VMS__
#pragma message disable nosimpint
#endif
#include <Xm/Xm.h>
#include <Xm/PushBG.h>
#include <Xm/PushB.h>
#include <Xm/Label.h>
#include <Xm/ToggleB.h>
#include <Xm/ToggleBG.h>
#include <Xm/Form.h>
#ifdef __VMS__
#pragma message enable nosimpint
#endif
#include "wx/motif/private.h"
#include "wx/x11/private.h"
// ----------------------------------------------------------------------------
// wxWin macros
// ----------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
#endif
// TODO: a decent generic toolbar implementation that
// we can put in src/generic
#if 0
// ----------------------------------------------------------------------------
// private functions
@@ -664,3 +661,4 @@ void wxToolBarTimer::Notify()
XtPopup (help_popup, XtGrabNone);
}
#endif

View File

@@ -17,10 +17,6 @@
// headers
// ----------------------------------------------------------------------------
#ifdef __VMS
#define XtDisplay XTDISPLAY
#endif
#include "wx/setup.h"
#include "wx/utils.h"
#include "wx/app.h"
@@ -48,14 +44,14 @@
#ifdef __VMS__
#pragma message disable nosimpint
#endif
#include <Xm/Xm.h>
#ifdef __VMS__
#pragma message enable nosimpint
#endif
#include "wx/unix/execute.h"
#include "wx/motif/private.h"
#include "wx/x11/private.h"
// ----------------------------------------------------------------------------
// private functions
@@ -101,6 +97,9 @@ void wxFlushEvents()
// in long calculations.
bool wxCheckForInterrupt(wxWindow *wnd)
{
wxASSERT_MSG(FALSE, "wxCheckForInterrupt not yet implemented.");
return FALSE;
#if 0
wxCHECK_MSG( wnd, FALSE, "NULL window in wxCheckForInterrupt" );
Display *dpy=(Display*) wnd->GetXDisplay();
@@ -127,12 +126,13 @@ bool wxCheckForInterrupt(wxWindow *wnd)
}
return hadEvents;
#endif
}
// ----------------------------------------------------------------------------
// wxExecute stuff
// ----------------------------------------------------------------------------
#if 0
static void xt_notify_end_process(XtPointer data, int *WXUNUSED(fid),
XtInputId *id)
{
@@ -156,6 +156,7 @@ int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
return (int)id;
}
#endif
// ----------------------------------------------------------------------------
// misc
@@ -170,6 +171,7 @@ void wxBell()
int wxGetOsVersion(int *majorVsn, int *minorVsn)
{
#if 0
// FIXME TODO
// This code is WRONG!! Does NOT return the
// Motif version of the libs but the X protocol
@@ -181,6 +183,13 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn)
*minorVsn = ProtocolRevision (display);
return wxMOTIF_X;
#else
if (majorVsn)
*majorVsn = 0;
if (minorVsn)
*minorVsn = 0;
return wxX11;
#endif
}
// ----------------------------------------------------------------------------
@@ -670,7 +679,7 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
}
// Configurable display in Motif
// Configurable display in X11
static WXDisplay *gs_currentDisplay = NULL;
static wxString gs_displayName;
@@ -678,9 +687,6 @@ WXDisplay *wxGetDisplay()
{
if (gs_currentDisplay)
return gs_currentDisplay;
if (wxTheApp && wxTheApp->GetTopLevelWidget())
return XtDisplay ((Widget) wxTheApp->GetTopLevelWidget());
else if (wxTheApp)
return wxTheApp->GetInitialDisplay();
else
@@ -691,7 +697,7 @@ bool wxSetDisplay(const wxString& display_name)
{
gs_displayName = display_name;
if ( !display_name )
if ( display_name.IsEmpty() )
{
gs_currentDisplay = NULL;
@@ -701,17 +707,7 @@ bool wxSetDisplay(const wxString& display_name)
{
Cardinal argc = 0;
Display *display = XtOpenDisplay((XtAppContext) wxTheApp->GetAppContext(),
(const char*) display_name,
(const char*) wxTheApp->GetAppName(),
(const char*) wxTheApp->GetClassName(),
NULL,
#if XtSpecificationRelease < 5
0, &argc,
#else
0, (int *)&argc,
#endif
NULL);
Display* display = XOpenDisplay((const char*) display_name);
if (display)
{
@@ -1191,43 +1187,3 @@ void wxAllocColor(Display *d,Colormap cmp,XColor *xc)
}
}
// These functions duplicate those in wxWindow, but are needed
// for use outside of wxWindow (e.g. wxMenu, wxMenuBar).
// Change a widget's foreground and background colours.
void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour)
{
// When should we specify the foreground, if it's calculated
// by wxComputeColours?
// Solution: say we start with the default (computed) foreground colour.
// If we call SetForegroundColour explicitly for a control or window,
// then the foreground is changed.
// Therefore SetBackgroundColour computes the foreground colour, and
// SetForegroundColour changes the foreground colour. The ordering is
// important.
XtVaSetValues ((Widget) widget,
XmNforeground, foregroundColour.AllocColour(XtDisplay((Widget) widget)),
NULL);
}
void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour)
{
wxComputeColours (XtDisplay((Widget) widget), & backgroundColour,
(wxColour*) NULL);
XtVaSetValues ((Widget) widget,
XmNbackground, g_itemColors[wxBACK_INDEX].pixel,
XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel,
XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel,
XmNforeground, g_itemColors[wxFORE_INDEX].pixel,
NULL);
if (changeArmColour)
XtVaSetValues ((Widget) widget,
XmNarmColor, g_itemColors[wxSELE_INDEX].pixel,
NULL);
}

File diff suppressed because it is too large Load Diff