Now compiling

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14068 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2002-02-08 17:44:23 +00:00
parent b2995a23bc
commit 7266b67235
41 changed files with 255 additions and 597 deletions

View File

@@ -93,7 +93,7 @@ logg.cpp Generic
msgdlgg.cpp Generic Generic msgdlgg.cpp Generic Generic
notebook.cpp Generic NotWin32,NotGTK,NotOS2,NotMGL,NotMac,NotMicro notebook.cpp Generic NotWin32,NotGTK,NotOS2,NotMGL,NotMac,NotMicro
numdlgg.cpp Generic numdlgg.cpp Generic
paletteg.cpp Generic NotMSW,NotX,NotOS2,NotMGL,NotMac,NotMicro paletteg.cpp Generic NotMSW,NotX,NotX11,NotOS2,NotMGL,NotMac,NotMicro
panelg.cpp Generic panelg.cpp Generic
printps.cpp Generic NotMSW,NotX11 printps.cpp Generic NotMSW,NotX11
prntdlgg.cpp Generic NotMSW prntdlgg.cpp Generic NotMSW
@@ -601,7 +601,6 @@ utils.cpp Motif
window.cpp Motif window.cpp Motif
gsockx11.c X11 Socket gsockx11.c X11 Socket
accel.cpp X11
app.cpp X11 app.cpp X11
bitmap.cpp X11 bitmap.cpp X11
brush.cpp X11 brush.cpp X11

View File

@@ -37,7 +37,7 @@
($fileobj = $file) =~ s/cp?p?$/\o/; ($fileobj = $file) =~ s/cp?p?$/\o/;
$project{"X11_SOURCES"} .= "x11/" . $file . " "; $project{"X11_SOURCES"} .= "x11/" . $file . " ";
$project{"GUIOBJS"} .= $fileobj . " "; $project{"GUI_LOWLEVEL_OBJS"} .= $fileobj . " ";
} }
foreach $file (sort keys %wxUNIX) { foreach $file (sort keys %wxUNIX) {
@@ -94,8 +94,8 @@ COMMONOBJS = \
GENERICOBJS = \ GENERICOBJS = \
#$ ExpandList("GENERICOBJS"); #$ ExpandList("GENERICOBJS");
GUIOBJS = \ GUI_LOWLEVEL_OBJS = \
#$ ExpandList("GUIOBJS"); #$ ExpandList("GUI_LOWLEVEL_OBJS");
UNIXOBJS = \ UNIXOBJS = \
#$ ExpandList("UNIXOBJS"); #$ ExpandList("UNIXOBJS");

View File

@@ -105,8 +105,6 @@ private:
#include "wx/motif/accel.h" #include "wx/motif/accel.h"
#elif defined(__WXGTK__) #elif defined(__WXGTK__)
#include "wx/gtk/accel.h" #include "wx/gtk/accel.h"
#elif defined(__WXX11__)
#include "wx/x11/accel.h"
#elif defined(__WXMAC__) #elif defined(__WXMAC__)
#include "wx/mac/accel.h" #include "wx/mac/accel.h"
#elif defined(__WXPM__) #elif defined(__WXPM__)

View File

@@ -21,7 +21,7 @@
#include "wx/colour.h" #include "wx/colour.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT #if (defined(__WXMOTIF__) || defined(__WXX11__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT
class WXDLLEXPORT wxPrintSetupData; class WXDLLEXPORT wxPrintSetupData;
#endif #endif
@@ -165,7 +165,7 @@ class WXDLLEXPORT wxPrintData: public wxObject
void operator=(const wxPrintData& data); void operator=(const wxPrintData& data);
// For compatibility // For compatibility
#if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT #if (defined(__WXMOTIF__) || defined(__WXX11__) || defined(__WXGTK__) || defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT
void operator=(const wxPrintSetupData& setupData); void operator=(const wxPrintSetupData& setupData);
#endif #endif

View File

@@ -161,6 +161,8 @@ public:
#include "wx/msw/ole/dataobj.h" #include "wx/msw/ole/dataobj.h"
#elif defined(__WXMOTIF__) #elif defined(__WXMOTIF__)
#include "wx/motif/dataobj.h" #include "wx/motif/dataobj.h"
#elif defined(__WXX11__)
#include "wx/x11/dataobj.h"
#elif defined(__WXGTK__) #elif defined(__WXGTK__)
#include "wx/gtk/dataobj.h" #include "wx/gtk/dataobj.h"
#elif defined(__WXMAC__) #elif defined(__WXMAC__)

View File

@@ -21,7 +21,7 @@ enum
#elif defined(__WXGTK__) #elif defined(__WXGTK__)
#include "wx/generic/filedlgg.h" #include "wx/generic/filedlgg.h"
#elif defined(__WXX11__) #elif defined(__WXX11__)
#include "wx/generic/filedlg.h" #include "wx/generic/filedlgg.h"
#elif defined(__WXMGL__) #elif defined(__WXMGL__)
#include "wx/generic/filedlgg.h" #include "wx/generic/filedlgg.h"
#elif defined(__WXMAC__) #elif defined(__WXMAC__)

View File

@@ -13,6 +13,7 @@
#define _WX_PRIVATE_H_ #define _WX_PRIVATE_H_
#include "wx/defs.h" #include "wx/defs.h"
#include "X11/Xlib.h"
class wxMouseEvent; class wxMouseEvent;
class wxKeyEvent; class wxKeyEvent;
@@ -116,5 +117,24 @@ private:
extern "C" XtAppContext wxGetAppContext(); extern "C" XtAppContext wxGetAppContext();
#define wxMAX_RGB 0xff
#define wxMAX_SV 1000
#define wxSIGN(x) ((x < 0) ? -x : x)
#define wxH_WEIGHT 4
#define wxS_WEIGHT 1
#define wxV_WEIGHT 2
typedef struct wx_hsv {
int h,s,v;
} wxHSV;
#define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z))
#define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z))
void wxHSVToXColor(wxHSV *hsv,XColor *xcolor);
void wxXColorToHSV(wxHSV *hsv,XColor *xcolor);
void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor);
void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor);
#endif #endif
// _WX_PRIVATE_H_ // _WX_PRIVATE_H_

View File

@@ -425,30 +425,11 @@ void WXDLLEXPORT wxGetMousePosition( int* x, int* y );
// The resulting warnings are switched off here // The resulting warnings are switched off here
#pragma message disable nosimpint #pragma message disable nosimpint
#endif #endif
#include <X11/Xlib.h> // #include <X11/Xlib.h>
#ifdef __VMS__ #ifdef __VMS__
#pragma message enable nosimpint #pragma message enable nosimpint
#endif #endif
#define wxMAX_RGB 0xff
#define wxMAX_SV 1000
#define wxSIGN(x) ((x < 0) ? -x : x)
#define wxH_WEIGHT 4
#define wxS_WEIGHT 1
#define wxV_WEIGHT 2
typedef struct wx_hsv {
int h,s,v;
} wxHSV;
#define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z))
#define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z))
void wxHSVToXColor(wxHSV *hsv,XColor *xcolor);
void wxXColorToHSV(wxHSV *hsv,XColor *xcolor);
void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor);
void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor);
#endif //__X__ #endif //__X__
#endif // wxUSE_GUI #endif // wxUSE_GUI

View File

