More wxMotif work, OGL enhancements, USE_ macro corrections, object.cpp delete

operator correction for VC++ 6


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@780 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-09-28 15:42:54 +00:00
parent 23e09f1115
commit f97c985452
44 changed files with 3439 additions and 614 deletions

View File

@@ -55,6 +55,7 @@ public:
bool Create(const wxBitmap& bitmap);
inline WXPixmap GetPixmap() const { return m_pixmap; }
inline void SetPixmap(WXPixmap pixmap) { m_pixmap = pixmap; }
protected:
WXPixmap m_pixmap;
@@ -70,20 +71,30 @@ public:
~wxBitmapRefData();
public:
int m_width;
int m_height;
int m_depth;
bool m_ok;
int m_numColors;
wxPalette m_bitmapPalette;
int m_quality;
int m_width;
int m_height;
int m_depth;
bool m_ok;
int m_numColors;
wxPalette m_bitmapPalette;
int m_quality;
wxMask * m_bitmapMask; // Optional mask
wxMask * m_bitmapMask; // Optional mask
// Motif implementation
public:
WXPixmap m_pixmap;
WXDisplay* m_display;
WXPixmap m_pixmap;
WXDisplay* m_display;
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)
@@ -127,17 +138,14 @@ public:
{ Ref(bitmap); if ( wxTheBitmapList ) wxTheBitmapList->AddBitmap(this); }
inline wxBitmap(const wxBitmap* bitmap) { if (bitmap) Ref(*bitmap); if ( wxTheBitmapList ) wxTheBitmapList->AddBitmap(this); }
// Initialize with raw data.
// Initialize with raw XBM data
wxBitmap(const char bits[], int width, int height, int depth = 1);
/* TODO: maybe implement XPM reading
// Initialize with XPM data
wxBitmap(const char **data);
*/
wxBitmap(const char **data, wxControl* control = NULL);
// Load a file or resource
// TODO: make default type whatever's appropriate for the platform.
wxBitmap(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE);
wxBitmap(const wxString& name, long type = wxBITMAP_TYPE_XBM);
// Constructor for generalised creation from data
wxBitmap(void *data, long type, int width, int height, int depth = 1);
@@ -148,7 +156,7 @@ public:
virtual bool Create(int width, int height, int depth = -1);
virtual bool Create(void *data, long type, int width, int height, int depth = 1);
virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE);
virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_XBM);
virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL);
inline bool Ok() const { return (M_BITMAPDATA && M_BITMAPDATA->m_ok); }
@@ -188,11 +196,12 @@ public:
public:
inline WXDisplay* GetDisplay() const { return M_BITMAPDATA->m_display; }
inline WXDisplay* GetPixmap() const { return M_BITMAPDATA->m_pixmap; }
virtual WXPixmap GetLabelPixmap(WXWidget w) ;
virtual WXPixmap GetArmPixmap(WXWidget w) ;
virtual WXPixmap GetInsensPixmap(WXWidget w) ;
protected:
static wxList sm_handlers;
};
#endif
// _WX_BITMAP_H_

View File

@@ -26,7 +26,8 @@ class WXDLLEXPORT wxChoice: public wxControl
DECLARE_DYNAMIC_CLASS(wxChoice)
public:
inline wxChoice() { m_noStrings = 0; }
wxChoice();
~wxChoice();
inline wxChoice(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
@@ -61,11 +62,23 @@ class WXDLLEXPORT wxChoice: public wxControl
virtual inline int Number() const { return m_noStrings; }
virtual void Command(wxCommandEvent& event);
virtual inline void SetColumns(int WXUNUSED(n) = 1 ) { /* No effect */ } ;
virtual inline int GetColumns() const { return 1 ; };
virtual void SetColumns(int n = 1 );
virtual int GetColumns() const ;
void SetFocus();
WXWidget GetTopWidget() const { return m_formWidget; }
WXWidget GetMainWidget() const { return m_buttonWidget; }
protected:
int m_noStrings;
int m_noStrings;
WXWidget m_menuWidget;
WXWidget m_buttonWidget;
WXWidget* m_widgetList ;
WXWidget m_formWidget;
wxStringList m_stringList;
public:
bool m_inSetValue;
};
#endif

