Some more Motif work; included utils.h in fileconf.cpp (for wxGetHomeDir or something)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@768 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-09-22 21:15:56 +00:00
parent dcf40a56e7
commit 16c1f7f345
37 changed files with 2086 additions and 302 deletions

View File

@@ -54,13 +54,10 @@ public:
bool Create(const wxBitmap& bitmap, int paletteIndex);
bool Create(const wxBitmap& bitmap);
/* TODO: platform-specific data access
// Implementation
inline WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; }
inline void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; }
inline WXPixmap GetPixmap() const { return m_pixmap; }
protected:
WXHBITMAP m_maskBitmap;
*/
WXPixmap m_pixmap;
};
class WXDLLEXPORT wxBitmapRefData: public wxGDIRefData
@@ -81,8 +78,12 @@ public:
wxPalette m_bitmapPalette;
int m_quality;
/* WXHBITMAP m_hBitmap; TODO: platform-specific handle */
wxMask * m_bitmapMask; // Optional mask
// Motif implementation
public:
WXPixmap m_pixmap;
WXDisplay* m_display;
};
#define M_BITMAPDATA ((wxBitmapRefData *)m_refData)
@@ -182,16 +183,15 @@ public:
static void InitStandardHandlers();
static void CleanUpHandlers();
// Motif implementation
public:
inline WXDisplay* GetDisplay() const { return M_BITMAPDATA->m_display; }
inline WXDisplay* GetPixmap() const { return M_BITMAPDATA->m_pixmap; }
protected:
static wxList sm_handlers;
/*
// TODO: Implementation
public:
void SetHBITMAP(WXHBITMAP bmp);
inline WXHBITMAP GetHBITMAP() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_hBitmap : 0); }
bool FreeResource(bool force = FALSE);
*/
};
#endif

View File

@@ -53,17 +53,17 @@ public:
inline bool operator != (const wxColour& colour) { return (!(m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue)); }
inline int GetPixel() const { return m_pixel; };
inline void SetPixel(int pixel) { m_pixel = pixel; };
inline void SetPixel(int pixel) { m_pixel = pixel; m_isInit = TRUE; };
// Allocate a colour, or nearest colour, using the given display.
// If realloc is TRUE, ignore the existing pixel, otherwise just return
// the existing one.
// Returns FALSE if an exact match was not found, TRUE otherwise.
// Returns the allocated pixel.
// TODO: can this handle mono displays? If not, we should have an extra
// flag to specify whether this should be black or white by default.
bool AllocColour(WXDisplay* display, bool realloc);
int AllocColour(WXDisplay* display, bool realloc = FALSE);
private:
bool m_isInit;

View File

@@ -238,7 +238,7 @@ class WXDLLEXPORT wxDC: public wxObject
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
virtual void SetOptimization( bool WXUNUSED(optimize) ) {};
virtual void SetOptimization( bool optimize ) { m_optimize = optimize; };
virtual bool GetOptimization(void) { return m_optimize; };
virtual long DeviceToLogicalX(long x) const;
@@ -293,6 +293,15 @@ class WXDLLEXPORT wxDC: public wxObject
else
return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
}
// Without device translation, for backing pixmap purposes
long XLOG2DEV_2(long x) const
{
long new_x = x - m_logicalOriginX;
if (new_x > 0)
return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX;
else
return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX;
}
long XLOG2DEVREL(long x) const
{
if (x > 0)
@@ -308,6 +317,15 @@ class WXDLLEXPORT wxDC: public wxObject
else
return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
}
// Without device translation, for backing pixmap purposes
long YLOG2DEV_2(long y) const
{
long new_y = y - m_logicalOriginY;
if (new_y > 0)
return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY;
else
return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY;
}
long YLOG2DEVREL(long y) const
{
if (y > 0)
@@ -326,6 +344,8 @@ class WXDLLEXPORT wxDC: public wxObject
// not sure, what these mean
bool m_clipping; // Is clipping on right now ?
bool m_optimize; // wxMSW only ?
bool m_isInteractive; // For wxPostScriptDC
wxString m_filename; // Ditto
wxPen m_pen;
wxBrush m_brush;

View File

@@ -28,9 +28,6 @@ class WXDLLEXPORT wxWindow;
// Under Windows, wxClientDC, wxPaintDC and wxWindowDC are implemented differently.
// On many platforms, however, they will be the same.
typedef wxWindowDC wxClientDC;
typedef wxWindowDC wxPaintDC;
//-----------------------------------------------------------------------------
// wxWindowDC
//-----------------------------------------------------------------------------
@@ -96,17 +93,22 @@ class WXDLLEXPORT wxWindowDC: public wxDC
virtual void DrawOpenSpline( wxList *points );
// Motif-specific
void SetDCClipping (); // Helper function for setting clipping
protected:
WXGC m_gc;
WXGC m_gcBacking;
WXDisplay* m_display;
wxWindow* m_window;
WXRegion m_clippingRegion;
WXRegion m_currentRegion; // Current clipping region (incl. paint clip region)
WXRegion m_userRegion; // User-defined clipping region
WXPixmap m_pixmap; // Pixmap for drawing on
// Not sure if we'll need all of these
int m_backgroundPixel;
wxColour m_currentColour;
int m_currentBkMode;
// int m_currentBkMode;
int m_currentPenWidth ;
int m_currentPenJoin ;
int m_currentPenCap ;
@@ -115,6 +117,23 @@ protected:
wxBitmap m_currentStipple ;
int m_currentStyle ;
int m_currentFill ;
int m_autoSetting ; // See comment in dcclient.cpp
};
class WXDLLEXPORT wxPaintDC: public wxWindowDC
{
DECLARE_DYNAMIC_CLASS(wxPaintDC)
public:
wxPaintDC() {}
wxPaintDC(wxWindow* win): wxWindowDC(win) {}
};
class WXDLLEXPORT wxClientDC: public wxWindowDC
{
DECLARE_DYNAMIC_CLASS(wxClientDC)
public:
wxClientDC() {}
wxClientDC(wxWindow* win): wxWindowDC(win) {}
};
#endif