@@ -1,51 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: accel.h
// Purpose: wxAcceleratorTable class
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ACCEL_H_
#define _WX_ACCEL_H_
#ifdef __GNUG__
#pragma interface "accel.h"
#endif
#include "wx/object.h"
#include "wx/string.h"
#include "wx/event.h"
class WXDLLEXPORT wxAcceleratorTable: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxAcceleratorTable)
public:
wxAcceleratorTable();
wxAcceleratorTable(const wxString& resource); // Load from .rc resource
wxAcceleratorTable(int n, wxAcceleratorEntry entries[]); // Load from array
// Copy constructors
wxAcceleratorTable(const wxAcceleratorTable& accel) { Ref(accel); }
wxAcceleratorTable(const wxAcceleratorTable* accel) { if (accel) Ref(*accel); }
~wxAcceleratorTable();
wxAcceleratorTable& operator = (const wxAcceleratorTable& accel) { if (*this == accel) return (*this); Ref(accel); return *this; }
bool operator == (const wxAcceleratorTable& accel) { return m_refData == accel.m_refData; }
bool operator != (const wxAcceleratorTable& accel) { return m_refData != accel.m_refData; }
bool Ok() const;
// Implementation only
int GetCount() const;
wxAcceleratorEntry* GetEntries() const;
};
WXDLLEXPORT_DATA(extern wxAcceleratorTable) wxNullAcceleratorTable;
#endif
// _WX_ACCEL_H_

View File

@@ -135,8 +135,8 @@ public:
wxBitmap(const char bits[], int width, int height, int depth = 1); wxBitmap(const char bits[], int width, int height, int depth = 1);
// from XPM // from XPM
wxBitmap(const char **data) { (void)CreateFromXpm(data); } wxBitmap(const char **data) { (void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); }
wxBitmap(char **data) { (void)CreateFromXpm((const char **)data); } wxBitmap(char **data) { (void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); }
// 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);
@@ -162,6 +162,8 @@ public:
wxImage ConvertToImage() const; wxImage ConvertToImage() const;
bool CopyFromIcon(const wxIcon& icon);
bool Ok() const { return (M_BITMAPDATA && M_BITMAPDATA->m_ok); } bool Ok() const { return (M_BITMAPDATA && M_BITMAPDATA->m_ok); }
int GetWidth() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_width : 0); } int GetWidth() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_width : 0); }
int GetHeight() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_height : 0); } int GetHeight() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_height : 0); }
@@ -205,7 +207,6 @@ protected:
static wxList sm_handlers; static wxList sm_handlers;
protected: protected:
bool CreateFromXpm(const char **bits);
bool CreateFromImage(const wxImage& image, int depth); bool CreateFromImage(const wxImage& image, int depth);
}; };

View File

@@ -51,6 +51,8 @@ public:
inline bool operator != (const wxIcon& icon) const { return m_refData != icon.m_refData; } inline bool operator != (const wxIcon& icon) const { return m_refData != icon.m_refData; }
virtual bool Ok() const { return ((m_refData != NULL) && (M_ICONDATA->m_ok)); } virtual bool Ok() const { return ((m_refData != NULL) && (M_ICONDATA->m_ok)); }
bool CopyFromBitmap(const wxBitmap& bitmap);
}; };
#endif #endif

View File

@@ -69,7 +69,7 @@ public:
bool operator == (const wxPalette& palette) const { return m_refData == palette.m_refData; } bool operator == (const wxPalette& palette) const { return m_refData == palette.m_refData; }
bool operator != (const wxPalette& palette) const { return m_refData != palette.m_refData; } bool operator != (const wxPalette& palette) const { return m_refData != palette.m_refData; }
// Motif-specific // X-specific
WXColormap GetXColormap(WXDisplay* display = NULL) const; WXColormap GetXColormap(WXDisplay* display = NULL) const;
bool TransferBitmap(void *data, int depth, int size); bool TransferBitmap(void *data, int depth, int size);
bool TransferBitmap8(unsigned char *data, unsigned long size, void *dest, unsigned int bpp); bool TransferBitmap8(unsigned char *data, unsigned long size, void *dest, unsigned int bpp);

View File

@@ -13,6 +13,7 @@
#define _WX_PRIVATE_H_ #define _WX_PRIVATE_H_
#include "wx/defs.h" #include "wx/defs.h"
#include "X11/Xlib.h"
class wxMouseEvent; class wxMouseEvent;
class wxKeyEvent; class wxKeyEvent;
@@ -77,6 +78,25 @@ extern XColor itemColors[5] ;
#define wxTOPS_INDEX 3 #define wxTOPS_INDEX 3
#define wxBOTS_INDEX 4 #define wxBOTS_INDEX 4
#define wxMAX_RGB 0xff
#define wxMAX_SV 1000
#define wxSIGN(x) ((x < 0) ? -x : x)
#define wxH_WEIGHT 4
#define wxS_WEIGHT 1
#define wxV_WEIGHT 2
typedef struct wx_hsv {
int h,s,v;
} wxHSV;
#define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z))
#define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z))
void wxHSVToXColor(wxHSV *hsv,XColor *xcolor);
void wxXColorToHSV(wxHSV *hsv,XColor *xcolor);
void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor);
void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// accessors for C modules // accessors for C modules
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -55,6 +55,10 @@
#endif #endif
#endif #endif
#ifdef __WXX11__
#include "X11/Xlib.h"
#endif
IMPLEMENT_CLASS(wxColourDatabase, wxList) IMPLEMENT_CLASS(wxColourDatabase, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList) IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList) IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
@@ -370,12 +374,9 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
#ifdef __WXMOTIF__ #ifdef __WXMOTIF__
Display *display = XtDisplay((Widget) wxTheApp->GetTopLevelWidget()) ; Display *display = XtDisplay((Widget) wxTheApp->GetTopLevelWidget()) ;
#endif #endif
#ifdef __XVIEW__ #ifdef __WXX11__
Xv_Screen screen = xv_get(xview_server, SERVER_NTH_SCREEN, 0); Display* display = (Display*) wxGetDisplay();
Xv_opaque root_window = xv_get(screen, XV_ROOT);
Display *display = (Display *)xv_get(root_window, XV_DISPLAY);
#endif #endif
/* MATTHEW: [4] Use wxGetMainColormap */ /* MATTHEW: [4] Use wxGetMainColormap */
if (!XParseColor(display, (Colormap) wxTheApp->GetMainColormap((WXDisplay*) display), colour,&xcolour)) if (!XParseColor(display, (Colormap) wxTheApp->GetMainColormap((WXDisplay*) display), colour,&xcolour))
return NULL; return NULL;

View File