View File

@@ -18,6 +18,18 @@
#include "wx/bitmap.h"
/* Cursor for one display, so we can choose the correct one for
* the current display.
*/
class wxXCursor : public wxObject
{
DECLARE_DYNAMIC_CLASS(wxXCursor)
public:
WXDisplay* m_display;
WXCursor m_cursor;
};
class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData
{
friend class WXDLLEXPORT wxBitmap;
@@ -26,10 +38,8 @@ public:
wxCursorRefData();
~wxCursorRefData();
protected:
/* TODO: implementation
WXHCURSOR m_hCursor;
*/
wxList m_cursors; // wxXCursor objects, one per display
wxStockCursor m_cursorId; // wxWindows standard cursor id
};
#define M_CURSORDATA ((wxCursorRefData *)m_refData)
@@ -50,24 +60,23 @@ public:
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL);
/* TODO: make default type suit platform */
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_CUR_RESOURCE,
wxCursor(const wxString& name, long flags = wxBITMAP_TYPE_XBM,
int hotSpotX = 0, int hotSpotY = 0);
wxCursor(int cursor_type);
wxCursor(wxStockCursor id);
~wxCursor();
// TODO: also verify the internal cursor handle
virtual bool Ok() const { return (m_refData != NULL) ; }
virtual bool Ok() const { return ((m_refData != NULL) && M_CURSORDATA->m_ok); }
inline wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
inline bool operator == (const wxCursor& cursor) { return m_refData == cursor.m_refData; }
inline bool operator != (const wxCursor& cursor) { return m_refData != cursor.m_refData; }
/* TODO: implementation
void SetHCURSOR(WXHCURSOR cursor);
inline WXHCURSOR GetHCURSOR() const { return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); }
*/
// Motif-specific.
// Create/get a cursor for the current display
WXCursor GetXCursor(WXDisplay* display) ;
// Make a cursor from standard id
WXCursor MakeCursor(WXDisplay* display, wxStockCursor id);
};
extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor);

View File

@@ -21,6 +21,20 @@
class WXDLLEXPORT wxFont;
// For every wxFont, there must be a font for each display and scale requested.
// So these objects are stored in wxFontRefData::m_fonts
class WXDLLEXPORT wxXFont: public wxObject
{
public:
wxXFont();
~wxXFont();
WXFontStructPtr m_fontStruct; // XFontStruct
WXFontList m_fontList; // Motif XmFontList
WXDisplay* m_display; // XDisplay
int m_scale; // Scale * 100
};
class WXDLLEXPORT wxFontRefData: public wxGDIRefData
{
friend class WXDLLEXPORT wxFont;
@@ -36,8 +50,8 @@ protected:
bool m_underlined;
wxString m_faceName;
// A list of XFontStructs indexed by scale (*100)
wxList m_fontsByScale;
// A list of wxXFonts
wxList m_fonts;
};
#define M_FONTDATA ((wxFontRefData *)m_refData)
@@ -87,16 +101,30 @@ public:
// based on this wxFont and the given scale. Append the
// font to list in the private data for future reference.
// TODO This is a very basic implementation, that doesn't
// TODO This is a fairly basic implementation, that doesn't
// allow for different facenames, and also doesn't do a mapping
// between 'standard' facenames (e.g. Arial, Helvetica, Times Roman etc.)
// and the fonts that are available on a particular system.
// Maybe we need to scan the user's machine to build up a profile
// of the fonts and a mapping file.
WXFontStructPtr FindOrCreateFontStruct(double scale = 1.0);
// Return font struct, and optionally the Motif font list
wxXFont* GetInternalFont(double scale = 1.0, WXDisplay* display = NULL) const;
// These two are helper functions for convenient access of the above.
inline WXFontStructPtr GetFontStruct(double scale = 1.0, WXDisplay* display = NULL) const
{
wxXFont* f = GetInternalFont(scale, display);
return (f ? f->m_fontStruct : (WXFontStructPtr) 0);
}
WXFontList GetFontList(double scale = 1.0, WXDisplay* display = NULL) const
{
wxXFont* f = GetInternalFont(scale, display);
return (f ? f->m_fontList : (WXFontList) 0);
}
WXFontStructPtr LoadQueryFont(int pointSize, int family, int style,
int weight, bool underlined);
int weight, bool underlined) const;
protected:
bool RealizeResource();
void Unshare();