View File

@@ -18,7 +18,7 @@
#include "wx/dcclient.h"
class WXDLLEXPORT wxMemoryDC: public wxPaintDC
class WXDLLEXPORT wxMemoryDC: public wxWindowDC
{
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
@@ -29,9 +29,11 @@ class WXDLLEXPORT wxMemoryDC: public wxPaintDC
virtual void SelectObject( const wxBitmap& bitmap );
void GetSize( int *width, int *height ) const;
inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
private:
friend wxPaintDC;
wxBitmap m_selected;
wxBitmap m_bitmap;
};
#endif

View File

@@ -25,11 +25,6 @@ class WXDLLEXPORT wxIconRefData: public wxBitmapRefData
public:
wxIconRefData();
~wxIconRefData();
public:
/* TODO: whatever your actual icon handle is
WXHICON m_hIcon;
*/
};
#define M_ICONDATA ((wxIconRefData *)m_refData)
@@ -59,11 +54,6 @@ public:
inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
/* TODO: implementation
void SetHICON(WXHICON ico);
inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
*/
/* TODO */
virtual bool Ok() const { return (m_refData != NULL) ; }
};

View File

@@ -26,10 +26,9 @@ class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
public:
wxPaletteRefData();
~wxPaletteRefData();
/* TODO: implementation
protected:
WXHPALETTE m_hPalette;
*/
WXColormap m_colormap;
};
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
@@ -55,10 +54,7 @@ public:
inline bool operator == (const wxPalette& palette) { return m_refData == palette.m_refData; }
inline bool operator != (const wxPalette& palette) { return m_refData != palette.m_refData; }
/* TODO: implementation
inline WXHPALETTE GetHPALETTE() const { return (M_PALETTEDATA ? M_PALETTEDATA->m_hPalette : 0); }
void SetHPALETTE(WXHPALETTE pal);
*/
WXColormap GetXColormap() const { return (M_PALETTEDATA->m_colormap); }
};
#endif

View File

@@ -84,6 +84,8 @@ public:
inline int GetDashes(wxDash **ptr) const {
*ptr = (M_PENDATA ? M_PENDATA->m_dash : (wxDash*) NULL); return (M_PENDATA ? M_PENDATA->m_nbDash : 0);
}
inline int GetDashCount() const { return (M_PENDATA->m_nbDash); }
inline wxDash* GetDash() const { return (M_PENDATA->m_dash); }
inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); };

View File

@@ -85,8 +85,8 @@ class WXDLLEXPORT wxWindow: public wxEvtHandler
{
DECLARE_ABSTRACT_CLASS(wxWindow)
friend class wxDC;
friend class wxPaintDC;
friend class WXDLLEXPORT wxDC;
friend class WXDLLEXPORT wxWindowDC;
public:
wxWindow();
@@ -479,7 +479,11 @@ public:
// Get the underlying X window and display
virtual WXWindow GetXWindow() const;
virtual WXDisplay *GetXDisplay() const;
virtual WXPixmap GetBackingPixmap() const { return m_backingPixmap; }
inline int GetPixmapWidth() const { return m_pixmapWidth; }
inline int GetPixmapHeight() const { return m_pixmapHeight; }
virtual WXRegion GetPaintRegion() const { return m_paintRegion; }
// Change properties
virtual void ChangeColour(WXWidget widget);
@@ -548,6 +552,7 @@ public:
int m_lastButton; // last pressed button
wxList m_updateRects; // List of wxRectangles representing damaged region
bool m_isShown;
WXRegion m_paintRegion; // Clip region generated by expose event
protected:
WXWidget m_mainWidget;
WXWidget m_hScrollBar;