@@ -1,116 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: accel.cpp
// Purpose: wxAcceleratorTable
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "accel.h"
#endif
#include "wx/setup.h"
#include "wx/accel.h"
#include "wx/string.h"
#include "wx/utils.h"
#include <ctype.h>
IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData
{
friend class WXDLLEXPORT wxAcceleratorTable;
public:
wxAcceleratorRefData();
~wxAcceleratorRefData();
public:
int m_count;
wxAcceleratorEntry* m_entries;
};
#define M_ACCELDATA ((wxAcceleratorRefData *)m_refData)
wxAcceleratorRefData::wxAcceleratorRefData()
{
m_count = 0;
m_entries = (wxAcceleratorEntry*) NULL;
}
wxAcceleratorRefData::~wxAcceleratorRefData()
{
delete[] m_entries;
m_entries = (wxAcceleratorEntry*) NULL;
m_count = 0;
}
wxAcceleratorTable::wxAcceleratorTable()
{
m_refData = (wxAcceleratorRefData*) NULL;
}
wxAcceleratorTable::~wxAcceleratorTable()
{
// Data deleted in ~wxObject
}
// Load from .rc resource
wxAcceleratorTable::wxAcceleratorTable(const wxString& WXUNUSED(resource))
{
m_refData = new wxAcceleratorRefData;
}
// Create from an array
wxAcceleratorTable::wxAcceleratorTable(int n, wxAcceleratorEntry entries[])
{
wxAcceleratorRefData* data = new wxAcceleratorRefData;
m_refData = data;
data->m_count = n;
data->m_entries = new wxAcceleratorEntry[n];
int i;
for (i = 0; i < n; i++)
data->m_entries[i] = entries[i];
}
bool wxAcceleratorTable::Ok() const
{
return (m_refData != (wxAcceleratorRefData*) NULL);
}
int wxAcceleratorTable::GetCount() const
{
return M_ACCELDATA->m_count;
}
wxAcceleratorEntry* wxAcceleratorTable::GetEntries() const
{
return M_ACCELDATA->m_entries;
}
// Implementation use only
bool wxAcceleratorEntry::MatchesEvent(const wxKeyEvent& event) const
{
bool eventAltDown = event.AltDown();
bool eventCtrlDown = event.ControlDown();
bool eventShiftDown = event.ShiftDown();
int eventKeyCode = event.KeyCode();
bool accAltDown = ((GetFlags() & wxACCEL_ALT) == wxACCEL_ALT);
bool accCtrlDown = ((GetFlags() & wxACCEL_CTRL) == wxACCEL_CTRL);
bool accShiftDown = ((GetFlags() & wxACCEL_SHIFT) == wxACCEL_SHIFT);
int accKeyCode = GetKeyCode();
int accKeyCode2 = GetKeyCode();
if (isascii(accKeyCode2))
accKeyCode2 = tolower(accKeyCode2);
return ((eventAltDown == accAltDown) && (eventCtrlDown == accCtrlDown) &&
(eventShiftDown == accShiftDown) &&
((eventKeyCode == accKeyCode || eventKeyCode == accKeyCode2))) ;
}

View File