View File

@@ -18,6 +18,8 @@
#include "wx/bitmap.h"
/*
// Same as for wxBitmap
class WXDLLEXPORT wxIconRefData: public wxBitmapRefData
{
friend class WXDLLEXPORT wxBitmap;
@@ -26,9 +28,10 @@ public:
wxIconRefData();
~wxIconRefData();
};
*/
#define M_ICONDATA ((wxIconRefData *)m_refData)
#define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData())
#define M_ICONDATA ((wxBitmapRefData *)m_refData)
#define M_ICONHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData())
// Icon
class WXDLLEXPORT wxIcon: public wxBitmap
@@ -42,7 +45,12 @@ public:
inline wxIcon(const wxIcon& icon) { Ref(icon); }
inline wxIcon(const wxIcon* icon) { if (icon) Ref(*icon); }
// Initialize with XBM data
wxIcon(const char bits[], int width, int height);
// Initialize with XPM data
wxIcon(const char **data);
wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
int desiredWidth = -1, int desiredHeight = -1);
~wxIcon();
@@ -54,44 +62,8 @@ 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 */
virtual bool Ok() const { return (m_refData != NULL) ; }
virtual bool Ok() const { return ((m_refData != NULL) && (M_ICONDATA->m_ok)); }
};
/* Example handlers. TODO: write your own handlers for relevant types.
class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
public:
inline wxICOFileHandler()
{
m_name = "ICO icon file";
m_extension = "ico";
m_type = wxBITMAP_TYPE_ICO;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth = -1, int desiredHeight = -1);
};
class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
{
DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
public:
inline wxICOResourceHandler()
{
m_name = "ICO resource";
m_extension = "ico";
m_type = wxBITMAP_TYPE_ICO_RESOURCE;
};
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth = -1, int desiredHeight = -1);
};
*/
#endif
// _WX_ICON_H_

View File

@@ -38,7 +38,8 @@ class WXDLLEXPORT wxListBox: public wxControl
int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr)
const wxString& name = wxListBoxNameStr):
m_clientDataList(wxKEY_INTEGER)
{
Create(parent, id, pos, size, n, choices, style, validator, name);
}
@@ -88,9 +89,15 @@ class WXDLLEXPORT wxListBox: public wxControl
void Command(wxCommandEvent& event);
protected:
protected:
int m_noItems;
int m_selected;
// List mapping positions->client data
wxList m_clientDataList;
public:
bool m_inSetValue;
};
#endif

View File

@@ -17,9 +17,25 @@
#endif
#include "wx/gdiobj.h"
#include "wx/list.h"
class WXDLLEXPORT wxPalette;
// Palette for one display
class wxXPalette : public wxObject
{
DECLARE_DYNAMIC_CLASS(wxXPalette)
public:
wxXPalette();
WXDisplay* m_display;
int m_pix_array_n;
unsigned long* m_pix_array;
WXColormap m_cmap;
bool m_destroyable;
};
class WXDLLEXPORT wxPaletteRefData: public wxGDIRefData
{
friend class WXDLLEXPORT wxPalette;
@@ -28,7 +44,7 @@ public:
~wxPaletteRefData();
protected:
WXColormap m_colormap;
wxList m_palettes;
};
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
@@ -54,7 +70,12 @@ 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; }
WXColormap GetXColormap() const { return (M_PALETTEDATA->m_colormap); }
// Motif-specific
WXColormap GetXColormap(WXDisplay* display = NULL) const;
bool TransferBitmap(void *data, int depth, int size);
bool TransferBitmap8(unsigned char *data, unsigned long size, void *dest, unsigned int bpp);
unsigned long *GetXPixArray(WXDisplay* display, int *pix_array_n);
void PutXColormap(WXDisplay* display, WXColormap cmap, bool destroyable);
};
#endif