/**
-* Name: defs.h
+* Name: wx/defs.h
* Purpose: Declarations/definitions common to all wx source files
* Author: Julian Smart and others
* Modified by: Ryan Norton (Converted to C)
#endif /* __WIN32__ */
+#if defined(__OS2__)
+typedef unsigned long DWORD;
+typedef unsigned short WORD;
+#endif
+
#if defined(__WXPM__) || defined(__EMX__)
#ifdef __WXPM__
/* Stand-ins for OS/2 types, to avoid #including all of os2.h */
typedef unsigned long HINSTANCE;
typedef unsigned long HIMAGELIST;
typedef unsigned long HGLOBAL;
-typedef unsigned long DWORD;
-typedef unsigned short WORD;
#endif /* WXPM || EMX */
#if defined (__WXPM__)
#include "wx/string.h"
#include "wx/dynarray.h"
-#if defined(__WXPM__) || defined(__EMX__)
+#if defined(__OS2__) || defined(__EMX__)
#include "wx/os2/private.h"
#endif
// conditional compilation
// ----------------------------------------------------------------------------
-// Note: WXPM/EMX has to be tested first, since we want to use
+// Note: __OS2__/EMX has to be tested first, since we want to use
// native version, even if configure detected presence of DLOPEN.
-#if defined(__WXPM__) || defined(__EMX__) || defined(__WINDOWS__)
+#if defined(__OS2__) || defined(__EMX__) || defined(__WINDOWS__)
typedef HMODULE wxDllType;
#elif defined(HAVE_DLOPEN)
#include <dlfcn.h>
return RawGetSymbol
(
handle,
- name +
+ name +
#if wxUSE_UNICODE
L'W'
#else
/////////////////////////////////////////////////////////////////////////////
-// Name: filefn.h
+// Name: wx/filefn.h
// Purpose: File- and directory-related functions
// Author: Julian Smart
// Modified by:
WXGC GetGC() const { return m_gc; }
WXGC GetBackingGC() const { return m_gcBacking; }
WXDisplay* GetDisplay() const { return m_display; }
- bool GetAutoSetting() const { return m_autoSetting; }
+ bool GetAutoSetting() const { return (m_autoSetting != 0); } // See comment in dcclient.cpp
void SetAutoSetting(bool flag) { m_autoSetting = flag; }
protected:
WXWidget GetTopWidget() const;
#if wxUSE_CHECKLISTBOX
- virtual void DoToggleItem(int item, int x) {};
+ virtual void DoToggleItem(int WXUNUSED(item), int WXUNUSED(x)) {};
#endif
protected:
virtual wxSize DoGetBestSize() const;
/////////////////////////////////////////////////////////////////////////////
-// Name: private.h
+// Name: wx/os2/private.h
// Purpose: Private declarations: as this header is only included by
// wxWidgets itself, it may contain identifiers which don't start
// with "wx".
#define INCL_DOS
#include <os2.h>
+#if defined(__WATCOMC__) && defined(__WXMOTIF__)
+ #include <os2def.h>
+ #define I_NEED_OS2_H
+ #include <X11/Xmd.h>
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ #include <Xm/VendorSP.h>
+ #ifdef __cplusplus
+ }
+ #endif
+#endif
+
#if defined (__EMX__) && !defined(USE_OS2_TOOLKIT_HEADERS) && !defined(HAVE_SPBCDATA)
typedef struct _SPBCDATA {
#endif
+#include "wx/dlimpexp.h"
#include "wx/fontenc.h"
class WXDLLEXPORT wxFont;
// global data
// ---------------------------------------------------------------------------
+#ifdef __WXOS2__
// The MakeProcInstance version of the function wxSubclassedGenericControlProc
WXDLLEXPORT_DATA(extern int) wxGenericControlSubClassProc;
WXDLLEXPORT_DATA(extern wxChar*) wxBuffer;
WXDLLEXPORT_DATA(extern HINSTANCE) wxhInstance;
+#endif
// ---------------------------------------------------------------------------
// global functions
// ---------------------------------------------------------------------------
+#ifdef __WXOS2__
extern "C"
{
WXDLLEXPORT HINSTANCE wxGetInstance();
}
WXDLLEXPORT void wxSetInstance(HINSTANCE hInst);
+#endif
#include "wx/thread.h"
static inline MRESULT MySendMsg(HWND hwnd, ULONG ulMsgid,
__DARWIN__ for Darwin related corrections (wxMac, wxMotif)
*/
#elif defined(__OS2__)
+
+ /* wxOS2 vs. non wxOS2 ports on OS2 platform */
+# ifndef __WXMOTIF__
+# ifndef __WXOS2__
+# define __WXOS2__
+# endif
+# ifndef __WXPM__
+# define __WXPM__
+# endif
+# endif
+
# if defined(__IBMCPP__)
# define __VISAGEAVER__ __IBMCPP__
-# endif
-# ifndef __WXOS2__
-# define __WXOS2__
-# endif
-# ifndef __WXPM__
-# define __WXPM__
# endif
/* Place other OS/2 compiler environment defines here */
#if wxUSE_THREADS
-#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXPM__) || defined(__EMX__)
+#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__OS2__) || defined(__EMX__)
// unlock GUI if there are threads waiting for and lock it back when
// there are no more of them - should be called periodically by the main
// thread
// returns true if the main thread has GUI lock
extern bool WXDLLIMPEXP_BASE wxGuiOwnedByMainThread();
-#ifndef __WXPM__
// wakes up the main thread if it's sleeping inside ::GetMessage()
extern void WXDLLIMPEXP_BASE wxWakeUpMainThread();
-#endif // !OS/2
// return true if the main thread is waiting for some other to terminate:
// wxApp then should block all "dangerous" messages
#endif // wxUSE_THREADS
#endif // _WX_THREAD_H_
-
// wxConditionInternal
// --------------------------------------------------------------------------
-#if defined(__WXMSW__) || defined(__WXPM__) || defined(__EMX__)
+#if defined(__WXMSW__) || defined(__OS2__) || defined(__EMX__)
// Win32 and OS/2 don't have explicit support for the POSIX condition
// variables and their events/event semaphores have quite different semantics,
// so we reimplement the conditions from scratch using the mutexes and
// semaphores
-#if defined(__WXPM__) || defined(__EMX__)
+#if defined(__OS2__) || defined(__EMX__)
void InterlockedIncrement(LONG *num)
{
::DosEnterCritSec();
/////////////////////////////////////////////////////////////////////////////
-// Name: utils.h
+// Name: wx/utils.h
// Purpose: Miscellaneous utilities
// Author: Julian Smart
// Modified by:
// wxLongLong
#include "wx/longlong.h"
-#ifdef __X__
+#ifdef __WATCOMC__
+ #include <direct.h>
+#elif defined(__X__)
#include <dirent.h>
#include <unistd.h>
#endif
/////////////////////////////////////////////////////////////////////////////
-// Name: dynlib.cpp
+// Name: src/common/dynlib.cpp
// Purpose: Dynamic library management
// Author: Guilhem Lavaux
// Modified by:
/* static */
void wxDynamicLibrary::Unload(wxDllType handle)
{
-#if defined(__WXPM__) || defined(__EMX__)
+#if defined(__OS2__) || defined(__EMX__)
DosFreeModule( handle );
#elif defined(__WXMAC__) && !defined(__DARWIN__)
CloseConnection( (CFragConnectionID*) &handle );
///////////////////////////////////////////////////////////////////////////////
-// Name: fileconf.cpp
+// Name: src/common/fileconf.cpp
// Purpose: implementation of wxFileConfig derivation of wxConfig
// Author: Vadim Zeitlin
// Modified by:
strDir = wxMacFindFolder( (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder ) ;
#elif defined( __UNIX__ )
strDir = wxT("/etc/");
-#elif defined(__WXPM__)
+#elif defined(__OS2__)
ULONG aulSysInfo[QSV_MAX] = {0};
UINT drive;
APIRET rc;
}
#endif // wxUSE_CONFIG
-
wxString locale;
// Set the locale:
-#if defined(__UNIX__) && !defined(__WXMAC__)
+#if defined(__OS2__)
+ wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString);
+#elif defined(__UNIX__) && !defined(__WXMAC__)
if (language == wxLANGUAGE_DEFAULT)
locale = wxEmptyString;
else
wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str());
return false;
}
-#elif defined(__WXPM__)
- wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString);
#else
return false;
#define WX_NO_LOCALE_SUPPORT
// --- --- --- generated code ends here --- --- ---
#endif // wxUSE_INTL
-
// Purpose: implementation of wxTextBuffer class
// Created: 14.11.01
// Author: Morten Hanssen, Vadim Zeitlin
+// RCS-ID: $Id$
// Copyright: (c) 1998-2001 wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
wxTextFileType_Unix;
#elif defined(__WXMAC__)
wxTextFileType_Mac;
-#elif defined(__WXPM__)
+#elif defined(__OS2__)
wxTextFileType_Os2;
#else
wxTextFileType_None;
}
#endif // wxUSE_TEXTBUFFER
-
/////////////////////////////////////////////////////////////////////////////
-// Name: accel.cpp
+// Name: src/motif/accel.cpp
// Purpose: wxAcceleratorTable
// Author: Julian Smart
// Modified by:
(eventShiftDown == accShiftDown) &&
((eventKeyCode == accKeyCode || eventKeyCode == accKeyCode2))) ;
}
-
/////////////////////////////////////////////////////////////////////////////
-// Name: app.cpp
+// Name: src/motif/app.cpp
// Purpose: wxApp
// Author: Julian Smart
// Modified by:
return vi;
}
-static void wxTLWidgetDestroyCallback(Widget w, XtPointer clientData,
- XtPointer ptr)
+static void wxTLWidgetDestroyCallback(Widget w, XtPointer WXUNUSED(clientData),
+ XtPointer WXUNUSED(ptr))
{
if( wxTheApp )
{
return (WXWidget)tlw;
}
-WXWidget wxCreateTopLevelRealizedWidget( WXDisplay* display )
+WXWidget wxCreateTopLevelRealizedWidget( WXDisplay* WXUNUSED(display) )
{
Widget rTlw = XtVaCreateWidget( "dummy_widget", topLevelShellWidgetClass,
(Widget)wxTheApp->GetTopLevelWidget(),
{
if (n<1) n = 1 ;
- short numColumns = n ;
+ short numColumns = (short)n ;
Arg args[3];
XtSetArg(args[0], XmNnumColumns, numColumns);
/////////////////////////////////////////////////////////////////////////////
-// Name: clipbrd.cpp
+// Name: src/motif/clipbrd.cpp
// Purpose: Clipboard functionality
// Author: Julian Smart
// Modified by: Mattia Barbon (added support for generic wxDataObjects)
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
wxClipboard::~wxClipboard()
{
- Clear();
+ Clear();
}
void wxClipboard::Clear()
bool wxClipboard::Open()
{
wxCHECK_MSG( !m_open, false, "clipboard already open" );
-
+
m_open = true;
return true;
#if wxCHECK_LESSTIF()
void wxClipboardCallback( Widget xwidget, int* data_id,
- int* priv, int* reason )
+ int* priv, int* WXUNUSED(reason) )
#else
void wxClipboardCallback( Widget xwidget, long* data_id,
- long* priv, int* reason )
+ long* priv, int* WXUNUSED(reason) )
#endif
{
Display* xdisplay = XtDisplay( xwidget );
void wxClipboard::Close()
{
wxCHECK_RET( m_open, "clipboard not open" );
-
+
m_open = false;
}
size_t dfcount = data.GetFormatCount( wxDataObject::Set );
wxDataFormatScopedArray dfarr( new wxDataFormat[dfcount] );
data.GetAllFormats( dfarr.get(), wxDataObject::Set );
-
+
if( XmClipboardInquireCount( xdisplay, xwindow, &count, &max_name_length )
== XmClipboardSuccess )
{
/////////////////////////////////////////////////////////////////////////////
-// Name: colour.cpp
+// Name: src/motif/colour.cpp
// Purpose: wxColour class
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
//// TODO: make wxColour a ref-counted object,
XColor xcol;
if ( XParseColor( dpy, (Colormap)colormap, name.mb_str(), &xcol ) )
{
- col.m_red = xcol.red & 0xff;
- col.m_green = xcol.green & 0xff;
- col.m_blue = xcol.blue & 0xff;
+ col.m_red = (unsigned char)(xcol.red & 0xff);
+ col.m_green = (unsigned char)(xcol.green & 0xff);
+ col.m_blue = (unsigned char)(xcol.blue & 0xff);
col.m_isInit = true;
col.m_pixel = -1;
}
XColor color;
color.red = (unsigned short) Red ();
- color.red |= color.red << 8;
+ color.red |= (unsigned short)(color.red << 8);
color.green = (unsigned short) Green ();
- color.green |= color.green << 8;
+ color.green |= (unsigned short)(color.green << 8);
color.blue = (unsigned short) Blue ();
- color.blue |= color.blue << 8;
+ color.blue |= (unsigned short)(color.blue << 8);
color.flags = DoRed | DoGreen | DoBlue;
m_clientDataDict.DestroyData();
}
-void wxComboBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
+void wxComboBox::DoSetSize(int x, int y, int width, int WXUNUSED(height), int sizeFlags)
{
// Necessary so it doesn't call wxChoice::SetSize
wxWindow::DoSetSize(x, y, width, DoGetBestSize().y, sizeFlags);
return wxDoGetStringInList( GetXmList(this), n );
}
-int wxComboBox::FindString(const wxString& s, bool bCase) const
+int wxComboBox::FindString(const wxString& s, bool WXUNUSED(bCase)) const
{
// FIXME: back to base class for not supported value of bCase
/////////////////////////////////////////////////////////////////////////////
-// Name: cursor.cpp
+// Name: src/motif/cursor.cpp
// Purpose: wxCursor class
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/window.h"
#if wxUSE_IMAGE
#include "wx/image.h"
-#endif
+#endif
#ifdef __VMS__
#pragma message disable nosimpint
public:
wxCursorRefData();
~wxCursorRefData();
-
+
wxXCursorList m_cursors; // wxXCursor objects, one per display
wxStockCursor m_cursorId; // wxWidgets standard cursor id
};
unsigned char * bits = new unsigned char [imagebitcount];
unsigned char * maskBits = new unsigned char [imagebitcount];
- int i, j, i8; unsigned char c, cMask;
+ int i, j, i8;
+ unsigned char c, cMask;
for (i=0; i<imagebitcount; i++)
{
bits[i] = 0xff;
for (j=0; j<8; j++)
{
// possible overflow if we do the summation first ?
- c = rgbBits[(i8+j)*3]/3 + rgbBits[(i8+j)*3+1]/3 + rgbBits[(i8+j)*3+2]/3;
- //if average value is > mid grey
+ c = (unsigned char)(rgbBits[(i8+j)*3]/3 + rgbBits[(i8+j)*3+1]/3 + rgbBits[(i8+j)*3+2]/3);
+ // if average value is > mid grey
if (c>127)
bits[i] = bits[i] & cMask;
- cMask = (cMask << 1) | 1;
+ cMask = (unsigned char)((cMask << 1) | 1);
}
}
{
if (rgbBits[(i8+j)*3] != r || rgbBits[(i8+j)*3+1] != g || rgbBits[(i8+j)*3+2] != b)
maskBits[i] = maskBits[i] | cMask;
- cMask = (cMask << 1);
+ cMask = (unsigned char)(cMask << 1);
}
}
}
(Pixmap)mask_pixmap,
&foreground_color,
&background_color,
- hotSpotX ,
+ hotSpotX ,
hotSpotY);
if (cursor)
switch (id)
{
+ case wxCURSOR_CHAR: return (WXCursor)cursor;
+
case wxCURSOR_WAIT: x_cur = XC_watch; break;
- case wxCURSOR_CROSS: x_cur = XC_crosshair; break;
- case wxCURSOR_CHAR: return (WXCursor)cursor; break;
+ case wxCURSOR_CROSS: x_cur = XC_crosshair; break;
case wxCURSOR_HAND: x_cur = XC_hand1; break;
case wxCURSOR_BULLSEYE: x_cur = XC_target; break;
- case wxCURSOR_PENCIL: x_cur = XC_pencil; break;
- case wxCURSOR_MAGNIFIER: x_cur = XC_sizing; break;
- case wxCURSOR_IBEAM: x_cur = XC_xterm; break;
+ case wxCURSOR_PENCIL: x_cur = XC_pencil; break;
+ case wxCURSOR_MAGNIFIER: x_cur = XC_sizing; break;
+ case wxCURSOR_IBEAM: x_cur = XC_xterm; break;
case wxCURSOR_NO_ENTRY: x_cur = XC_pirate; break;
- case wxCURSOR_LEFT_BUTTON: x_cur = XC_leftbutton; break;
- case wxCURSOR_RIGHT_BUTTON: x_cur = XC_rightbutton; break;
+ case wxCURSOR_LEFT_BUTTON: x_cur = XC_leftbutton; break;
+ case wxCURSOR_RIGHT_BUTTON: x_cur = XC_rightbutton; break;
case wxCURSOR_MIDDLE_BUTTON: x_cur = XC_middlebutton; break;
case wxCURSOR_QUESTION_ARROW: x_cur = XC_question_arrow; break;
case wxCURSOR_SIZING: x_cur = XC_sizing; break;
XFlush (display);
- for(wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst (); node;
+ for(wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst (); node;
node = node->GetNext())
{
wxWindow *child = node->GetData ();
/////////////////////////////////////////////////////////////////////////////
-// Name: dcclient.cpp
+// Name: src/motif/dcclient.cpp
// Purpose: wxClientDC class
// Author: Julian Smart
// Modified by:
/////////////////////////////////////////////////////////////////////////////
/*
- About pens, brushes, and the autoSetting flag:
+ About pens, brushes, and the m_autoSetting flag:
Under X, pens and brushes control some of the same X drawing
parameters. Therefore, it is impossible to independently maintain
the current logical function. The m_currentFill, etc. instance
variables remember state across the brush and pen.
- Since pens are used more than brushes, the autoSetting flag is used to
+ Since pens are used more than brushes, the m_autoSetting flag is used to
indicate that a brush was recently used, and SetPen must be called to
- reinstall the current pen's parameters. If autoSetting includes 0x2, then the
+ reinstall the current pen's parameters. If m_autoSetting includes 0x2, then the
pens color may need to be set based on XOR.
There is, unfortunately, some confusion between setting the current pen/brush
{
wxCHECK_MSG( Ok(), 0, "invalid dc" );
wxCHECK_MSG( m_font.Ok(), 0, "invalid font" );
-
+
int width;
wxGetTextExtent (m_display, m_font, m_userScaleY * m_logicalScaleY,
/////////////////////////////////////////////////////////////////////////////
-// Name: dialog.cpp
+// Name: src/motif/dialog.cpp
// Purpose: wxDialog class
// Author: Julian Smart
// Modified by:
else
XtManageChild((Widget)m_mainWidget) ;
- XRaiseWindow( XtDisplay( (Widget)m_mainWidget ),
+ XRaiseWindow( XtDisplay( (Widget)m_mainWidget ),
XtWindow( (Widget)m_mainWidget) );
}
unsigned int m_nPriority; // thread priority in "wx" units
};
-void wxThreadInternal::OS2ThreadStart(
- void * pParam
-)
+void wxThreadInternal::OS2ThreadStart( void * pParam )
{
- DWORD dwRet;
+ DWORD dwRet;
bool bWasCancelled;
wxThread *pThread = (wxThread *)pParam;
#ifdef __WXGTK20__
#include "gtk/gtk.h"
extern GtkWidget *wxGetRootWindow();
-#endif
+#endif // __WXGTK20__
extern "C" int wxCMPFUNC_CONV
wxCompareFamilies (const void *a, const void *b)
OnFacename( wxT("monospace") );
}
else
-#endif
+#endif // __WXGTK20__ || !HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
{
PangoFontFamily **families = NULL;
gint n_families = 0;
- pango_context_list_families (
+ pango_context_list_families (
#ifdef __WXGTK20__
gtk_widget_get_pango_context( wxGetRootWindow() ),
#else
g_free(families);
}
- return TRUE;
+ return true;
}
bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
{
- return FALSE;
+ return false;
}
if ( !This->OnFacename(fam) )
{
// stop enumerating
- return FALSE;
+ return false;
}
families.Add(fam);
//else: already seen
}
- return TRUE;
+ return true;
}
#endif
// wxUSE_NANOX
bool fixedWidthOnly)
{
#if wxUSE_NANOX
- return FALSE;
+ return false;
#else
int nFonts;
char **fonts;
if ( fixedWidthOnly )
{
- bool cont = TRUE;
+ bool cont = true;
fonts = CreateFontList(wxT('m'), encoding, &nFonts);
if ( fonts )
{
if ( !cont )
{
- return TRUE;
+ return true;
}
fonts = CreateFontList(wxT('c'), encoding, &nFonts);
if ( !fonts )
{
- return TRUE;
+ return true;
}
}
else
wxASSERT_MSG(encoding != wxFONTENCODING_SYSTEM,
wxT("No fonts at all on this system?"));
- return FALSE;
+ return false;
}
}
(void)ProcessFamiliesFromFontList(this, fonts, nFonts);
XFreeFontNames(fonts);
- return TRUE;
+ return true;
#endif
// wxUSE_NANOX
}
bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
{
#if wxUSE_NANOX
- return FALSE;
+ return false;
#else
wxString pattern;
pattern.Printf(wxT("-*-%s-*-*-*-*-*-*-*-*-*-*-*-*"),
- family.IsEmpty() ? wxT("*") : family.c_str());
+ family.empty() ? wxT("*") : family.c_str());
// get the list of all fonts
int nFonts;
if ( !fonts )
{
// unknown family?
- return FALSE;
+ return false;
}
// extract the list of (unique) encodings
dash = strchr(familyFont, '-');
*dash = '\0'; // !NULL because Matches() above succeeded
- if ( !family.IsEmpty() && (family != familyFont) )
+ if ( !family.empty() && (family != familyFont) )
{
// family doesn't match
continue;
XFreeFontNames(fonts);
- return TRUE;
+ return true;
#endif
// wxUSE_NANOX
}
-#endif
- // __WXGTK20__
+#endif // !wxUSE_PANGO
/////////////////////////////////////////////////////////////////////////////
-// Name: unix/fontutil.cpp
+// Name: src/unix/fontutil.cpp
// Purpose: Font helper functions for X11 (GDK/X)
// Author: Vadim Zeitlin
// Modified by:
bool wxNativeFontInfo::GetUnderlined() const
{
- return FALSE;
+ return false;
}
wxString wxNativeFontInfo::GetFaceName() const
description = pango_font_description_from_string( wxGTK_CONV( s ) );
- return TRUE;
+ return true;
}
wxString wxNativeFontInfo::ToString() const
bool wxNativeEncodingInfo::FromString(const wxString& s)
{
- return FALSE;
+ return false;
}
wxString wxNativeEncodingInfo::ToString() const
bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
{
- return TRUE;
+ return true;
}
bool wxGetNativeFontEncoding(wxFontEncoding encoding,
wxString encid = tokenizer.GetNextToken();
long enc;
if ( !encid.ToLong(&enc) )
- return FALSE;
+ return false;
encoding = (wxFontEncoding)enc;
xregistry = tokenizer.GetNextToken();
if ( !xregistry )
- return FALSE;
+ return false;
xencoding = tokenizer.GetNextToken();
if ( !xencoding )
- return FALSE;
+ return false;
// ok even if empty
facename = tokenizer.GetNextToken();
- return TRUE;
+ return true;
}
wxString wxNativeEncodingInfo::ToString() const
{
wxString s;
s << (long)encoding << _T(';') << xregistry << _T(';') << xencoding;
- if ( !!facename )
+ if ( !facename.empty() )
{
s << _T(';') << facename;
}
void wxNativeFontInfo::Init()
{
- m_isDefault = TRUE;
+ m_isDefault = true;
}
bool wxNativeFontInfo::FromString(const wxString& s)
// check the version
wxString token = tokenizer.GetNextToken();
if ( token != _T('0') )
- return FALSE;
+ return false;
xFontName = tokenizer.GetNextToken();
// this should be the end
if ( tokenizer.HasMoreTokens() )
- return FALSE;
+ return false;
return FromXFontName(xFontName);
}
wxString wxNativeFontInfo::GetXFontComponent(wxXLFDField field) const
{
- wxCHECK_MSG( field < wxXLFD_MAX, _T(""), _T("invalid XLFD field") );
+ wxCHECK_MSG( field < wxXLFD_MAX, wxEmptyString, _T("invalid XLFD field") );
if ( !HasElements() )
{
// const_cast
if ( !((wxNativeFontInfo *)this)->FromXFontName(xFontName) )
- return _T("");
+ return wxEmptyString;
}
return fontElements[field];
// skip the leading, usually empty field (font name registry)
if ( !tokenizer.HasMoreTokens() )
- return FALSE;
+ return false;
(void)tokenizer.GetNextToken();
if ( !tokenizer.HasMoreTokens() )
{
// not enough elements in the XLFD - or maybe an alias
- return FALSE;
+ return false;
}
wxString field = tokenizer.GetNextToken();
if ( !field.empty() && field != _T('*') )
{
// we're really initialized now
- m_isDefault = FALSE;
+ m_isDefault = false;
}
fontElements[n] = field;
// this should be all
if ( tokenizer.HasMoreTokens() )
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
wxString wxNativeFontInfo::GetXFontName() const
xFontName = xFontName_;
- m_isDefault = FALSE;
+ m_isDefault = false;
}
int wxNativeFontInfo::GetPointSize() const
bool wxNativeFontInfo::GetUnderlined() const
{
// X fonts are never underlined
- return FALSE;
+ return false;
}
wxString wxNativeFontInfo::GetFaceName() const
SetXFontComponent(wxXLFD_FAMILY, facename);
}
-void wxNativeFontInfo::SetFamily(wxFontFamily family)
+void wxNativeFontInfo::SetFamily(wxFontFamily WXUNUSED(family))
{
// wxFontFamily -> X foundry, anyone?
wxFAIL_MSG( _T("not implemented") );
bool wxGetNativeFontEncoding(wxFontEncoding encoding,
wxNativeEncodingInfo *info)
{
- wxCHECK_MSG( info, FALSE, _T("bad pointer in wxGetNativeFontEncoding") );
+ wxCHECK_MSG( info, false, _T("bad pointer in wxGetNativeFontEncoding") );
if ( encoding == wxFONTENCODING_DEFAULT )
{
default:
// don't know how to translate this encoding into X fontspec
- return FALSE;
+ return false;
}
info->encoding = encoding;
- return TRUE;
+ return true;
}
bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
wxNativeFont font = 0;
// if we already have the X font name, try to use it
- if( xFontName && !xFontName->IsEmpty() )
+ if( xFontName && !xFontName->empty() )
{
//
// Make sure point size is correct for scale factor.
if ( !font )
{
font = wxLoadQueryFont(-1, wxDEFAULT, wxNORMAL, wxNORMAL,
- FALSE, wxEmptyString,
+ false, wxEmptyString,
info.xregistry, info.xencoding,
xFontName);
font = wxLoadQueryFont(-1,
wxDEFAULT, wxNORMAL, wxNORMAL,
- FALSE, wxEmptyString,
+ false, wxEmptyString,
_T("*"), _T("*"),
xFontName);
}
// private functions
// ----------------------------------------------------------------------------
-// returns TRUE if there are any fonts matching this font spec
+// returns true if there are any fonts matching this font spec
static bool wxTestFontSpec(const wxString& fontspec)
{
// some X servers will fail to load this font because there are too many
// matches so we must test explicitly for this
if ( fontspec == _T("-*-*-*-*-*-*-*-*-*-*-*-*-*-*") )
{
- return TRUE;
+ return true;
}
wxNativeFont test = (wxNativeFont) g_fontHash->Get( fontspec );
if (test)
{
- return TRUE;
+ return true;
}
test = wxLoadFont(fontspec);
{
wxFreeFont(test);
- return TRUE;
+ return true;
}
else
{
- return FALSE;
+ return false;
}
}
#else
wxString fontSpec;
- if (!facename.IsEmpty())
+ if (!facename.empty())
{
fontSpec.Printf(wxT("-*-%s-*-*-normal-*-*-*-*-*-*-*-*-*"),
facename.c_str());
{
g_fontHash = new wxHashTable( wxKEY_STRING );
- return TRUE;
+ return true;
}
void wxFontModule::OnExit()
}
#endif // GTK 2.0/1.x
-
False, XA_WINDOW, &type, &format, &nwins,
&after, (unsigned char **)&wins);
if ( type != XA_WINDOW || nwins <= 0 || wins[0] == None )
- return FALSE;
+ return false;
XFree(wins);
// Query for supported features:
False, XA_ATOM, &type, &format, &natoms,
&after, (unsigned char **)&atoms);
if ( type != XA_ATOM || atoms == NULL )
- return FALSE;
+ return false;
// Lookup the feature we want:
for (unsigned i = 0; i < natoms; i++)
if ( atoms[i] == feature )
{
XFree(atoms);
- return TRUE;
+ return true;
}
}
XFree(atoms);
- return FALSE;
+ return false;
}
#endif
&type, &format, &nitems, &after,
(unsigned char**)&data) != Success)
{
- return FALSE;
+ return false;
}
bool retval = (type == KWIN_RUNNING &&
}
XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32,
- PropModeReplace, (unsigned char *) &data, lng);
+ PropModeReplace, (unsigned char *) &data[0], lng);
XSync(display, False);
if (wasMapped)
}
#endif // __WXX11__ || __WXGTK__ || __WXMOTIF__
-
-
-
-
-
/////////////////////////////////////////////////////////////////////////////
-// Name: bitmap.cpp
+// Name: src/x11/bitmap.cpp
// Purpose: wxBitmap
// Author: Julian Smart, Robert Roebling
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
#include "wx/bitmap.h"
#include "wx/icon.h"
#include "wx/log.h"
m_display = bitmap.GetDisplay();
wxImage image = bitmap.ConvertToImage();
- if (!image.Ok()) return FALSE;
+ if (!image.Ok()) return false;
m_display = bitmap.GetDisplay();
if (bpp == 15)
{
- red = red & 0xf8;
- green = green & 0xf8;
- blue = blue & 0xf8;
+ red &= 0xf8;
+ green &= 0xf8;
+ blue &= 0xf8;
} else
if (bpp == 16)
{
- red = red & 0xf8;
- green = green & 0xfc;
- blue = blue & 0xf8;
+ red &= 0xf8;
+ green &= 0xfc;
+ blue &= 0xf8;
} else
if (bpp == 12)
{
- red = red & 0xf0;
- green = green & 0xf0;
- blue = blue & 0xf0;
+ red &= 0xf0;
+ green &= 0xf0;
+ blue &= 0xf0;
}
XSetForeground( xdisplay, gc, BlackPixel(xdisplay,xscreen) );
XFreeGC( xdisplay, gc );
- return TRUE;
+ return true;
#else
- return FALSE;
+ return false;
#endif
// wxUSE_NANOX
}
unsigned char r,g,b;
wxPalette *pal = bitmap.GetPalette();
- wxCHECK_MSG( pal, FALSE, wxT("Cannot create mask from bitmap without palette") );
+ wxCHECK_MSG( pal, false, wxT("Cannot create mask from bitmap without palette") );
pal->GetRGB(paletteIndex, &r, &g, &b);
m_bitmap = NULL;
}
- if (!bitmap.Ok()) return FALSE;
+ if (!bitmap.Ok()) return false;
- wxCHECK_MSG( bitmap.GetBitmap(), FALSE, wxT("Cannot create mask from colour bitmap") );
+ wxCHECK_MSG( bitmap.GetBitmap(), false, wxT("Cannot create mask from colour bitmap") );
m_display = bitmap.GetDisplay();
m_bitmap = (WXPixmap) XCreatePixmap( (Display*) m_display, xroot, bitmap.GetWidth(), bitmap.GetHeight(), 1 );
- if (!m_bitmap) return FALSE;
+ if (!m_bitmap) return false;
GC gc = XCreateGC( (Display*) m_display, (Pixmap) m_bitmap, 0, NULL );
XFreeGC( (Display*) m_display, gc );
- return TRUE;
+ return true;
#else
- return FALSE;
+ return false;
#endif
// wxUSE_NANOX
}
{
UnRef();
- wxCHECK_MSG( (width > 0) && (height > 0), FALSE, wxT("invalid bitmap size") )
+ wxCHECK_MSG( (width > 0) && (height > 0), false, wxT("invalid bitmap size") )
m_refData = new wxBitmapRefData();
if (depth == -1) depth = bpp;
wxCHECK_MSG( (depth == bpp) ||
- (depth == 1), FALSE, wxT("invalid bitmap depth") )
+ (depth == 1), false, wxT("invalid bitmap depth") )
M_BMPDATA->m_mask = (wxMask *) NULL;
M_BMPDATA->m_width = width;
wxLogWarning(wxT("no data bitmap handler for type %ld defined."),
(long)type);
- return FALSE;
+ return false;
}
return handler->Create(this, data, type, width, height, depth);
bool wxBitmap::CreateFromXpm( const char **bits )
{
- wxCHECK_MSG( bits, FALSE, wxT("NULL pointer in wxBitmap::CreateFromXpm") );
+ wxCHECK_MSG( bits, false, wxT("NULL pointer in wxBitmap::CreateFromXpm") );
return Create(bits, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
if (!image.Ok())
{
wxASSERT_MSG(image.Ok(), wxT("Invalid wxImage passed to wxBitmap::CreateFromImage."));
- return FALSE;
+ return false;
}
int w = image.GetWidth();
int h = image.GetHeight();
if (!Create(w, h, depth))
- return FALSE;
+ return false;
// Unfortunately the mask has to be screen-depth since
// 1-bpp bitmaps don't seem to be supported
maskGC = GrNewGC();
maskPixmap = GrNewPixmap(w, h, 0);
if (!maskPixmap)
- hasMask = FALSE;
+ hasMask = false;
else
{
wxMask* mask = new wxMask;
if (hasMask)
GrDestroyGC(maskGC);
- return TRUE;
+ return true;
#else
// !wxUSE_NANOX
UnRef();
- wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") )
- wxCHECK_MSG( depth == -1, FALSE, wxT("invalid bitmap depth") )
+ wxCHECK_MSG( image.Ok(), false, wxT("invalid image") )
+ wxCHECK_MSG( depth == -1, false, wxT("invalid bitmap depth") )
m_refData = new wxBitmapRefData();
if (data_image->data == NULL)
{
wxLogError( wxT("Out of memory.") ); // TODO clean
- return FALSE;
+ return false;
}
M_BMPDATA->m_pixmap = (WXPixmap) XCreatePixmap( xdisplay, xroot, width, height, depth );
if (mask_image->data == NULL)
{
wxLogError( wxT("Out of memory.") ); // TODO clean
- return FALSE;
+ return false;
}
wxMask *mask = new wxMask();
}
}
- return TRUE;
+ return true;
#endif
// wxUSE_NANOX
}
int red_shift_left = 0;
int green_shift_left = 0;
int blue_shift_left = 0;
- bool use_shift = FALSE;
+ bool use_shift = false;
if (GetPixmap())
{
}
else if (use_shift)
{
- data[pos] = (pixel >> red_shift_right) << red_shift_left;
- data[pos+1] = (pixel >> green_shift_right) << green_shift_left;
- data[pos+2] = (pixel >> blue_shift_right) << blue_shift_left;
+ data[pos] = (unsigned char)((pixel >> red_shift_right) << red_shift_left);
+ data[pos+1] = (unsigned char)((pixel >> green_shift_right) << green_shift_left);
+ data[pos+2] = (unsigned char)((pixel >> blue_shift_right) << blue_shift_left);
}
else if (colors)
{
- data[pos] = colors[pixel].red >> 8;
- data[pos+1] = colors[pixel].green >> 8;
- data[pos+2] = colors[pixel].blue >> 8;
+ data[pos] = (unsigned char)(colors[pixel].red >> 8);
+ data[pos+1] = (unsigned char)(colors[pixel].green >> 8);
+ data[pos+2] = (unsigned char)(colors[pixel].blue >> 8);
}
else
{
bool wxBitmap::CopyFromIcon(const wxIcon& icon)
{
*this = icon;
- return TRUE;
+ return true;
}
wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
bool wxBitmap::SaveFile( const wxString &name, wxBitmapType type,
const wxPalette *palette ) const
{
- wxCHECK_MSG( Ok(), FALSE, wxT("invalid bitmap") );
+ wxCHECK_MSG( Ok(), false, wxT("invalid bitmap") );
wxBitmapHandler *handler = FindHandler(type);
wxImage image(this->ConvertToImage());
if (image.Ok()) return image.SaveFile( name, type );
- return FALSE;
+ return false;
}
return handler->SaveFile(this, name, type, palette);
{
UnRef();
- if (!wxFileExists(name)) return FALSE;
+ if (!wxFileExists(name)) return false;
wxBitmapHandler *handler = FindHandler(type);
{
wxImage image;
if (!image.LoadFile( name, type ))
- return FALSE;
+ return false;
if (image.Ok())
{
*this = wxBitmap(image);
- return TRUE;
+ return true;
}
- else return FALSE;
+ else return false;
}
return handler->LoadFile(this, name, type, -1, -1);
if (sinfo.pixtype == MWPF_PALETTE) {
if(!(palette = (GR_PALETTE*) malloc(sizeof(GR_PALETTE)))) {
- return FALSE;
+ return false;
}
GrGetSystemPalette(palette);
}
if(!(pixels = (GR_PIXELVAL*) malloc(sizeof(GR_PIXELVAL) * width * height)))
{
- return FALSE;
+ return false;
}
image.Create(width, height);
free(pixels);
if(palette) free(palette);
- return TRUE;
+ return true;
}
#if 0
virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
int type, const wxPalette *palette = NULL);
- virtual bool Create(wxBitmap *bitmap, void *data, long flags,
- int width, int height, int depth = 1)
- { return FALSE; }
+ virtual bool Create(wxBitmap *WXUNUSED(bitmap), void *WXUNUSED(data), long WXUNUSED(flags),
+ int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth) = 1)
+ { return false; }
};
IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler);
bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
- long flags, int desiredWidth,
- int desiredHeight)
+ long WXUNUSED(flags), int WXUNUSED(desiredWidth),
+ int WXUNUSED(desiredHeight))
{
#if wxHAVE_LIB_XPM
if (!bitmap->GetRefData())
{
UnRef();
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
#elif wxUSE_STREAMS
wxXPMDecoder decoder;
wxFileInputStream stream(name);
return image.Ok() && bitmap->CreateFromImage(image);
}
- return FALSE;
+ return false;
#else // !wxHAVE_LIB_XPM && !wxUSE_STREAMS
- return FALSE;
+ return false;
#endif // wxHAVE_LIB_XPM / wxUSE_STREAMS
}
wxImage image(bitmap->ConvertToImage());
if (image.Ok()) return image.SaveFile( name, (wxBitmapType)type );
- return FALSE;
+ return false;
}
#endif // wxHAVE_LIB_XPM || wxUSE_STREAMS
SetType( wxBITMAP_TYPE_XPM_DATA );
};
- virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
- int desiredWidth, int desiredHeight)
- { return FALSE; }
+ virtual bool LoadFile(wxBitmap *WXUNUSED(bitmap),
+ const wxString& WXUNUSED(name),
+ long WXUNUSED(flags),
+ int WXUNUSED(desiredWidth),
+ int WXUNUSED(desiredHeight))
+ { return false; }
- virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
- int type, const wxPalette *palette = NULL)
- { return FALSE; }
+ virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap),
+ const wxString& WXUNUSED(name),
+ int WXUNUSED(type),
+ const wxPalette *WXUNUSED(palette) = NULL)
+ { return false; }
virtual bool Create(wxBitmap *bitmap, void *data, long flags,
int width, int height, int depth = 1);
bool wxXPMDataHandler::Create(wxBitmap *bitmap, void *bits,
long WXUNUSED(flags),
- int width, int height, int WXUNUSED(depth))
+ int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth))
{
#if wxHAVE_LIB_XPM
- wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") )
+ wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") )
if (!bitmap->GetRefData())
bitmap->SetRefData( new wxBitmapRefData() );
M_BMPHANDLERDATA->m_mask->SetBitmap( (WXPixmap) mask );
M_BMPHANDLERDATA->m_mask->SetDisplay( xdisplay );
}
- return TRUE;
+ return true;
}
else
{
bitmap->UnRef();
- return FALSE;
+ return false;
}
#else // !wxHAVE_LIB_XPM
wxXPMDecoder decoder;
SetType( wxBITMAP_TYPE_XBM_DATA );
};
- virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
- int desiredWidth, int desiredHeight)
- { return FALSE; }
+ virtual bool LoadFile(wxBitmap *WXUNUSED(bitmap),
+ const wxString& WXUNUSED(name),
+ long WXUNUSED(flags),
+ int WXUNUSED(desiredWidth),
+ int WXUNUSED(desiredHeight))
+ { return false; }
- virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
- int type, const wxPalette *palette = NULL)
- { return FALSE; }
+ virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap),
+ const wxString& WXUNUSED(name),
+ int WXUNUSED(type),
+ const wxPalette *WXUNUSED(palette) = NULL)
+ { return false; }
virtual bool Create(wxBitmap *bitmap, void *data, long flags,
int width, int height, int depth = 1);
M_BMPHANDLERDATA->m_height = height;
M_BMPHANDLERDATA->m_bpp = 1;
- return TRUE;
+ return true;
#else
- wxCHECK_MSG( M_BMPHANDLERDATA->m_bitmap, FALSE,
+ wxCHECK_MSG( M_BMPHANDLERDATA->m_bitmap, false,
wxT("couldn't create bitmap") );
#endif
}
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/setup.h"
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
#include "wx/utils.h"
#include "wx/brush.h"
#include "wx/bitmap.h"
{
m_style = 0;
}
-
+
wxBrushRefData( const wxBrushRefData& data )
{
m_style = data.m_style;
m_stipple = data.m_stipple;
m_colour = data.m_colour;
}
-
+
bool operator == (const wxBrushRefData& data) const
{
return (m_style == data.m_style &&
m_stipple == data.m_stipple &&
m_colour == data.m_colour);
}
-
+
int m_style;
wxColour m_colour;
wxBitmap m_stipple;
bool wxBrush::operator == ( const wxBrush& brush ) const
{
- if (m_refData == brush.m_refData) return TRUE;
-
- if (!m_refData || !brush.m_refData) return FALSE;
-
+ if (m_refData == brush.m_refData) return true;
+
+ if (!m_refData || !brush.m_refData) return false;
+
return ( *(wxBrushRefData*)m_refData == *(wxBrushRefData*)brush.m_refData );
}
void wxBrush::SetColour( const wxColour& col )
{
AllocExclusive();
-
+
M_BRUSHDATA->m_colour = col;
}
void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b )
{
AllocExclusive();
-
+
M_BRUSHDATA->m_colour.Set( r, g, b );
}
void wxBrush::SetStyle( int style )
{
AllocExclusive();
-
+
M_BRUSHDATA->m_style = style;
}
void wxBrush::SetStipple( const wxBitmap& stipple )
{
AllocExclusive();
-
+
M_BRUSHDATA->m_stipple = stipple;
if (M_BRUSHDATA->m_stipple.GetMask())
{
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/setup.h"
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
#include "wx/utils.h"
#include "wx/pen.h"
#include "wx/colour.h"
m_dash = (wxX11Dash*) NULL;
m_countDashes = 0;
}
-
+
wxPenRefData( const wxPenRefData& data )
{
m_style = data.m_style;
m_capStyle == data.m_capStyle &&
m_colour == data.m_colour);
}
-
+
int m_width;
int m_style;
int m_joinStyle;
bool wxPen::operator == ( const wxPen& pen ) const
{
- if (m_refData == pen.m_refData) return TRUE;
-
- if (!m_refData || !pen.m_refData) return FALSE;
-
+ if (m_refData == pen.m_refData) return true;
+
+ if (!m_refData || !pen.m_refData) return false;
+
return ( *(wxPenRefData*)m_refData == *(wxPenRefData*)pen.m_refData );
}
void wxPen::SetColour( const wxColour &colour )
{
AllocExclusive();
-
+
M_PENDATA->m_colour = colour;
}
void wxPen::SetDashes( int number_of_dashes, const wxDash *dash )
{
AllocExclusive();
-
+
M_PENDATA->m_countDashes = number_of_dashes;
M_PENDATA->m_dash = (wxX11Dash *)dash; // TODO
}
void wxPen::SetColour( int red, int green, int blue )
{
AllocExclusive();
-
+
M_PENDATA->m_colour.Set( red, green, blue );
}
void wxPen::SetCap( int capStyle )
{
AllocExclusive();
-
+
M_PENDATA->m_capStyle = capStyle;
}
void wxPen::SetJoin( int joinStyle )
{
AllocExclusive();
-
+
M_PENDATA->m_joinStyle = joinStyle;
}
void wxPen::SetStipple( wxBitmap *stipple )
{
AllocExclusive();
-
+
M_PENDATA->m_stipple = *stipple;;
}
void wxPen::SetStyle( int style )
{
AllocExclusive();
-
+
M_PENDATA->m_style = style;
}
void wxPen::SetWidth( int width )
{
AllocExclusive();
-
+
M_PENDATA->m_width = width;
}
/////////////////////////////////////////////////////////////////////////////
-// File: region.cpp
+// File: src/x11/region.cpp
// Purpose: Region class
// Author: Julian Smart, Robert Roebling
// Created: Fri Oct 24 10:46:34 MET 1997
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
#include "wx/region.h"
#include "wx/gdicmn.h"
#include "wx/log.h"
{
m_region = NULL;
}
-
+
wxRegionRefData(const wxRegionRefData& refData)
{
m_region = XCreateRegion();
XUnionRegion( refData.m_region, m_region, m_region );
}
-
+
~wxRegionRefData()
{
if (m_region)
void wxRegion::InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
{
XRectangle rect;
- rect.x = x;
- rect.y = y;
- rect.width = w;
- rect.height = h;
-
+ rect.x = (short)x;
+ rect.y = (short)y;
+ rect.width = (unsigned short)w;
+ rect.height = (unsigned short)h;
+
m_refData = new wxRegionRefData();
-
+
M_REGIONDATA->m_region = XCreateRegion();
XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );
}
-wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle )
+wxRegion::wxRegion( size_t WXUNUSED(n), const wxPoint *WXUNUSED(points), int WXUNUSED(fillStyle) )
{
#if 0
XPoint *xpoints = new XPoint[n];
bool wxRegion::operator==( const wxRegion& region ) const
{
- if (m_refData == region.m_refData) return TRUE;
+ if (m_refData == region.m_refData) return true;
+
+ if (!m_refData || !region.m_refData) return false;
- if (!m_refData || !region.m_refData) return FALSE;
-
// compare the regions themselves, not the pointers to ref data!
return XEqualRegion( M_REGIONDATA->m_region,
- M_REGIONDATA_OF(region)->m_region );
+ M_REGIONDATA_OF(region)->m_region ) == True;
}
// ----------------------------------------------------------------------------
// rect results in an empty region (at least XFree 3.3.6 and 4.0 have this
// problem)
if ( !width || !height )
- return TRUE;
+ return true;
XRectangle rect;
- rect.x = x;
- rect.y = y;
- rect.width = width;
- rect.height = height;
-
+ rect.x = (short)x;
+ rect.y = (short)y;
+ rect.width = (unsigned short)width;
+ rect.height = (unsigned short)height;
+
if (!m_refData)
{
m_refData = new wxRegionRefData();
XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );
}
- return TRUE;
+ return true;
}
bool wxRegion::Union( const wxRect& rect )
bool wxRegion::Union( const wxRegion& region )
{
if (region.IsNull())
- return FALSE;
+ return false;
if (!m_refData)
{
{
AllocExclusive();
}
-
+
XUnionRegion( M_REGIONDATA->m_region,
M_REGIONDATA_OF(region)->m_region,
M_REGIONDATA->m_region );
- return TRUE;
+ return true;
}
bool wxRegion::Intersect( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
bool wxRegion::Intersect( const wxRect& rect )
{
wxRegion reg( rect );
-
+
return Intersect( reg );
}
bool wxRegion::Intersect( const wxRegion& region )
{
if (region.IsNull())
- return FALSE;
+ return false;
if (!m_refData)
{
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = XCreateRegion();
-
- // leave here
- return TRUE;
+
+ // leave here
+ return true;
}
else
{
M_REGIONDATA_OF(region)->m_region,
M_REGIONDATA->m_region );
- return TRUE;
+ return true;
}
bool wxRegion::Subtract( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
bool wxRegion::Subtract( const wxRegion& region )
{
if (region.IsNull())
- return FALSE;
+ return false;
if (!m_refData)
{
M_REGIONDATA_OF(region)->m_region,
M_REGIONDATA->m_region );
- return TRUE;
+ return true;
}
bool wxRegion::Xor( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
bool wxRegion::Xor( const wxRegion& region )
{
if (region.IsNull())
- return FALSE;
+ return false;
if (!m_refData)
{
XXorRegion( M_REGIONDATA->m_region,
M_REGIONDATA_OF(region)->m_region,
M_REGIONDATA->m_region );
-
- return TRUE;
+
+ return true;
}
// ----------------------------------------------------------------------------
bool wxRegion::Offset( wxCoord x, wxCoord y )
{
if (!m_refData)
- return FALSE;
+ return false;
AllocExclusive();
XOffsetRegion( M_REGIONDATA->m_region, x, y );
- return TRUE;
+ return true;
}
bool wxRegion::Empty() const
{
if (!m_refData)
- return TRUE;
+ return true;
- return XEmptyRegion( M_REGIONDATA->m_region );
+ return XEmptyRegion( M_REGIONDATA->m_region ) == True;
}
wxRegionContain wxRegion::Contains( wxCoord x, wxCoord y ) const
m_rects = 0;
m_numRects = 0;
-
+
if (region.IsEmpty()) return;
-
+
Region r = (Region) region.GetX11Region();
if (r)
{
return r;
}
-
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
#ifdef __VMS
#define XShapeQueryExtension XSHAPEQUERYEXTENSION
#define XtDisplay XTDISPLAY
XColor* colors = (XColor*) m_visualColormap;
for (int i = 0; i < m_visualColormapSize; i++)
- colors[i].pixel = i;
+ colors[i].pixel = i;
XQueryColors( dpy, DefaultColormap(dpy, vi->screen),
colors, m_visualColormapSize );
index |= (g >> (5 - m_visualGreenPrec)) << m_visualGreenShift;
index |= (b >> (5 - m_visualBluePrec)) << m_visualBlueShift;
}
- m_colorCube[ (r*1024) + (g*32) + b ] = index;
+ m_colorCube[ (r*1024) + (g*32) + b ] = (unsigned char)index;
}
}
}