@@ -73,6 +73,8 @@ typedef int (*XErrorHandlerFunc)(Display *, XErrorEvent *);
XErrorHandlerFunc gs_pfnXErrorHandler = 0; XErrorHandlerFunc gs_pfnXErrorHandler = 0;
static Window XGetParent(Window window);
static int wxXErrorHandler(Display *dpy, XErrorEvent *xevent) static int wxXErrorHandler(Display *dpy, XErrorEvent *xevent)
{ {
// just forward to the default handler for now // just forward to the default handler for now
@@ -315,13 +317,13 @@ void wxApp::ProcessXEvent(WXEvent* _event)
if (win) if (win)
{ {
wxKeyEvent keyEvent(wxEVT_KEY_DOWN); wxKeyEvent keyEvent(wxEVT_KEY_DOWN);
wxTranslateKeyEvent(keyEvent, win, window, xEvent); wxTranslateKeyEvent(keyEvent, win, window, event);
// We didn't process wxEVT_KEY_DOWN, so send // We didn't process wxEVT_KEY_DOWN, so send
// wxEVT_KEY_CHAR // wxEVT_CHAR
if (!win->ProcessEvent( keyEvent )) if (!win->ProcessEvent( keyEvent ))
{ {
keyEvent.SetEventType(wxEVT_KEY_CHAR); keyEvent.SetEventType(wxEVT_CHAR);
win->ProcessEvent( keyEvent ); win->ProcessEvent( keyEvent );
} }
@@ -354,7 +356,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
* window is recieved. Prevents flicker as windows are resized. * window is recieved. Prevents flicker as windows are resized.
*/ */
Display *disp = wxGetDisplay(); Display *disp = (Display*) wxGetDisplay();
XEvent report; XEvent report;
// to avoid flicker // to avoid flicker
@@ -370,7 +372,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
wxSizeEvent sizeEvent(sz, win->GetId()); wxSizeEvent sizeEvent(sz, win->GetId());
sizeEvent.SetEventObject(win); sizeEvent.SetEventObject(win);
win->ProcessEvent( wxevent ); win->ProcessEvent( sizeEvent );
} }
return; return;
@@ -589,8 +591,8 @@ bool wxApp::OnInitGui()
(const char*) className); (const char*) className);
exit(-1); exit(-1);
} }
XSelectInput(m_initialDisplay, XSelectInput((Display*) m_initialDisplay,
XDefaultRootWindow(m_initialDisplay), XDefaultRootWindow((Display*) m_initialDisplay),
PropertyChangeMask); PropertyChangeMask);
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
@@ -624,7 +626,7 @@ static Window XGetParent(Window window)
{ {
Window parent, root = 0; Window parent, root = 0;
unsigned int noChildren = 0; unsigned int noChildren = 0;
if (XQueryTree(wxGetDisplay(), window, & root, & parent, if (XQueryTree((Display*) wxGetDisplay(), window, & root, & parent,
NULL, & noChildren)) NULL, & noChildren))
return parent; return parent;
else else

6
src/x11/bdiag.xbm Normal file
View File

@@ -0,0 +1,6 @@
#define bdiag_width 16
#define bdiag_height 16
static char bdiag_bits[] = {
0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04,
0x02, 0x02, 0x01, 0x01, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10,
0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01};

View File

@@ -115,11 +115,6 @@ wxBitmap::wxBitmap(const wxString& filename, long type)
LoadFile(filename, (int)type); LoadFile(filename, (int)type);
} }
wxBitmap::wxBitmap(char **data)
{
(void) Create((void *)data, 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();
@@ -502,200 +497,6 @@ bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags
return TRUE; return TRUE;
} }
#if wxHAVE_LIB_XPM
class WXDLLEXPORT wxXPMFileHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxXPMFileHandler)
public:
inline wxXPMFileHandler()
{
m_name = "XPM file";
m_extension = "xpm";
m_type = wxBITMAP_TYPE_XPM;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL);
};
IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler)
bool wxXPMFileHandler::LoadFile( wxBitmap *bitmap, const wxString& name, long WXUNUSED(flags),
int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight) )
{
Display *dpy = (Display*) wxGetDisplay();
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
XpmAttributes xpmAttr;
Pixmap pixmap;
Pixmap mask = 0;
M_BITMAPHANDLERDATA->m_ok = FALSE;
xpmAttr.valuemask = XpmReturnInfos | XpmCloseness;
xpmAttr.closeness = 40000;
int errorStatus = XpmReadFileToPixmap(dpy,
RootWindow(dpy, DefaultScreen(dpy)), (char*) (const char*) name,
&pixmap, &mask, &xpmAttr);
if (errorStatus == XpmSuccess)
{
M_BITMAPHANDLERDATA->m_pixmap = (WXPixmap) pixmap;
if ( mask )
{
M_BITMAPHANDLERDATA->m_bitmapMask = new wxMask;
M_BITMAPHANDLERDATA->m_bitmapMask->SetPixmap((WXPixmap) mask);
}
unsigned int depthRet;
int xRet, yRet;
unsigned int widthRet, heightRet, borderWidthRet;
Window rootWindowRet;
XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet,
&widthRet, &heightRet, &borderWidthRet, &depthRet);
M_BITMAPHANDLERDATA->m_width = xpmAttr.width;
M_BITMAPHANDLERDATA->m_height = xpmAttr.height;
/*
if ( xpmAttr.npixels > 2 )
{
M_BITMAPHANDLERDATA->m_depth = 8; // TODO: next time not just a guess :-) ...
} else
{
M_BITMAPHANDLERDATA->m_depth = 1; // mono
}
*/
M_BITMAPHANDLERDATA->m_depth = depthRet;
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
XpmFreeAttributes(&xpmAttr);
M_BITMAPHANDLERDATA->m_ok = TRUE;
return TRUE;
} else
{
// XpmDebugError(errorStatus, name);
M_BITMAPHANDLERDATA->m_ok = FALSE;
return FALSE;
}
}
bool wxXPMFileHandler::SaveFile( wxBitmap *bitmap, const wxString& name, int WXUNUSED(type),
const wxPalette *WXUNUSED(palette))
{
if (M_BITMAPHANDLERDATA->m_ok && M_BITMAPHANDLERDATA->m_pixmap)
{
Display *dpy = (Display*) M_BITMAPHANDLERDATA->m_display;
int errorStatus = XpmWriteFileFromPixmap(dpy, (char*) (const char*) name,
(Pixmap) M_BITMAPHANDLERDATA->m_pixmap,
(M_BITMAPHANDLERDATA->m_bitmapMask ? (Pixmap) M_BITMAPHANDLERDATA->m_bitmapMask->GetPixmap() : (Pixmap) 0),
(XpmAttributes *) NULL);
if (errorStatus == XpmSuccess)
return TRUE;
else
return FALSE;
}
else
return FALSE;
}
class WXDLLEXPORT wxXPMDataHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxXPMDataHandler)
public:
inline wxXPMDataHandler()
{
m_name = "XPM data";
m_extension = "xpm";
m_type = wxBITMAP_TYPE_XPM_DATA;
};
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
};
IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler)
bool wxXPMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags),
int width, int height, int WXUNUSED(depth))
{
M_BITMAPHANDLERDATA->m_width = width;
M_BITMAPHANDLERDATA->m_height = height;
M_BITMAPHANDLERDATA->m_depth = 1;
M_BITMAPHANDLERDATA->m_freePixmap = TRUE;
Display *dpy = (Display*) wxGetDisplay();
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
XpmAttributes xpmAttr;
xpmAttr.valuemask = XpmReturnInfos; /* nothing yet, but get infos back */
XpmColorSymbol symbolicColors[4];
if (sg_Control && sg_Control->GetMainWidget())
{
symbolicColors[0].name = "foreground";
symbolicColors[0].value = NULL;
symbolicColors[1].name = "background";
symbolicColors[1].value = NULL;
XtVaGetValues((Widget) sg_Control->GetMainWidget(),
XmNforeground, &symbolicColors[0].pixel,
XmNbackground, &symbolicColors[1].pixel,NULL);
xpmAttr.numsymbols = 2;
xpmAttr.colorsymbols = symbolicColors;
xpmAttr.valuemask |= XpmColorSymbols; // add flag
}
Pixmap pixmap;
Pixmap mask = 0;
int ErrorStatus = XpmCreatePixmapFromData(dpy, RootWindow(dpy, DefaultScreen(dpy)),
(char**) data, &pixmap, &mask, &xpmAttr);
if (ErrorStatus == XpmSuccess)
{
// Set attributes
M_BITMAPHANDLERDATA->m_width = xpmAttr.width;
M_BITMAPHANDLERDATA->m_height = xpmAttr.height;
unsigned int depthRet;
int xRet, yRet;
unsigned int widthRet, heightRet, borderWidthRet;
Window rootWindowRet;
XGetGeometry(dpy, pixmap, &rootWindowRet, &xRet, &yRet,
&widthRet, &heightRet, &borderWidthRet, &depthRet);
/*
if ( xpmAttr.npixels > 2 )
{
M_BITMAPHANDLERDATA->m_depth = 8; // next time not just a guess :-) ...
} else
{
M_BITMAPHANDLERDATA->m_depth = 1; // mono
}
*/
M_BITMAPHANDLERDATA->m_depth = depthRet;
M_BITMAPHANDLERDATA->m_numColors = xpmAttr.npixels;
XpmFreeAttributes(&xpmAttr);
M_BITMAPHANDLERDATA->m_ok = TRUE;
M_BITMAPHANDLERDATA->m_pixmap = (WXPixmap) pixmap;
if ( mask )
{
M_BITMAPHANDLERDATA->m_bitmapMask = new wxMask;
M_BITMAPHANDLERDATA->m_bitmapMask->SetPixmap((WXPixmap) mask);
}
}
else
{
// XpmDebugError(ErrorStatus, NULL);
M_BITMAPHANDLERDATA->m_ok = FALSE;
}
return M_BITMAPHANDLERDATA->m_ok ;
}
#endif // wxHAVE_LIB_XPM
void wxBitmap::CleanUpHandlers() void wxBitmap::CleanUpHandlers()
{ {
wxNode *node = sm_handlers.First(); wxNode *node = sm_handlers.First();
@@ -715,106 +516,7 @@ void wxBitmap::InitStandardHandlers()
AddHandler(new wxXBMFileHandler); AddHandler(new wxXBMFileHandler);
AddHandler(new wxXBMDataHandler); AddHandler(new wxXBMDataHandler);
// XPM is considered standard for Motif, although it can be omitted if // XPM will be handled by wxImage
// libXpm is not installed
#if wxHAVE_LIB_XPM
AddHandler(new wxXPMFileHandler);
AddHandler(new wxXPMDataHandler);
#endif // wxHAVE_LIB_XPM
}
// We may need this sometime...
/****************************************************************************
NAME
XCreateInsensitivePixmap - create a grayed-out copy of a pixmap
SYNOPSIS
Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap )
DESCRIPTION
This function creates a grayed-out copy of the argument pixmap, suitable
for use as a XmLabel's XmNlabelInsensitivePixmap resource.
RETURN VALUES
The return value is the new Pixmap id or zero on error. Errors include
a NULL display argument or an invalid Pixmap argument.
ERRORS
If one of the XLib functions fail, it will produce a X error. The
default X error handler prints a diagnostic and calls exit().
SEE ALSO
XCopyArea(3), XCreateBitmapFromData(3), XCreateGC(3), XCreatePixmap(3),
XFillRectangle(3), exit(2)
AUTHOR
John R Veregge - john@puente.jpl.nasa.gov
Advanced Engineering and Prototyping Group (AEG)
Information Systems Technology Section (395)
Jet Propulsion Lab - Calif Institute of Technology
*****************************************************************************/
Pixmap
XCreateInsensitivePixmap( Display *display, Pixmap pixmap )
{
static 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
};
GC gc;
Pixmap ipixmap, stipple;
unsigned width, height, depth;
Window window; /* These return values */
unsigned border; /* from XGetGeometry() */
int x, y; /* are not needed. */
ipixmap = 0;
if ( NULL == display || 0 == pixmap )
return ipixmap;
if ( 0 == XGetGeometry( display, pixmap, &window, &x, &y,
&width, &height, &border, &depth )
)
return ipixmap; /* BadDrawable: probably an invalid pixmap */
/* Get the stipple pixmap to be used to 'gray-out' the argument pixmap.
*/
stipple = XCreateBitmapFromData( display, pixmap, stipple_data, 16, 16 );
if ( 0 != stipple )
{
gc = XCreateGC( display, pixmap, (XtGCMask)0, (XGCValues*)NULL );
if ( NULL != gc )
{
/* Create an identical copy of the argument pixmap.
*/
ipixmap = XCreatePixmap( display, pixmap, width, height, depth );
if ( 0 != ipixmap )
{
/* Copy the argument pixmap into the new pixmap.
*/
XCopyArea( display, pixmap, ipixmap,
gc, 0, 0, width, height, 0, 0 );
/* Refill the new pixmap using the stipple algorithm/pixmap.
*/
XSetStipple( display, gc, stipple );
XSetFillStyle( display, gc, FillStippled );
XFillRectangle( display, ipixmap, gc, 0, 0, width, height );
}
XFreeGC( display, gc );
}
XFreePixmap( display, stipple );
}
return ipixmap;
} }
// Creates a bitmap with transparent areas drawn in // Creates a bitmap with transparent areas drawn in
@@ -838,9 +540,6 @@ wxBitmap wxCreateMaskedBitmap(const wxBitmap& bitmap, wxColour& colour)
return newBitmap; return newBitmap;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxImage conversion routines // wxImage conversion routines
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -1205,7 +904,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
{ {
wxBitmap maskBitmap(width, height, 1); wxBitmap maskBitmap(width, height, 1);
GC gcMask = XCreateGC( dpy, (Pixmap) maskBitmap.GetPixmap(), (XtGCMask) 0, (XGCValues*)NULL ); GC gcMask = XCreateGC( dpy, (Pixmap) maskBitmap.GetPixmap(), 0, (XGCValues*)NULL );
XPutImage( dpy, (Drawable)maskBitmap.GetPixmap(), gcMask, mask_image, 0, 0, 0, 0, width, height ); XPutImage( dpy, (Drawable)maskBitmap.GetPixmap(), gcMask, mask_image, 0, 0, 0, 0, width, height );
XDestroyImage( mask_image ); XDestroyImage( mask_image );
@@ -1342,3 +1041,9 @@ wxImage wxBitmap::ConvertToImage() const
return image; return image;
} }
bool wxBitmap::CopyFromIcon(const wxIcon& icon)
{
// TODO
return FALSE;
}

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: src/motif/brush.cpp // Name: src/x11/brush.cpp
// Purpose: wxBrush // Purpose: wxBrush
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:

