added wxUSE_PALETTE and fixed compilation with it set to 0

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11749 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-09-30 22:06:39 +00:00
parent f1c1831fc5
commit d275c7eb84
21 changed files with 227 additions and 101 deletions

View File

@@ -309,6 +309,14 @@
# endif
#endif /* !defined(wxUSE_NOTEBOOK) */
#ifndef wxUSE_PALETTE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_PALETTE must be defined."
# else
# define wxUSE_PALETTE 0
# endif
#endif /* !defined(wxUSE_PALETTE) */
#ifndef wxUSE_POPUPWIN
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_POPUPWIN must be defined."

View File

@@ -316,7 +316,9 @@ public:
virtual void SetBrush(const wxBrush& brush) = 0;
virtual void SetBackground(const wxBrush& brush) = 0;
virtual void SetBackgroundMode(int mode) = 0;
#if wxUSE_PALETTE
virtual void SetPalette(const wxPalette& palette) = 0;
#endif // wxUSE_PALETTE
// clipping region
// ---------------
@@ -588,12 +590,17 @@ public:
#endif // !Win16
#if WXWIN_COMPATIBILITY
#if wxUSE_PALETTE
virtual void SetColourMap(const wxPalette& palette) { SetPalette(palette); }
#endif // wxUSE_PALETTE
void GetTextExtent(const wxString& string, float *x, float *y,
float *descent = NULL, float *externalLeading = NULL,
wxFont *theFont = NULL, bool use16bit = FALSE) const ;
void GetSize(float* width, float* height) const { int w, h; GetSize(& w, & h); *width = w; *height = h; }
void GetSizeMM(float *width, float *height) const { long w, h; GetSizeMM(& w, & h); *width = (float) w; *height = (float) h; }
#endif // WXWIN_COMPATIBILITY
protected:
@@ -731,7 +738,10 @@ protected:
wxColour m_textForegroundColour;
wxColour m_textBackgroundColour;
wxFont m_font;
#if wxUSE_PALETTE
wxPalette m_palette;
#endif // wxUSE_PALETTE
private:
DECLARE_NO_COPY_CLASS(wxDCBase)

View File

@@ -185,10 +185,12 @@ public:
void SetMask( bool mask = TRUE );
bool HasMask() const;
#if wxUSE_PALETTE
// Palette functions
bool HasPalette() const;
const wxPalette& GetPalette() const;
void SetPalette(const wxPalette& palette);
#endif // wxUSE_PALETTE
// Option functions (arbitrary name/value mapping)
void SetOption(const wxString& name, const wxString& value);

View File

@@ -29,6 +29,7 @@ class WXDLLEXPORT wxMask;
class WXDLLEXPORT wxCursor;
class WXDLLEXPORT wxControl;
class WXDLLEXPORT wxImage;
class WXDLLEXPORT wxPalette;
// ----------------------------------------------------------------------------
// Bitmap data
@@ -47,7 +48,9 @@ public:
public:
int m_numColors;
#if wxUSE_PALETTE
wxPalette m_bitmapPalette;
#endif // wxUSE_PALETTE
int m_quality;
// MSW-specific
@@ -147,8 +150,10 @@ public:
int GetQuality() const { return (GetBitmapData() ? GetBitmapData()->m_quality : 0); }
void SetQuality(int q);
#if wxUSE_PALETTE
wxPalette* GetPalette() const { return (GetBitmapData() ? (& GetBitmapData()->m_bitmapPalette) : (wxPalette*) NULL); }
void SetPalette(const wxPalette& palette);
#endif // wxUSE_PALETTE
wxMask *GetMask() const { return (GetBitmapData() ? GetBitmapData()->m_bitmapMask : (wxMask*) NULL); }
void SetMask(wxMask *mask) ;
@@ -160,10 +165,12 @@ public:
void SetOk(bool isOk);
#endif // WXWIN_COMPATIBILITY_2
#if wxUSE_PALETTE
#if WXWIN_COMPATIBILITY
wxPalette *GetColourMap() const { return GetPalette(); }
void SetColourMap(wxPalette *cmap) { SetPalette(*cmap); };
#endif // WXWIN_COMPATIBILITY
#endif // wxUSE_PALETTE
// Implementation
public:

View File

@@ -115,7 +115,9 @@ public:
virtual void SetBrush(const wxBrush& brush);
virtual void SetBackground(const wxBrush& brush);
virtual void SetBackgroundMode(int mode);
#if wxUSE_PALETTE
virtual void SetPalette(const wxPalette& palette);
#endif // wxUSE_PALETTE
virtual void DestroyClippingRegion();
@@ -255,7 +257,10 @@ protected:
WXHPEN m_oldPen;
WXHBRUSH m_oldBrush;
WXHFONT m_oldFont;
#if wxUSE_PALETTE
WXHPALETTE m_oldPalette;
#endif // wxUSE_PALETTE
#if wxUSE_DC_CACHEING
static wxList sm_bitmapCache;

View File

@@ -890,6 +890,9 @@
// Set to 1 for XPM format support
#define wxUSE_XPM 1
// Set to 1 to compile in wxPalette class
#define wxUSE_PALETTE 1
// ----------------------------------------------------------------------------
// Windows-only settings
// ----------------------------------------------------------------------------

View File

@@ -1,21 +1,25 @@
#ifndef _WX_PALETTE_H_BASE_
#define _WX_PALETTE_H_BASE_
#if wxUSE_PALETTE
#if defined(__WXMSW__)
#include "wx/msw/palette.h"
#include "wx/msw/palette.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/palette.h"
#include "wx/motif/palette.h"
#elif defined(__WXGTK__)
#include "wx/generic/paletteg.h"
#include "wx/generic/paletteg.h"
#elif defined(__WXMGL__)
#include "wx/mgl/palette.h"
#include "wx/mgl/palette.h"
#elif defined(__WXMAC__)
#include "wx/mac/palette.h"
#include "wx/mac/palette.h"
#elif defined(__WXPM__)
#include "wx/os2/palette.h"
#include "wx/os2/palette.h"
#elif defined(__WXSTUBS__)
#include "wx/stubs/palette.h"
#include "wx/stubs/palette.h"
#endif
#endif // wxUSE_PALETTE
#endif
// _WX_PALETTE_H_BASE_

View File

@@ -329,4 +329,6 @@
#endif
#define wxUSE_PALETTE 0
#endif // _WX_UNIV_SETUP_H_