6
src/x11/cdiag.xbm Normal file
View File

@@ -0,0 +1,6 @@
#define cdiag_width 16
#define cdiag_height 16
static char cdiag_bits[] = {
0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24,
0x42, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18,
0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x81, 0x81};

View File

@@ -77,6 +77,9 @@ bool wxClipboardOpen()
bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat)
{ {
// TODO
return FALSE;
#if 0
// Only text is supported. // Only text is supported.
if (dataFormat != wxDF_TEXT) if (dataFormat != wxDF_TEXT)
return FALSE; return FALSE;
@@ -86,7 +89,7 @@ bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat)
Window window = (Window) 0; Window window = (Window) 0;
if (wxTheApp->GetTopWindow()) if (wxTheApp->GetTopWindow())
window = XtWindow( (Widget) wxTheApp->GetTopWindow()->GetTopWidget() ); window = XtWindow( (Widget) wxTheApp->GetTopWindow()->GetTopWindow() );
int success = XmClipboardRetrieve((Display*) wxGetDisplay(), int success = XmClipboardRetrieve((Display*) wxGetDisplay(),
window, "TEXT", (XtPointer) 0, 0, & numBytes, & privateId) ; window, "TEXT", (XtPointer) 0, 0, & numBytes, & privateId) ;
@@ -97,10 +100,14 @@ bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat)
return FALSE; return FALSE;
else else
return TRUE; return TRUE;
#endif
} }
bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int WXUNUSED(width), int WXUNUSED(height)) bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int WXUNUSED(width), int WXUNUSED(height))
{ {
// TODO
return FALSE;
#if 0
if (dataFormat != wxDF_TEXT) if (dataFormat != wxDF_TEXT)
return FALSE; return FALSE;
@@ -147,10 +154,14 @@ bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int WXUNUSED(wid
; ;
return TRUE; return TRUE;
#endif
} }
wxObject *wxGetClipboardData(wxDataFormat dataFormat, long *len) wxObject *wxGetClipboardData(wxDataFormat dataFormat, long *len)
{ {
// TODO
return FALSE;
#if 0
if (dataFormat != wxDF_TEXT) if (dataFormat != wxDF_TEXT)
return (wxObject*) NULL; return (wxObject*) NULL;
@@ -206,6 +217,7 @@ wxObject *wxGetClipboardData(wxDataFormat dataFormat, long *len)
} }
return NULL; return NULL;
#endif
} }
wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat) wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat)

View File

@@ -28,7 +28,7 @@
#pragma message enable nosimpint #pragma message enable nosimpint
#endif #endif
#include "wx/motif/private.h" #include "wx/x11/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)

6
src/x11/cross.xbm Normal file
View File

@@ -0,0 +1,6 @@
#define cross_width 15
#define cross_height 15
static char cross_bits[] = {
0x84, 0x10, 0x84, 0x10, 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10,
0x84, 0x10, 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10,
0xff, 0x7f, 0x84, 0x10, 0x84, 0x10};

View File

@@ -23,6 +23,7 @@
#pragma message disable nosimpint #pragma message disable nosimpint
#endif #endif
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
#include <X11/Xutil.h>
#ifdef __VMS__ #ifdef __VMS__
#pragma message enable nosimpint #pragma message enable nosimpint
#endif #endif

View File

@@ -25,6 +25,7 @@
#pragma message enable nosimpint #pragma message enable nosimpint
#endif #endif
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/x11/private.h"
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// global data // global data

View File

@@ -51,6 +51,8 @@
#ifdef __VMS__ #ifdef __VMS__
#pragma message disable nosimpint #pragma message disable nosimpint
#endif #endif
#include "X11/Xlib.h"
#include "X11/Xutil.h"
#ifdef __VMS__ #ifdef __VMS__
#pragma message enable nosimpint #pragma message enable nosimpint
#endif #endif

View File

@@ -24,7 +24,7 @@
#pragma message enable nosimpint #pragma message enable nosimpint
#endif #endif
#include "wx/motif/private.h" #include "wx/x11/private.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxMemoryDC // wxMemoryDC

View File

@@ -25,7 +25,9 @@
#include "wx/app.h" #include "wx/app.h"
#include "wx/evtloop.h" #include "wx/evtloop.h"
#include "wx/tooltip.h" #include "wx/tooltip.h"
#if wxUSE_THREADS
#include "wx/thread.h"
#endif
#include "wx/x11/private.h" #include "wx/x11/private.h"
#include "X11/Xlib.h" #include "X11/Xlib.h"
@@ -52,7 +54,7 @@ public:
public: public:
// preprocess an event, return TRUE if processed (i.e. no further // preprocess an event, return TRUE if processed (i.e. no further
// dispatching required) // dispatching required)
bool PreProcessMessage(XEvent* event); bool PreProcessEvent(XEvent* event);
// the exit code of the event loop // the exit code of the event loop
int m_exitcode; int m_exitcode;
@@ -152,7 +154,7 @@ int wxEventLoop::Run()
m_impl->m_keepGoing = TRUE; m_impl->m_keepGoing = TRUE;
while ( m_impl->m_keepGoing ) while ( m_impl->m_keepGoing )
{ {
#if wxUSE_THREADS #if 0 // wxUSE_THREADS
wxMutexGuiLeaveOrEnter(); wxMutexGuiLeaveOrEnter();
#endif // wxUSE_THREADS #endif // wxUSE_THREADS
@@ -162,7 +164,7 @@ int wxEventLoop::Run()
{ {
if (!m_impl->SendIdleEvent()) if (!m_impl->SendIdleEvent())
{ {
#if wxUSE_THREADS #if 0 // wxUSE_THREADS
// leave the main loop to give other threads a chance to // leave the main loop to give other threads a chance to
// perform their GUI work // perform their GUI work
wxMutexGuiLeave(); wxMutexGuiLeave();
@@ -205,8 +207,8 @@ void wxEventLoop::Exit(int rc)
bool wxEventLoop::Pending() const bool wxEventLoop::Pending() const
{ {
XFlush(wxGetDisplay()); XFlush((Display*) wxGetDisplay());
return (XPending(wxGetDisplay()) > 0); return (XPending((Display*) wxGetDisplay()) > 0);
} }
bool wxEventLoop::Dispatch() bool wxEventLoop::Dispatch()
@@ -215,7 +217,7 @@ bool wxEventLoop::Dispatch()
// TODO allowing for threads, as per e.g. wxMSW // TODO allowing for threads, as per e.g. wxMSW
XNextEvent(wxGetDisplay(), & event); XNextEvent((Display*) wxGetDisplay(), & event);
m_impl->ProcessEvent(& event); m_impl->ProcessEvent(& event);
return TRUE; return TRUE;
} }

6
src/x11/fdiag.xbm Normal file
View File

@@ -0,0 +1,6 @@
#define fdiag_width 16
#define fdiag_height 16
static char fdiag_bits[] = {
0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20,
0x40, 0x40, 0x80, 0x80, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08,
0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80};

View File

@@ -27,7 +27,6 @@ ALL_SOURCES = \
generic/msgdlgg.cpp \ generic/msgdlgg.cpp \
generic/notebook.cpp \ generic/notebook.cpp \
generic/numdlgg.cpp \ generic/numdlgg.cpp \
generic/paletteg.cpp \
generic/panelg.cpp \ generic/panelg.cpp \
generic/printps.cpp \ generic/printps.cpp \
generic/prntdlgg.cpp \ generic/prntdlgg.cpp \
@@ -175,7 +174,6 @@ ALL_SOURCES = \
common/xpmdecod.cpp \ common/xpmdecod.cpp \
common/zipstrm.cpp \ common/zipstrm.cpp \
common/zstream.cpp \ common/zstream.cpp \
x11/accel.cpp \
x11/app.cpp \ x11/app.cpp \
x11/bitmap.cpp \ x11/bitmap.cpp \
x11/brush.cpp \ x11/brush.cpp \
@@ -712,7 +710,6 @@ GENERICOBJS = \
msgdlgg.o \ msgdlgg.o \
notebook.o \ notebook.o \
numdlgg.o \ numdlgg.o \
paletteg.o \
panelg.o \ panelg.o \
printps.o \ printps.o \
prntdlgg.o \ prntdlgg.o \
@@ -736,8 +733,7 @@ GENERICOBJS = \
treelay.o \ treelay.o \
wizard.o wizard.o
GUIOBJS = \ GUI_LOWLEVEL_OBJS = \
accel.o \
app.o \ app.o \
bitmap.o \ bitmap.o \
brush.o \ brush.o \

6
src/x11/horiz.xbm Normal file
View File

@@ -0,0 +1,6 @@
#define horiz_width 15
#define horiz_height 15
static char horiz_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0x7f, 0x00, 0x00, 0x00, 0x00};

View File

@@ -79,3 +79,8 @@ bool wxIcon::LoadFile(const wxString& filename, long type,
return FALSE; return FALSE;
} }
bool wxIcon::CopyFromBitmap(const wxBitmap& bitmap)
{
// TODO
return FALSE;
}

View File

@@ -50,7 +50,7 @@ not the functionality that wxPalette::Create() aims to provide.
#ifdef __VMS__ #ifdef __VMS__
#pragma message enable nosimpint #pragma message enable nosimpint
#endif #endif
#include "wx/motif/private.h" #include "wx/x11/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxXPalette, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxXPalette, wxObject)

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: src/motif/pen.cpp // Name: src/x11/pen.cpp
// Purpose: wxPen // Purpose: wxPen
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:

View File

@@ -14,15 +14,17 @@
#include "wx/region.h" #include "wx/region.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/window.h"
#ifdef __VMS__ #ifdef __VMS__
#pragma message disable nosimpint #pragma message disable nosimpint
#endif #endif
#include "wx/x11/private.h"
#include "X11/Xutil.h"
#ifdef __VMS__ #ifdef __VMS__
#pragma message enable nosimpint #pragma message enable nosimpint
#endif #endif
// #include "wx/x11/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)

View File

@@ -40,12 +40,15 @@ void wxTimerCallback (wxTimer * timer)
if (timer->m_id == 0) if (timer->m_id == 0)
return; // Avoid to process spurious timer events return; // Avoid to process spurious timer events
// TODO
#if 0
if (!timer->m_oneShot) if (!timer->m_oneShot)
timer->m_id = XtAppAddTimeOut((XtAppContext) wxTheApp->GetAppContext(), timer->m_id = XtAppAddTimeOut((XtAppContext) wxTheApp->GetAppContext(),
timer->m_milli, timer->m_milli,
(XtTimerCallbackProc) wxTimerCallback, (XtTimerCallbackProc) wxTimerCallback,
(XtPointer) timer); (XtPointer) timer);
else else
#endif
timer->m_id = 0; timer->m_id = 0;
timer->Notify(); timer->Notify();
@@ -71,11 +74,13 @@ bool wxTimer::Start(int milliseconds, bool mode)
if (!wxTimerList.Find((long)this)) if (!wxTimerList.Find((long)this))
wxTimerList.Append((long)this, this); wxTimerList.Append((long)this, this);
// TODO
#if 0
m_id = XtAppAddTimeOut((XtAppContext) wxTheApp->GetAppContext(), m_id = XtAppAddTimeOut((XtAppContext) wxTheApp->GetAppContext(),
m_milli, m_milli,
(XtTimerCallbackProc) wxTimerCallback, (XtTimerCallbackProc) wxTimerCallback,
(XtPointer) this); (XtPointer) this);
#endif
return TRUE; return TRUE;
} }
@@ -83,7 +88,10 @@ void wxTimer::Stop()
{ {
if (m_id > 0) if (m_id > 0)
{ {
// TODO
#if 0
XtRemoveTimeOut (m_id); XtRemoveTimeOut (m_id);
#endif
m_id = 0; m_id = 0;
} }
m_milli = 0 ; m_milli = 0 ;

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: motif/toolbar.cpp // Name: x11/toolbar.cpp
// Purpose: wxToolBar // Purpose: wxToolBar
// Author: Julian Smart // Author: Julian Smart
// Modified by: 13.12.99 by VZ during toolbar classes reorganization // Modified by: 13.12.99 by VZ during toolbar classes reorganization

View File

@@ -52,6 +52,8 @@
#include "wx/unix/execute.h" #include "wx/unix/execute.h"
#include "wx/x11/private.h" #include "wx/x11/private.h"
#include "X11/Xresource.h"
#include "X11/Xutil.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// private functions // private functions
@@ -81,6 +83,10 @@ void wxFlushEvents()
Display *display = (Display*) wxGetDisplay(); Display *display = (Display*) wxGetDisplay();
XSync (display, FALSE); XSync (display, FALSE);
XFlush(display);
// TODO
#if 0
// XtAppPending returns availability of events AND timers/inputs, which // XtAppPending returns availability of events AND timers/inputs, which
// are processed via callbacks, so XtAppNextEvent will not return if // are processed via callbacks, so XtAppNextEvent will not return if
@@ -91,6 +97,7 @@ void wxFlushEvents()
// Jan Lessner: works better when events are non-X events // Jan Lessner: works better when events are non-X events
XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMXEvent); XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMXEvent);
} }
#endif
} }
// Check whether this window wants to process messages, e.g. Stop button // Check whether this window wants to process messages, e.g. Stop button
@@ -705,8 +712,6 @@ bool wxSetDisplay(const wxString& display_name)
} }
else else
{ {
Cardinal argc = 0;
Display* display = XOpenDisplay((const char*) display_name); Display* display = XOpenDisplay((const char*) display_name);
if (display) if (display)
@@ -813,24 +818,6 @@ char * wxFindAccelerator (const char *s)
#endif #endif
} }
XmString wxFindAcceleratorText (const char *s)
{
// VZ: this function returns incorrect keysym which completely breaks kbd
// handling
return NULL;
#if 0
// The accelerator text is after the \t char.
while (*s && *s != '\t')
s++;
if (*s == '\0')
return (NULL);
s++;
XmString text = XmStringCreateSimple ((char *)s);
return text;
#endif
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// keycode translations // keycode translations
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

6
src/x11/verti.xbm Normal file
View File

@@ -0,0 +1,6 @@
#define verti_width 15
#define verti_height 15
static char verti_bits[] = {
0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10,
0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10,
0x84, 0x10, 0x84, 0x10, 0x84, 0x10};

View File

@@ -45,6 +45,7 @@
#endif #endif
#include "wx/x11/private.h" #include "wx/x11/private.h"
#include "X11/Xutil.h"
#include <string.h> #include <string.h>
@@ -97,9 +98,9 @@ void wxWindowX11::Init()
// generic initializations first // generic initializations first
InitBase(); InitBase();
// Motif-specific // X11-specific
m_needsRefresh = TRUE; m_needsRefresh = TRUE;
m_mainWidget = (WXWidget) 0; m_mainWidget = (WXWindow) 0;
m_button1Pressed = m_button1Pressed =
m_button2Pressed = m_button2Pressed =
@@ -114,7 +115,7 @@ void wxWindowX11::Init()
m_vScrollBar = m_vScrollBar =
m_borderWidget = m_borderWidget =
m_scrolledWindow = m_scrolledWindow =
m_drawingArea = (WXWidget) 0; m_drawingArea = (WXWindow) 0;
m_hScroll = m_hScroll =
m_vScroll = FALSE; m_vScroll = FALSE;
@@ -175,14 +176,14 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
} }
// Destructor // Destructor
wxWindowX11::~wxWindow() wxWindowX11::~wxWindowX11()
{ {
if (g_captureWindow == this) if (g_captureWindow == this)
g_captureWindow = NULL; g_captureWindow = NULL;
m_isBeingDeleted = TRUE; m_isBeingDeleted = TRUE;
// Motif-specific actions first // X11-specific actions first
WXWindow wMain = GetMainWindow(); WXWindow wMain = GetMainWindow();
if ( wMain ) if ( wMain )
{ {
@@ -477,17 +478,17 @@ bool wxWindowX11::Show(bool show)
// Raise the window to the top of the Z order // Raise the window to the top of the Z order
void wxWindowX11::Raise() void wxWindowX11::Raise()
{ {
Window window = GetTopWindow(); Window window = (Window) GetTopWindow();
if (window) if (window)
XRaiseWindow(wxGetDisplay(), window); XRaiseWindow((Display*) wxGetDisplay(), window);
} }
// Lower the window to the bottom of the Z order // Lower the window to the bottom of the Z order
void wxWindowX11::Lower() void wxWindowX11::Lower()
{ {
Window window = GetTopWindow(); Window window = (Window) GetTopWindow();
if (window) if (window)
XLowerWindow(wxGetDisplay(), window); XLowerWindow((Display*) wxGetDisplay(), window);
} }
void wxWindowX11::SetTitle(const wxString& title) void wxWindowX11::SetTitle(const wxString& title)
@@ -510,7 +511,7 @@ wxString wxWindowX11::GetTitle() const
void wxWindowX11::DoCaptureMouse() void wxWindowX11::DoCaptureMouse()
{ {
g_captureWindow = this; g_captureWindow = (wxWindow*) this;
if ( m_winCaptured ) if ( m_winCaptured )
return; return;
@@ -581,7 +582,7 @@ void wxWindowX11::WarpPointer (int x, int y)
{ {
Window wClient = (Window) GetClientWindow(); Window wClient = (Window) GetClientWindow();
XWarpPointer(wxGetDisplay(), None, wClient, 0, 0, 0, 0, x, y); XWarpPointer((Display*) wxGetDisplay(), None, wClient, 0, 0, 0, 0, x, y);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -627,7 +628,7 @@ int wxWindowX11::GetScrollThumb(int orient) const
#endif #endif
} }
void wxWindowX11::SetScrollPos(int WXUNUSED(orient), int WXUNUSED(pos), bool WXUNUSED(refresh)) void wxWindowX11::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh))
{ {
// TODO // TODO
@@ -755,12 +756,12 @@ void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect)
int x2 = (dx >= 0) ? x + dx : x; int x2 = (dx >= 0) ? x + dx : x;
int y2 = (dy >= 0) ? y + dy : y; int y2 = (dy >= 0) ? y + dy : y;
wxClientDC dc(this); wxClientDC dc((wxWindow*) this);
dc.SetLogicalFunction (wxCOPY); dc.SetLogicalFunction (wxCOPY);
Window window = (Window) GetMainWindow(); Window window = (Window) GetMainWindow();
Display* display = wxGetDisplay(); Display* display = (Display*) wxGetDisplay();
XCopyArea(display, window, window, (GC) dc.GetGC(), XCopyArea(display, window, window, (GC) dc.GetGC(),
x1, y1, w1, h1, x2, y2); x1, y1, w1, h1, x2, y2);
@@ -978,7 +979,7 @@ void wxWindowX11::DoGetPosition(int *x, int *y) const
void wxWindowX11::DoScreenToClient(int *x, int *y) const void wxWindowX11::DoScreenToClient(int *x, int *y) const
{ {
Display *display = wxGetDisplay(); Display *display = (Display*) wxGetDisplay();
Window rootWindow = RootWindowOfScreen(DefaultScreenOfDisplay(display)); Window rootWindow = RootWindowOfScreen(DefaultScreenOfDisplay(display));
Window thisWindow = (Window) GetClientWindow(); Window thisWindow = (Window) GetClientWindow();
@@ -990,7 +991,7 @@ void wxWindowX11::DoScreenToClient(int *x, int *y) const
void wxWindowX11::DoClientToScreen(int *x, int *y) const void wxWindowX11::DoClientToScreen(int *x, int *y) const
{ {
Display *display = wxGetDisplay(); Display *display = (Display*) wxGetDisplay();
Window rootWindow = RootWindowOfScreen(DefaultScreenOfDisplay(display)); Window rootWindow = RootWindowOfScreen(DefaultScreenOfDisplay(display));
Window thisWindow = (Window) GetClientWindow(); Window thisWindow = (Window) GetClientWindow();
@@ -1237,8 +1238,8 @@ void wxWindowX11::GetTextExtent(const wxString& string,
void wxWindowX11::Refresh(bool eraseBack, const wxRect *rect) void wxWindowX11::Refresh(bool eraseBack, const wxRect *rect)
{ {
m_needsRefresh = TRUE; m_needsRefresh = TRUE;
Display *display = wxGetDisplay(); Display *display = (Display*) wxGetDisplay();
Window thisWindow = (Widget) GetMainWindow(); Window thisWindow = (Window) GetMainWindow();
XExposeEvent dummyEvent; XExposeEvent dummyEvent;
int width, height; int width, height;
@@ -1266,7 +1267,7 @@ void wxWindowX11::Refresh(bool eraseBack, const wxRect *rect)
if (eraseBack) if (eraseBack)
{ {
wxClientDC dc(this); wxClientDC dc((wxWindow*) this);
wxBrush backgroundBrush(GetBackgroundColour(), wxSOLID); wxBrush backgroundBrush(GetBackgroundColour(), wxSOLID);
dc.SetBackground(backgroundBrush); dc.SetBackground(backgroundBrush);
if (rect) if (rect)
@@ -1280,7 +1281,7 @@ void wxWindowX11::Refresh(bool eraseBack, const wxRect *rect)
void wxWindowX11::Clear() void wxWindowX11::Clear()
{ {
wxClientDC dc(this); wxClientDC dc((wxWindow*) this);
wxBrush brush(GetBackgroundColour(), wxSOLID); wxBrush brush(GetBackgroundColour(), wxSOLID);
dc.SetBackground(brush); dc.SetBackground(brush);
dc.Clear(); dc.Clear();
@@ -1352,20 +1353,15 @@ bool wxWindowX11::ProcessAccelerator(wxKeyEvent& event)
if (!m_acceleratorTable.Ok()) if (!m_acceleratorTable.Ok())
return FALSE; return FALSE;
int count = m_acceleratorTable.GetCount(); const wxAcceleratorEntry* entry = m_acceleratorTable.GetEntry(event);
wxAcceleratorEntry* entries = m_acceleratorTable.GetEntries(); if (entry)
int i;
for (i = 0; i < count; i++)
{
wxAcceleratorEntry* entry = & (entries[i]);
if (entry->MatchesEvent(event))
{ {
// Bingo, we have a match. Now find a control that matches the // Bingo, we have a match. Now find a control that matches the
// entry command id. // entry command id.
// Need to go up to the top of the window hierarchy, since it might // Need to go up to the top of the window hierarchy, since it might
// be e.g. a menu item // be e.g. a menu item
wxWindow* parent = this; wxWindow* parent = (wxWindow*) this;
while ( parent && !parent->IsTopLevel() ) while ( parent && !parent->IsTopLevel() )
parent = parent->GetParent(); parent = parent->GetParent();
@@ -1408,8 +1404,8 @@ bool wxWindowX11::ProcessAccelerator(wxKeyEvent& event)
} }
return FALSE; return FALSE;
} // matches event
}// for }// if
// We didn't match the key event against an accelerator. // We didn't match the key event against an accelerator.
return FALSE; return FALSE;
@@ -1456,10 +1452,10 @@ void wxDeleteWindowFromTable(Window w)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Add to hash table, add event handler // Add to hash table, add event handler
bool wxWindowX11::AttachWidget (wxWindow* WXUNUSED(parent), WXWindow mainWidget, bool wxWindowX11::AttachWindow (wxWindow* WXUNUSED(parent), WXWindow mainWidget,
int x, int y, int width, int height) int x, int y, int width, int height)
{ {
wxAddWindowToTable((Window ) mainWidget, this); wxAddWindowToTable((Window ) mainWidget, (wxWindow*) this);
// TODO // TODO
#if 0 #if 0
@@ -1503,7 +1499,7 @@ bool wxWindowX11::AttachWidget (wxWindow* WXUNUSED(parent), WXWindow mainWidget,
} }
// Remove event handler, remove from hash table // Remove event handler, remove from hash table
bool wxWindowX11::DetachWidget(WXWindow widget) bool wxWindowX11::DetachWindow(WXWindow widget)
{ {
// TODO // TODO
#if 0 #if 0
@@ -1545,7 +1541,7 @@ WXWindow wxWindowX11::GetMainWindow() const
return m_mainWidget; return m_mainWidget;
} }
WXWindow wxWindowX11::GetClientWidget() const WXWindow wxWindowX11::GetClientWindow() const
{ {
if (m_drawingArea != (WXWindow) 0) if (m_drawingArea != (WXWindow) 0)
return m_drawingArea; return m_drawingArea;
@@ -1903,7 +1899,7 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window,
// check for a double click // check for a double click
// TODO: where can we get this value from? // TODO: where can we get this value from?
//long dclickTime = XtGetMultiClickTime((Display*) wxGetDisplay()); //long dclickTime = XtGetMultiClickTime((Display*) wxGetDisplay());
long dClickTime = 200; long dclickTime = 200;
long ts = wxevent.GetTimestamp(); long ts = wxevent.GetTimestamp();
int buttonLast = win->GetLastClickedButton(); int buttonLast = win->GetLastClickedButton();

46
src/x11/wxwin.xbm Normal file
View File

@@ -0,0 +1,46 @@
#define wxwin.xbm_width 64
#define wxwin.xbm_height 64
static char wxwin.xbm_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x1f, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x40, 0x80, 0xc7, 0x19,
0x8e, 0x01, 0x50, 0x00, 0x40, 0x00, 0xc7, 0x39, 0xcf, 0x01, 0x70, 0x00,
0x40, 0x00, 0xc7, 0x31, 0x3c, 0x00, 0x50, 0x00, 0x40, 0x00, 0xc7, 0x21,
0x1c, 0x00, 0x70, 0x00, 0x40, 0x80, 0xe3, 0x20, 0x38, 0x00, 0x50, 0x00,
0x40, 0x80, 0xe3, 0x30, 0x3c, 0x00, 0x70, 0x00, 0x40, 0x80, 0xe3, 0x78,
0x76, 0x01, 0x50, 0x00, 0x40, 0x00, 0xdf, 0xff, 0xf3, 0x20, 0x70, 0x00,
0x40, 0x00, 0x8e, 0xff, 0x61, 0x70, 0x50, 0x00, 0x40, 0x00, 0x00, 0xfc,
0x01, 0xf8, 0x70, 0x00, 0x40, 0x00, 0x00, 0xfc, 0x01, 0xfc, 0x51, 0x00,
0x40, 0x00, 0x00, 0xfe, 0x03, 0xfc, 0x73, 0x00, 0x40, 0x00, 0x00, 0xff,
0x03, 0xf8, 0x51, 0x00, 0x40, 0x00, 0x00, 0xff, 0x07, 0xf0, 0x70, 0x00,
0x40, 0x00, 0x80, 0xff, 0x07, 0x60, 0x50, 0x00, 0x40, 0x00, 0x80, 0xff,
0x0f, 0xfc, 0x70, 0x00, 0x40, 0x00, 0xc0, 0xff, 0x1f, 0xfc, 0x50, 0x00,
0x40, 0x00, 0xe0, 0xff, 0x1f, 0xfc, 0x70, 0x00, 0x40, 0x00, 0xf0, 0x0f,
0x00, 0xfc, 0x50, 0x00, 0x40, 0x00, 0xf0, 0x07, 0x00, 0xfc, 0x70, 0x00,
0x40, 0x00, 0xf8, 0x07, 0x00, 0xfc, 0x50, 0x00, 0x40, 0x00, 0xfc, 0x03,
0x00, 0xfc, 0x70, 0x00, 0x40, 0x00, 0xfc, 0x01, 0x00, 0xfc, 0x50, 0x00,
0x40, 0x00, 0xfe, 0x00, 0x00, 0xfc, 0x70, 0x00, 0x40, 0x00, 0xfe, 0x00,
0x00, 0xfc, 0x50, 0x00, 0x40, 0x00, 0x7f, 0x00, 0x00, 0xfc, 0x70, 0x00,
0x40, 0x80, 0x7f, 0x00, 0x00, 0xfc, 0x50, 0x00, 0x40, 0x80, 0x3f, 0x00,
0x00, 0xfc, 0x70, 0x00, 0x40, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x50, 0x00,
0x40, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x70, 0x00, 0x40, 0xe0, 0xff, 0xff,
0xff, 0xff, 0x50, 0x00, 0x40, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x70, 0x00,
0x40, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x50, 0x00, 0x40, 0xf0, 0xff, 0xff,
0xff, 0xff, 0x70, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00,
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x40, 0x00, 0x00, 0x00,
0x00, 0x00, 0x50, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00,
0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x5f, 0x00, 0x80, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0x6a, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};