merged 2.2 branch

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty
2000-07-15 19:51:35 +00:00
parent 8a693e6e04
commit f6bcfd974e
1835 changed files with 237729 additions and 67990 deletions

View File

@@ -380,35 +380,18 @@ public:
#define WXAPIENTRY WXFAR wxSTDCALL
#endif
// Patch from Mumit Khan to allow DLL compilation under mingw. Note that
// this includes <windows.h> which is a bad thing because it prevents
// wxWindows to work with MFC, so for now I'm making this change for
// mingw/cygwin only (these don't work with MFC yet). GRG Mar/2000
#if defined(__GNUWIN32__)
#include <windows.h>
#include "wx/msw/winundef.h"
#include <windows.h>
#include "wx/msw/winundef.h"
#define IMPLEMENT_WXWIN_MAIN \
extern "C" int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int);\
int WINAPI WinMain(HINSTANCE hInstance, \
HINSTANCE hPrevInstance,\
LPSTR m_lpCmdLine, int nCmdShow )\
{\
return wxEntry((WXHINSTANCE) hInstance, \
(WXHINSTANCE) hPrevInstance,\
m_lpCmdLine, nCmdShow);\
}
#else
#define IMPLEMENT_WXWIN_MAIN \
int WXAPIENTRY WinMain(HINSTANCE hInstance, \
HINSTANCE hPrevInstance,\
LPSTR m_lpCmdLine, int nCmdShow )\
{\
return wxEntry((WXHINSTANCE) hInstance, \
(WXHINSTANCE) hPrevInstance,\
m_lpCmdLine, nCmdShow);\
}
#endif
#define IMPLEMENT_WXWIN_MAIN \
extern "C" int WXAPIENTRY WinMain(HINSTANCE hInstance,\
HINSTANCE hPrevInstance,\
LPSTR m_lpCmdLine, int nCmdShow)\
{\
return wxEntry((WXHINSTANCE) hInstance,\
(WXHINSTANCE) hPrevInstance,\
m_lpCmdLine, nCmdShow);\
}
#else
#define IMPLEMENT_WXWIN_MAIN
#endif

View File

@@ -57,21 +57,19 @@ name::name(const name& src) \
DoCopy(src); \
} \
\
void name::Empty() \
void name::DoEmpty() \
{ \
for ( size_t ui = 0; ui < Count(); ui++ ) \
delete (T*)wxBaseArray::Item(ui); \
\
wxBaseArray::Clear(); \
} \
\
void name::RemoveAt(size_t uiIndex) \
void name::RemoveAt(size_t uiIndex) \
{ \
wxCHECK_RET( uiIndex < Count(), _WX_ERROR_REMOVE2(name) ); \
\
delete (T*)wxBaseArray::Item(uiIndex); \
\
wxBaseArray::RemoveAt(uiIndex); \
wxBaseArray::RemoveAt(uiIndex); \
} \
\
void name::Add(const T& item) \

View File

@@ -54,6 +54,7 @@ public:
return *this;
}
const char *data() const { return m_str; }
operator const char *() const { return m_str; }
char operator[](size_t n) const { return m_str[n]; }
@@ -103,6 +104,7 @@ public:
return *this;
}
const wchar_t *data() const { return m_wcs; }
operator const wchar_t *() const { return m_wcs; }
wchar_t operator[](size_t n) const { return m_wcs[n]; }

View File

@@ -139,6 +139,8 @@ protected:
private:
wxDateTime m_date;
wxDateTime::WeekDay m_wday;
DECLARE_DYNAMIC_CLASS(wxCalendarEvent)
};
// ----------------------------------------------------------------------------

View File

@@ -32,7 +32,8 @@ enum
wxCMD_LINE_OPTION_MANDATORY = 0x01, // this option must be given
wxCMD_LINE_PARAM_OPTIONAL = 0x02, // the parameter may be omitted
wxCMD_LINE_PARAM_MULTIPLE = 0x04, // the parameter may be repeated
wxCMD_LINE_OPTION_HELP = 0x08 // this option is a help request
wxCMD_LINE_OPTION_HELP = 0x08, // this option is a help request
wxCMD_LINE_NEEDS_SEPARATOR = 0x10, // must have sep before the value
};
// an option value or parameter may be a string (the most common case), a

View File

@@ -35,13 +35,13 @@
/// separates group and entry names (probably shouldn't be changed)
#ifndef wxCONFIG_PATH_SEPARATOR
#define wxCONFIG_PATH_SEPARATOR '/'
#define wxCONFIG_PATH_SEPARATOR _T('/')
#endif
/// introduces immutable entries
// (i.e. the ones which can't be changed from the local config file)
#ifndef wxCONFIG_IMMUTABLE_PREFIX
#define wxCONFIG_IMMUTABLE_PREFIX '!'
#define wxCONFIG_IMMUTABLE_PREFIX _T('!')
#endif
/// should we use registry instead of configuration files under Windows?
@@ -113,7 +113,7 @@ public:
long style = 0);
// empty but ensures that dtor of all derived classes is virtual
virtual ~wxConfigBase() { }
virtual ~wxConfigBase();
// path management
// set current path: if the first character is '/', it's the absolute path,
@@ -226,6 +226,7 @@ public:
// misc accessors
wxString GetAppName() const { return m_appName; }
wxString GetVendorName() const { return m_vendorName; }
// Used wxIniConfig to set members in constructor
void SetAppName(const wxString& appName) { m_appName = appName; }
void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }
@@ -307,12 +308,12 @@ private:
$VARNAME or ${VARNAME} where VARNAME contains alphanumeric characters and
'_' only. '$' must be escaped ('\$') in order to be taken literally.
*/
extern wxString wxExpandEnvVars(const wxString &sz);
extern WXDLLEXPORT wxString wxExpandEnvVars(const wxString &sz);
/*
Split path into parts removing '..' in progress
*/
extern void wxSplitPath(wxArrayString& aParts, const wxChar *sz);
extern WXDLLEXPORT void wxSplitPath(wxArrayString& aParts, const wxChar *sz);
#endif
// _WX_CONFIG_H_

View File

@@ -21,23 +21,39 @@
/* This is a small class which can be used by all ports
to temporarily suspend the busy cursor. Useful in modal
dialogs.
Actually that is not (any longer) quite true.. currently it is
only used in wxGTK Dialog::ShowModal() and now uses static
wxBusyCursor methods that are only implemented for wxGTK so far.
The BusyCursor handling code should probably be implemented in
common code somewhere instead of the separate implementations we
currently have. Also the name BusyCursorSuspender is a little
misleading since it doesn't actually suspend the BusyCursor, just
masks one that is already showing.
If another call to wxBeginBusyCursor is made while this is active
the Busy Cursor will again be shown. But at least now it doesn't
interfere with the state of wxIsBusy() -- RL
*/
class wxBusyCursorSuspender
{
public:
wxBusyCursorSuspender()
{
m_wasBusy = wxIsBusy();
if(m_wasBusy)
wxEndBusyCursor();
}
~wxBusyCursorSuspender()
{
if(m_wasBusy)
wxBeginBusyCursor();
}
private:
bool m_wasBusy;
wxBusyCursorSuspender()
{
if( wxIsBusy() )
{
wxSetCursor( wxBusyCursor::GetStoredCursor() );
wxYield();
}
}
~wxBusyCursorSuspender()
{
if( wxIsBusy() )
{
wxSetCursor( wxBusyCursor::GetBusyCursor() );
wxYield();
}
}
};
#endif
// _WX_CURSOR_H_BASE_

View File

@@ -250,7 +250,7 @@ private:
// wxDataObject directly.
// ----------------------------------------------------------------------------
WX_DECLARE_LIST(wxDataObjectSimple, wxSimpleDataObjectList);
WX_DECLARE_EXPORTED_LIST(wxDataObjectSimple, wxSimpleDataObjectList);
class WXDLLEXPORT wxDataObjectComposite : public wxDataObject
{

View File

@@ -161,16 +161,16 @@ public:
int GetMonth() const { return m_date.GetMonth() + 1; }
// First Date Of Month
wxDate GetMonthStart() const { return(wxDate(GetMonth(), 1, GetYear())); }
wxDate GetMonthStart() const { return(wxDate(GetMonth()-1, 1, GetYear())); }
// Last Date Of Month
wxDate GetMonthEnd() const { return wxDate(GetMonth()+1, 1, GetYear())-1; }
wxDate GetMonthEnd() const { return wxDate(GetMonth(), 1, GetYear())-1; }
// eg. 1992
int GetYear() const { return m_date.GetYear(); }
// First Date Of Year
wxDate GetYearStart() const { return wxDate(1, 1, GetYear()); }
wxDate GetYearStart() const { return wxDate(0, 1, GetYear()); }
// Last Date Of Year
wxDate GetYearEnd() const { return wxDate(1, 1, GetYear()+1) - 1; }
wxDate GetYearEnd() const { return wxDate(0, 1, GetYear()+1) - 1; }
bool IsBetween(const wxDate& first, const wxDate& second) const
{

View File

@@ -30,12 +30,14 @@ class WXDLLEXPORT wxDateSpan;
// performances and this only leads to increased rebuild time (because every
// time an inline method is changed, all files including the header must be
// rebuilt)
#ifdef __WXDEBUG__
// For Mingw32, causes a link error.
#if defined( __WXDEBUG__) && !defined(__MINGW32__)
#undef inline
#define inline
#endif // Debug
/*
* TODO Well, everything :-)
* TODO
*
* + 1. Time zones with minutes (make TimeZone a class)
* ? 2. getdate() function like under Solaris
@@ -63,7 +65,7 @@ class WXDLLEXPORT wxDateSpan;
wxTimeSpan + wxTimeSpan = wxTimeSpan
wxDateSpan + wxDateSpan = wxDateSpan
substraction
subtraction
------------
wxDateTime - wxDateTime = wxTimeSpan
wxDateTime - wxTimeSpan = wxDateTime
@@ -84,7 +86,7 @@ class WXDLLEXPORT wxDateSpan;
-wxDateSpan = wxDateSpan
For each binary operation OP (+, -, *) we have the following operatorOP=() as
a method and the method with a symbolic name OPER (Add, Substract, Multiply)
a method and the method with a symbolic name OPER (Add, Subtract, Multiply)
as a synonym for it and another const method with the same name which returns
the changed copy of the object and operatorOP() as a global function which is
implemented in terms of the const version of OPEN. For the unary - we have
@@ -510,6 +512,10 @@ public:
// return the wxDateTime object for the current time
static inline wxDateTime Now();
// return the wxDateTime object for the current time with millisecond
// precision (if available on this platform)
static wxDateTime UNow();
// return the wxDateTime object for today midnight: i.e. as Now() but
// with time set to 0
static inline wxDateTime Today();
@@ -855,10 +861,10 @@ public:
inline wxDateTime& operator+=(const wxTimeSpan& diff);
// return the difference of the date with a time span
inline wxDateTime Substract(const wxTimeSpan& diff) const;
// substract a time span (positive or negative)
inline wxDateTime& Substract(const wxTimeSpan& diff);
// substract a time span (positive or negative)
inline wxDateTime Subtract(const wxTimeSpan& diff) const;
// subtract a time span (positive or negative)
inline wxDateTime& Subtract(const wxTimeSpan& diff);
// subtract a time span (positive or negative)
inline wxDateTime& operator-=(const wxTimeSpan& diff);
// return the sum of the date with a date span
@@ -869,14 +875,14 @@ public:
inline wxDateTime& operator+=(const wxDateSpan& diff);
// return the difference of the date with a date span
inline wxDateTime Substract(const wxDateSpan& diff) const;
// substract a date span (positive or negative)
inline wxDateTime& Substract(const wxDateSpan& diff);
// substract a date span (positive or negative)
inline wxDateTime Subtract(const wxDateSpan& diff) const;
// subtract a date span (positive or negative)
inline wxDateTime& Subtract(const wxDateSpan& diff);
// subtract a date span (positive or negative)
inline wxDateTime& operator-=(const wxDateSpan& diff);
// return the difference between two dates
inline wxTimeSpan Substract(const wxDateTime& dt) const;
inline wxTimeSpan Subtract(const wxDateTime& dt) const;
// conversion to/from text: all conversions from text return the pointer to
// the next character following the date specification (i.e. the one where
@@ -961,7 +967,7 @@ private:
// ----------------------------------------------------------------------------
// This class contains a difference between 2 wxDateTime values, so it makes
// sense to add it to wxDateTime and it is the result of substraction of 2
// sense to add it to wxDateTime and it is the result of subtraction of 2
// objects of that class. See also wxDateSpan.
// ----------------------------------------------------------------------------
@@ -1017,11 +1023,11 @@ public:
wxTimeSpan& operator+=(const wxTimeSpan& diff) { return Add(diff); }
// return the difference of two timespans
inline wxTimeSpan Substract(const wxTimeSpan& diff) const;
// substract another timespan
inline wxTimeSpan& Substract(const wxTimeSpan& diff);
// substract another timespan
wxTimeSpan& operator-=(const wxTimeSpan& diff) { return Substract(diff); }
inline wxTimeSpan Subtract(const wxTimeSpan& diff) const;
// subtract another timespan
inline wxTimeSpan& Subtract(const wxTimeSpan& diff);
// subtract another timespan
wxTimeSpan& operator-=(const wxTimeSpan& diff) { return Subtract(diff); }
// multiply timespan by a scalar
inline wxTimeSpan Multiply(int n) const;
@@ -1094,11 +1100,7 @@ public:
// resulting text representation. Notice that only some of format
// specifiers valid for wxDateTime are valid for wxTimeSpan: hours,
// minutes and seconds make sense, but not "PM/AM" string for example.
wxString Format(const wxChar *format = _T("%c")) const;
// preferred date representation for the current locale
wxString FormatDate() const { return Format(_T("%x")); }
// preferred time representation for the current locale
wxString FormatTime() const { return Format(_T("%X")); }
wxString Format(const wxChar *format = _T("%H:%M:%S")) const;
// implementation
// ------------------------------------------------------------------------
@@ -1125,7 +1127,7 @@ private:
// won't be changed unless the resulting date would be invalid: for example,
// Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31.
//
// Because of this feature, adding and substracting back again the same
// Because of this feature, adding and subtracting back again the same
// wxDateSpan will *not*, in general give back the original date: Feb 28 - 1
// month will be Jan 28, not Jan 31!
//
@@ -1212,10 +1214,10 @@ public:
inline wxDateSpan& operator+=(const wxDateSpan& other);
// return difference of two date spans
inline wxDateSpan Substract(const wxDateSpan& other) const;
// substract another wxDateSpan from us
inline wxDateSpan& Substract(const wxDateSpan& other);
// substract another wxDateSpan from us
inline wxDateSpan Subtract(const wxDateSpan& other) const;
// subtract another wxDateSpan from us
inline wxDateSpan& Subtract(const wxDateSpan& other);
// subtract another wxDateSpan from us
inline wxDateSpan& operator-=(const wxDateSpan& other);
// return a copy of this time span with changed sign
@@ -1245,7 +1247,7 @@ private:
#include "wx/dynarray.h"
WX_DECLARE_OBJARRAY(wxDateTime, wxDateTimeArray);
WX_DECLARE_EXPORTED_OBJARRAY(wxDateTime, wxDateTimeArray);
// ----------------------------------------------------------------------------
// wxDateTimeHolidayAuthority: an object of this class will decide whether a
@@ -1262,7 +1264,7 @@ WX_DEFINE_EXPORTED_ARRAY(wxDateTimeHolidayAuthority *, wxHolidayAuthoritiesArray
class wxDateTimeHolidaysModule;
class WXDLLEXPORT wxDateTimeHolidayAuthority
{
friend wxDateTimeHolidaysModule;
friend class wxDateTimeHolidaysModule;
public:
// returns TRUE if the given date is a holiday
static bool IsHoliday(const wxDateTime& dt);
@@ -1350,7 +1352,7 @@ inline wxDateTime WXDLLEXPORT operator+(const wxDateTime& dt,
inline wxDateTime WXDLLEXPORT operator-(const wxDateTime& dt,
const wxTimeSpan& ts)
{
return dt.Substract(ts);
return dt.Subtract(ts);
}
inline wxDateTime WXDLLEXPORT operator+(const wxDateTime& dt,
@@ -1362,13 +1364,13 @@ inline wxDateTime WXDLLEXPORT operator+(const wxDateTime& dt,
inline wxDateTime WXDLLEXPORT operator-(const wxDateTime& dt,
const wxDateSpan& ds)
{
return dt.Substract(ds);
return dt.Subtract(ds);
}
inline wxTimeSpan WXDLLEXPORT operator-(const wxDateTime& dt1,
const wxDateTime& dt2)
{
return dt1.Substract(dt2);
return dt1.Subtract(dt2);
}
// comparison

View File

@@ -40,19 +40,19 @@
const long wxDateTime::TIME_T_FACTOR = 1000l;
#endif // wxDEFINE_TIME_CONSTANTS
WXDLLEXPORT bool wxDateTime::IsInStdRange() const
inline bool wxDateTime::IsInStdRange() const
{
return m_time >= 0l && (m_time / TIME_T_FACTOR) < LONG_MAX;
}
/* static */
WXDLLEXPORT wxDateTime wxDateTime::Now()
inline wxDateTime wxDateTime::Now()
{
return wxDateTime(*GetTmNow());
}
/* static */
WXDLLEXPORT wxDateTime wxDateTime::Today()
inline wxDateTime wxDateTime::Today()
{
struct tm *tm = GetTmNow();
tm->tm_hour =
@@ -63,7 +63,7 @@ WXDLLEXPORT wxDateTime wxDateTime::Today()
}
#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
WXDLLEXPORT wxDateTime& wxDateTime::Set(time_t timet)
inline wxDateTime& wxDateTime::Set(time_t timet)
{
// assign first to avoid long multiplication overflow!
m_time = timet;
@@ -73,56 +73,56 @@ WXDLLEXPORT wxDateTime& wxDateTime::Set(time_t timet)
}
#endif
WXDLLEXPORT wxDateTime& wxDateTime::SetToCurrent()
inline wxDateTime& wxDateTime::SetToCurrent()
{
*this = Now();
return *this;
}
#if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
WXDLLEXPORT wxDateTime::wxDateTime(time_t timet)
inline wxDateTime::wxDateTime(time_t timet)
{
Set(timet);
}
#endif
WXDLLEXPORT wxDateTime::wxDateTime(const struct tm& tm)
inline wxDateTime::wxDateTime(const struct tm& tm)
{
Set(tm);
}
WXDLLEXPORT wxDateTime::wxDateTime(const Tm& tm)
inline wxDateTime::wxDateTime(const Tm& tm)
{
Set(tm);
}
WXDLLEXPORT wxDateTime::wxDateTime(double jdn)
inline wxDateTime::wxDateTime(double jdn)
{
Set(jdn);
}
WXDLLEXPORT wxDateTime& wxDateTime::Set(const Tm& tm)
inline wxDateTime& wxDateTime::Set(const Tm& tm)
{
wxASSERT_MSG( tm.IsValid(), _T("invalid broken down date/time") );
return Set(tm.mday, (Month)tm.mon, tm.year, tm.hour, tm.min, tm.sec);
}
WXDLLEXPORT wxDateTime::wxDateTime(wxDateTime_t hour,
wxDateTime_t minute,
wxDateTime_t second,
wxDateTime_t millisec)
inline wxDateTime::wxDateTime(wxDateTime_t hour,
wxDateTime_t minute,
wxDateTime_t second,
wxDateTime_t millisec)
{
Set(hour, minute, second, millisec);
}
WXDLLEXPORT wxDateTime::wxDateTime(wxDateTime_t day,
Month month,
int year,
wxDateTime_t hour,
wxDateTime_t minute,
wxDateTime_t second,
wxDateTime_t millisec)
inline wxDateTime::wxDateTime(wxDateTime_t day,
Month month,
int year,
wxDateTime_t hour,
wxDateTime_t minute,
wxDateTime_t second,
wxDateTime_t millisec)
{
Set(day, month, year, hour, minute, second, millisec);
}
@@ -131,14 +131,14 @@ WXDLLEXPORT wxDateTime::wxDateTime(wxDateTime_t day,
// wxDateTime accessors
// ----------------------------------------------------------------------------
WXDLLEXPORT wxLongLong wxDateTime::GetValue() const
inline wxLongLong wxDateTime::GetValue() const
{
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
return m_time;
}
WXDLLEXPORT time_t wxDateTime::GetTicks() const
inline time_t wxDateTime::GetTicks() const
{
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
if ( !IsInStdRange() )
@@ -149,60 +149,61 @@ WXDLLEXPORT time_t wxDateTime::GetTicks() const
return (time_t)((m_time / (long)TIME_T_FACTOR).GetLo());
}
WXDLLEXPORT bool wxDateTime::SetToLastWeekDay(WeekDay weekday,
Month month,
int year)
inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday,
Month month,
int year)
{
return SetToWeekDay(weekday, -1, month, year);
}
WXDLLEXPORT wxDateTime wxDateTime::GetWeekDayInSameWeek(WeekDay weekday) const
inline wxDateTime wxDateTime::GetWeekDayInSameWeek(WeekDay weekday) const
{
MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday) );
}
WXDLLEXPORT wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const
inline wxDateTime wxDateTime::GetNextWeekDay(WeekDay weekday) const
{
MODIFY_AND_RETURN( SetToNextWeekDay(weekday) );
}
WXDLLEXPORT wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const
inline wxDateTime wxDateTime::GetPrevWeekDay(WeekDay weekday) const
{
MODIFY_AND_RETURN( SetToPrevWeekDay(weekday) );
}
WXDLLEXPORT wxDateTime wxDateTime::GetWeekDay(WeekDay weekday,
int n,
Month month,
int year) const
inline wxDateTime wxDateTime::GetWeekDay(WeekDay weekday,
int n,
Month month,
int year) const
{
wxDateTime dt(*this);
return dt.SetToWeekDay(weekday, n, month, year) ? dt : wxInvalidDateTime;
}
WXDLLEXPORT wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday,
Month month,
int year)
inline wxDateTime wxDateTime::GetLastWeekDay(WeekDay weekday,
Month month,
int year)
{
wxDateTime dt(*this);
return dt.SetToLastWeekDay(weekday, month, year) ? dt : wxInvalidDateTime;
}
WXDLLEXPORT wxDateTime wxDateTime::GetWeek(wxDateTime_t numWeek, WeekDay weekday) const
inline wxDateTime wxDateTime::GetWeek(wxDateTime_t numWeek,
WeekDay weekday) const
{
wxDateTime dt(*this);
return dt.SetToTheWeek(numWeek, weekday) ? dt : wxInvalidDateTime;
}
WXDLLEXPORT wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const
inline wxDateTime wxDateTime::GetLastMonthDay(Month month, int year) const
{
MODIFY_AND_RETURN( SetToLastMonthDay(month, year) );
}
WXDLLEXPORT wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const
inline wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const
{
MODIFY_AND_RETURN( SetToYearDay(yday) );
}
@@ -211,46 +212,47 @@ WXDLLEXPORT wxDateTime wxDateTime::GetYearDay(wxDateTime_t yday) const
// wxDateTime comparison
// ----------------------------------------------------------------------------
WXDLLEXPORT bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const
inline bool wxDateTime::IsEqualTo(const wxDateTime& datetime) const
{
wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime"));
return m_time == datetime.m_time;
}
WXDLLEXPORT bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const
inline bool wxDateTime::IsEarlierThan(const wxDateTime& datetime) const
{
wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime"));
return m_time < datetime.m_time;
}
WXDLLEXPORT bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const
inline bool wxDateTime::IsLaterThan(const wxDateTime& datetime) const
{
wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime"));
return m_time > datetime.m_time;
}
WXDLLEXPORT bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1,
const wxDateTime& t2) const
inline bool wxDateTime::IsStrictlyBetween(const wxDateTime& t1,
const wxDateTime& t2) const
{
// no need for assert, will be checked by the functions we call
return IsLaterThan(t1) && IsEarlierThan(t2);
}
WXDLLEXPORT bool wxDateTime::IsBetween(const wxDateTime& t1, const wxDateTime& t2) const
inline bool wxDateTime::IsBetween(const wxDateTime& t1,
const wxDateTime& t2) const
{
// no need for assert, will be checked by the functions we call
return IsEqualTo(t1) || IsEqualTo(t2) || IsStrictlyBetween(t1, t2);
}
WXDLLEXPORT bool wxDateTime::IsSameDate(const wxDateTime& dt) const
inline bool wxDateTime::IsSameDate(const wxDateTime& dt) const
{
return (m_time - dt.m_time).Abs() < MILLISECONDS_PER_DAY;
}
WXDLLEXPORT bool wxDateTime::IsSameTime(const wxDateTime& dt) const
inline bool wxDateTime::IsSameTime(const wxDateTime& dt) const
{
// notice that we can't do something like this:
//
@@ -266,23 +268,24 @@ WXDLLEXPORT bool wxDateTime::IsSameTime(const wxDateTime& dt) const
tm1.msec == tm2.msec;
}
WXDLLEXPORT bool wxDateTime::IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const
inline bool wxDateTime::IsEqualUpTo(const wxDateTime& dt,
const wxTimeSpan& ts) const
{
return IsBetween(dt.Substract(ts), dt.Add(ts));
return IsBetween(dt.Subtract(ts), dt.Add(ts));
}
// ----------------------------------------------------------------------------
// wxDateTime arithmetics
// ----------------------------------------------------------------------------
WXDLLEXPORT wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const
inline wxDateTime wxDateTime::Add(const wxTimeSpan& diff) const
{
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
return wxDateTime(m_time + diff.GetValue());
}
WXDLLEXPORT wxDateTime& wxDateTime::Add(const wxTimeSpan& diff)
inline wxDateTime& wxDateTime::Add(const wxTimeSpan& diff)
{
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
@@ -291,19 +294,19 @@ WXDLLEXPORT wxDateTime& wxDateTime::Add(const wxTimeSpan& diff)
return *this;
}
WXDLLEXPORT wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff)
inline wxDateTime& wxDateTime::operator+=(const wxTimeSpan& diff)
{
return Add(diff);
}
WXDLLEXPORT wxDateTime wxDateTime::Substract(const wxTimeSpan& diff) const
inline wxDateTime wxDateTime::Subtract(const wxTimeSpan& diff) const
{
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
return wxDateTime(m_time - diff.GetValue());
}
WXDLLEXPORT wxDateTime& wxDateTime::Substract(const wxTimeSpan& diff)
inline wxDateTime& wxDateTime::Subtract(const wxTimeSpan& diff)
{
wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
@@ -312,39 +315,39 @@ WXDLLEXPORT wxDateTime& wxDateTime::Substract(const wxTimeSpan& diff)
return *this;
}
WXDLLEXPORT wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff)
inline wxDateTime& wxDateTime::operator-=(const wxTimeSpan& diff)
{
return Substract(diff);
return Subtract(diff);
}
WXDLLEXPORT wxTimeSpan wxDateTime::Substract(const wxDateTime& datetime) const
inline wxTimeSpan wxDateTime::Subtract(const wxDateTime& datetime) const
{
wxASSERT_MSG( IsValid() && datetime.IsValid(), _T("invalid wxDateTime"));
return wxTimeSpan(datetime.GetValue() - GetValue());
return wxTimeSpan(GetValue() - datetime.GetValue());
}
WXDLLEXPORT wxDateTime wxDateTime::Add(const wxDateSpan& diff) const
inline wxDateTime wxDateTime::Add(const wxDateSpan& diff) const
{
return wxDateTime(*this).Add(diff);
}
WXDLLEXPORT wxDateTime& wxDateTime::Substract(const wxDateSpan& diff)
inline wxDateTime& wxDateTime::Subtract(const wxDateSpan& diff)
{
return Add(diff.Negate());
}
WXDLLEXPORT wxDateTime wxDateTime::Substract(const wxDateSpan& diff) const
inline wxDateTime wxDateTime::Subtract(const wxDateSpan& diff) const
{
return wxDateTime(*this).Substract(diff);
return wxDateTime(*this).Subtract(diff);
}
WXDLLEXPORT wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff)
inline wxDateTime& wxDateTime::operator-=(const wxDateSpan& diff)
{
return Substract(diff);
return Subtract(diff);
}
WXDLLEXPORT wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff)
inline wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff)
{
return Add(diff);
}
@@ -353,8 +356,8 @@ WXDLLEXPORT wxDateTime& wxDateTime::operator+=(const wxDateSpan& diff)
// wxDateTime and timezones
// ----------------------------------------------------------------------------
WXDLLEXPORT wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz,
bool noDST) const
inline wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz,
bool noDST) const
{
MODIFY_AND_RETURN( MakeTimezone(tz, noDST) );
}
@@ -363,7 +366,10 @@ WXDLLEXPORT wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz,
// wxTimeSpan construction
// ----------------------------------------------------------------------------
WXDLLEXPORT wxTimeSpan::wxTimeSpan(long hours, long minutes, long seconds, long milliseconds)
inline wxTimeSpan::wxTimeSpan(long hours,
long minutes,
long seconds,
long milliseconds)
{
// assign first to avoid precision loss
m_diff = hours;
@@ -379,27 +385,27 @@ WXDLLEXPORT wxTimeSpan::wxTimeSpan(long hours, long minutes, long seconds, long
// wxTimeSpan accessors
// ----------------------------------------------------------------------------
WXDLLEXPORT wxLongLong wxTimeSpan::GetSeconds() const
inline wxLongLong wxTimeSpan::GetSeconds() const
{
return m_diff / 1000l;
}
WXDLLEXPORT int wxTimeSpan::GetMinutes() const
inline int wxTimeSpan::GetMinutes() const
{
return (GetSeconds() / 60l).GetLo();
}
WXDLLEXPORT int wxTimeSpan::GetHours() const
inline int wxTimeSpan::GetHours() const
{
return GetMinutes() / 60;
}
WXDLLEXPORT int wxTimeSpan::GetDays() const
inline int wxTimeSpan::GetDays() const
{
return GetHours() / 24;
}
WXDLLEXPORT int wxTimeSpan::GetWeeks() const
inline int wxTimeSpan::GetWeeks() const
{
return GetDays() / 7;
}
@@ -408,53 +414,53 @@ WXDLLEXPORT int wxTimeSpan::GetWeeks() const
// wxTimeSpan arithmetics
// ----------------------------------------------------------------------------
WXDLLEXPORT wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const
inline wxTimeSpan wxTimeSpan::Add(const wxTimeSpan& diff) const
{
return wxTimeSpan(m_diff + diff.GetValue());
}
WXDLLEXPORT wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff)
inline wxTimeSpan& wxTimeSpan::Add(const wxTimeSpan& diff)
{
m_diff += diff.GetValue();
return *this;
}
WXDLLEXPORT wxTimeSpan wxTimeSpan::Substract(const wxTimeSpan& diff) const
inline wxTimeSpan wxTimeSpan::Subtract(const wxTimeSpan& diff) const
{
return wxTimeSpan(m_diff - diff.GetValue());
}
WXDLLEXPORT wxTimeSpan& wxTimeSpan::Substract(const wxTimeSpan& diff)
inline wxTimeSpan& wxTimeSpan::Subtract(const wxTimeSpan& diff)
{
m_diff -= diff.GetValue();
return *this;
}
WXDLLEXPORT wxTimeSpan& wxTimeSpan::Multiply(int n)
inline wxTimeSpan& wxTimeSpan::Multiply(int n)
{
m_diff *= (long)n;
return *this;
}
WXDLLEXPORT wxTimeSpan wxTimeSpan::Multiply(int n) const
inline wxTimeSpan wxTimeSpan::Multiply(int n) const
{
return wxTimeSpan(m_diff * (long)n);
}
WXDLLEXPORT wxTimeSpan wxTimeSpan::Abs() const
inline wxTimeSpan wxTimeSpan::Abs() const
{
return wxTimeSpan(GetValue().Abs());
}
WXDLLEXPORT bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const
inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan& ts) const
{
return GetValue() == ts.GetValue();
}
WXDLLEXPORT bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const
inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const
{
return GetValue().Abs() > ts.GetValue().Abs();
}
@@ -463,8 +469,7 @@ WXDLLEXPORT bool wxTimeSpan::IsLongerThan(const wxTimeSpan& ts) const
// wxDateSpan
// ----------------------------------------------------------------------------
WXDLLEXPORT wxDateSpan&
wxDateSpan::operator+=(const wxDateSpan& other)
inline wxDateSpan& wxDateSpan::operator+=(const wxDateSpan& other)
{
m_years += other.m_years;
m_months += other.m_months;
@@ -474,7 +479,19 @@ wxDateSpan::operator+=(const wxDateSpan& other)
return *this;
}
WXDLLEXPORT wxDateSpan& wxDateSpan::Multiply(int factor)
inline wxDateSpan& wxDateSpan::Add(const wxDateSpan& other)
{
return *this += other;
}
inline wxDateSpan wxDateSpan::Add(const wxDateSpan& other) const
{
wxDateSpan ds(*this);
ds.Add(other);
return ds;
}
inline wxDateSpan& wxDateSpan::Multiply(int factor)
{
m_years *= factor;
m_months *= factor;
@@ -484,17 +501,19 @@ WXDLLEXPORT wxDateSpan& wxDateSpan::Multiply(int factor)
return *this;
}
WXDLLEXPORT wxDateSpan wxDateSpan::Multiply(int factor) const
inline wxDateSpan wxDateSpan::Multiply(int factor) const
{
return wxDateSpan(*this).Multiply(factor);
wxDateSpan ds(*this);
ds.Multiply(factor);
return ds;
}
WXDLLEXPORT wxDateSpan wxDateSpan::Negate() const
inline wxDateSpan wxDateSpan::Negate() const
{
return wxDateSpan(-m_years, -m_months, -m_weeks, -m_days);
}
WXDLLEXPORT wxDateSpan& wxDateSpan::Neg()
inline wxDateSpan& wxDateSpan::Neg()
{
m_years = -m_years;
m_months = -m_months;
@@ -504,6 +523,23 @@ WXDLLEXPORT wxDateSpan& wxDateSpan::Neg()
return *this;
}
inline wxDateSpan& wxDateSpan::operator-=(const wxDateSpan& other)
{
return *this += other.Negate();
}
inline wxDateSpan& wxDateSpan::Subtract(const wxDateSpan& other)
{
return *this -= other;
}
inline wxDateSpan wxDateSpan::Subtract(const wxDateSpan& other) const
{
wxDateSpan ds(*this);
ds.Subtract(other);
return ds;
}
#undef MILLISECONDS_PER_DAY
#undef MODIFY_AND_RETURN

View File

@@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////////
// Name: db.h
// Purpose: Header file wxDB class. The wxDB class represents a connection
// to an ODBC data source. The wxDB class allows operations on the data
// Purpose: Header file wxDb class. The wxDb class represents a connection
// to an ODBC data source. The wxDb class allows operations on the data
// source such as opening and closing the data source.
// Author: Doug Card
// Modified by: George Tasker
@@ -38,6 +38,12 @@
#ifndef DB_DOT_H
#define DB_DOT_H
// BJO 20000503: introduce new GetColumns members which are more database independant and
// return columns in the order they were created
#define OLD_GETCOLUMNS 1
// Use this line for wxWindows v1.x
//#include "wx_ver.h"
// Use this line for wxWindows v2.x
@@ -93,7 +99,7 @@ enum enumDummy {enumDum1};
#define FALSE 0
#endif
const int DB_PATH_MAX = 254;
const int wxDB_PATH_MAX = 254;
extern char const *SQL_LOG_FILENAME;
extern char const *SQL_CATALOG_FILENAME;
@@ -243,10 +249,10 @@ struct wxDbConnectInf
char fileType[SQL_MAX_DSN_LENGTH+1]; // Not sure what the max length is
// Optionals needed for some databases like dBase
char defaultDir[DB_PATH_MAX]; // Directory that db file resides in
char defaultDir[wxDB_PATH_MAX]; // Directory that db file resides in
};
struct wxSqlTypeInfo
struct wxDbSqlTypeInfo
{
char TypeName[DB_TYPE_NAME_LEN];
int FsqlType;
@@ -257,7 +263,7 @@ struct wxSqlTypeInfo
};
class WXDLLEXPORT wxColFor
class WXDLLEXPORT wxDbColFor
{
public:
wxString s_Field; // Formated String for Output
@@ -268,14 +274,14 @@ public:
int i_dbDataType; // conversion of the 'sqlDataType' to the generic data type used by these classes
SWORD i_sqlDataType;
wxColFor();
~wxColFor();
wxDbColFor();
~wxDbColFor();
int Format(int Nation, int dbDataType, SWORD sqlDataType, short columnSize, short decimalDigits);
};
class WXDLLEXPORT wxColInf
class WXDLLEXPORT wxDbColInf
{
public:
char catalog[128+1];
@@ -296,39 +302,41 @@ public:
char PkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Tables that use this PKey as a FKey
int FkCol; // Foreign key column 0=No; 1= First Key, 2 = Second Key etc.
char FkTableName[DB_MAX_TABLE_NAME_LEN+1]; // Foreign key table name
wxColFor *pColFor; // How should this columns be formatted
wxDbColFor *pColFor; // How should this columns be formatted
};
class WXDLLEXPORT wxTableInf // Description of a Table
class WXDLLEXPORT wxDbTableInf // Description of a Table
{
public:
char tableName[DB_MAX_TABLE_NAME_LEN+1];
char tableType[254+1]; // "TABLE" or "SYSTEM TABLE" etc.
char tableRemarks[254+1];
int numCols; // How many Columns does this Table have: GetColumnCount(..);
wxColInf *pColInf; // pColInf = NULL ; User can later call GetColumns(..);
char tableName[DB_MAX_TABLE_NAME_LEN+1];
char tableType[254+1]; // "TABLE" or "SYSTEM TABLE" etc.
char tableRemarks[254+1];
int numCols; // How many Columns does this Table have: GetColumnCount(..);
wxDbColInf *pColInf; // pColInf = NULL ; User can later call GetColumns(..);
};
class WXDLLEXPORT wxDbInf // Description of a Database
{
public:
char catalog[128+1];
char schema[128+1];
int numTables; // How many tables does this database have
wxTableInf *pTableInf; // pTableInf = new wxTableInf[numTables];
char catalog[128+1];
char schema[128+1];
int numTables; // How many tables does this database have
wxDbTableInf *pTableInf; // pTableInf = new wxDbTableInf[numTables];
};
enum wxSqlLogState
enum wxDbSqlLogState
{
sqlLogOFF,
sqlLogON
};
// These are the databases currently tested and working with these classes
// See the comments in wxDB::Dbms() for exceptions/issues with
// See the comments in wxDb::Dbms() for exceptions/issues with
// each of these database engines
enum wxDBMS
{
@@ -341,21 +349,22 @@ enum wxDBMS
dbmsPOSTGRES,
dbmsACCESS,
dbmsDBASE,
dbmsINFORMIX
dbmsINFORMIX,
dbmsVIRTUOSO
};
// The wxDB::errorList is copied to this variable when the wxDB object
// The wxDb::errorList is copied to this variable when the wxDb object
// is closed. This way, the error list is still available after the
// database object is closed. This is necessary if the database
// connection fails so the calling application can show the operator
// why the connection failed. Note: as each wxDB object is closed, it
// will overwrite the errors of the previously destroyed wxDB object in
// why the connection failed. Note: as each wxDb object is closed, it
// will overwrite the errors of the previously destroyed wxDb object in
// this variable.
extern char DBerrorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN];
class WXDLLEXPORT wxDB
class WXDLLEXPORT wxDb
{
private:
bool dbIsOpen;
@@ -363,16 +372,52 @@ private:
char *uid; // User ID
char *authStr; // Authorization string (password)
FILE *fpSqlLog; // Sql Log file pointer
wxSqlLogState sqlLogState; // On or Off
wxDbSqlLogState sqlLogState; // On or Off
bool fwdOnlyCursors;
// Private member functions
bool getDbInfo(void);
bool getDataTypeInfo(SWORD fSqlType, wxSqlTypeInfo &structSQLTypeInfo);
bool getDataTypeInfo(SWORD fSqlType, wxDbSqlTypeInfo &structSQLTypeInfo);
bool setConnectionOptions(void);
void logError(const char *errMsg, const char *SQLState);
#if !wxODBC_BACKWARD_COMPATABILITY
// ODBC handles
HENV henv; // ODBC Environment handle
HDBC hdbc; // ODBC DB Connection handle
HSTMT hstmt; // ODBC Statement handle
//Error reporting mode
bool silent;
// Number of Ctable objects connected to this db object. FOR INTERNAL USE ONLY!!!
unsigned int nTables;
// Information about logical data types VARCHAR, INTEGER, FLOAT and DATE.
//
// This information is obtained from the ODBC driver by use of the
// SQLGetTypeInfo() function. The key piece of information is the
// type name the data source uses for each logical data type.
// e.g. VARCHAR; Oracle calls it VARCHAR2.
wxDbSqlTypeInfo typeInfVarchar;
wxDbSqlTypeInfo typeInfInteger;
wxDbSqlTypeInfo typeInfFloat;
wxDbSqlTypeInfo typeInfDate;
#endif
public:
#if wxODBC_BACKWARD_COMPATABILITY
// ODBC handles
HENV henv; // ODBC Environment handle
HDBC hdbc; // ODBC DB Connection handle
HSTMT hstmt; // ODBC Statement handle
//Error reporting mode
bool silent;
// Number of Ctable objects connected to this db object. FOR INTERNAL USE ONLY!!!
unsigned int nTables;
#endif
// The following structure contains database information gathered from the
// datasource when the datasource is first opened.
struct
@@ -409,34 +454,29 @@ public:
UDWORD loginTimeout; // Number seconds to wait for a login request
} dbInf;
// ODBC handles
HENV henv; // ODBC Environment handle
HDBC hdbc; // ODBC DB Connection handle
HSTMT hstmt; // ODBC Statement handle
// ODBC Error Inf.
char sqlState[20];
SDWORD nativeError;
char errorMsg[SQL_MAX_MESSAGE_LENGTH];
SWORD cbErrorMsg;
char errorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN];
int DB_STATUS;
wxChar errorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN];
wxChar errorMsg[SQL_MAX_MESSAGE_LENGTH];
SDWORD nativeError;
wxChar sqlState[20];
//Error reporting mode
bool silent;
// Number of Ctable objects connected to this db object
unsigned int nTables;
// Inf. about logical data types VARCHAR, INTEGER, FLOAT and DATE.
// This inf. is obtained from the ODBC driver by use of the
// SQLGetTypeInfo() function. The key piece of inf. is the
#if wxODBC_BACKWARD_COMPATABILITY
// Information about logical data types VARCHAR, INTEGER, FLOAT and DATE.
//
// This information is obtained from the ODBC driver by use of the
// SQLGetTypeInfo() function. The key piece of information is the
// type name the data source uses for each logical data type.
// e.g. VARCHAR; Oracle calls it VARCHAR2.
wxSqlTypeInfo typeInfVarchar, typeInfInteger, typeInfFloat, typeInfDate;
wxDbSqlTypeInfo typeInfVarchar;
wxDbSqlTypeInfo typeInfInteger;
wxDbSqlTypeInfo typeInfFloat;
wxDbSqlTypeInfo typeInfDate;
#endif
// Public member functions
wxDB(HENV &aHenv, bool FwdOnlyCursors=(bool)TRUE);
wxDb(HENV &aHenv, bool FwdOnlyCursors=(bool)TRUE);
bool Open(char *Dsn, char *Uid, char *AuthStr); // Data Source Name, User ID, Password
void Close(void);
bool CommitTrans(void);
@@ -450,12 +490,14 @@ public:
bool GetNext(void);
bool GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SDWORD FAR *cbReturned);
bool Grant(int privileges, const char *tableName, const char *userList = "PUBLIC");
int TranslateSqlState(const char *SQLState);
int TranslateSqlState(const wxChar *SQLState);
wxDbInf *GetCatalog(char *userID);
bool Catalog(const char *userID=NULL, const char *fileName = SQL_CATALOG_FILENAME);
int GetKeyFields(char *tableName, wxColInf* colInf,int nocols);
wxColInf *GetColumns(char *tableName[], const char *userID=NULL);
wxColInf *GetColumns(char *tableName, int *numCols, const char *userID=NULL);
int GetKeyFields(char *tableName, wxDbColInf* colInf, int nocols);
wxDbColInf *GetColumns(char *tableName[], const char *userID=NULL);
wxDbColInf *GetColumns(char *tableName, int *numCols, const char *userID=NULL);
int GetColumnCount(char *tableName, const char *userID=NULL);
char *GetDatabaseName(void) {return dbInf.dbmsName;}
char *GetDataSource(void) {return dsn;}
@@ -465,13 +507,26 @@ public:
HENV GetHENV(void) {return henv;}
HDBC GetHDBC(void) {return hdbc;}
HSTMT GetHSTMT(void) {return hstmt;}
int GetTableCount() {return nTables;}; // number of tables using this connection
wxDbSqlTypeInfo GetTypeInfVarchar(){return typeInfVarchar;}
wxDbSqlTypeInfo GetTypeInfInteger(){return typeInfInteger;}
wxDbSqlTypeInfo GetTypeInfFloat() {return typeInfFloat;}
wxDbSqlTypeInfo GetTypeInfDate() {return typeInfDate;}
bool TableExists(const char *tableName, const char *userID=NULL, const char *path=NULL); // Table name can refer to a table, view, alias or synonym
void LogError(const char *errMsg, const char *SQLState = 0) {logError(errMsg, SQLState);}
bool SqlLog(wxSqlLogState state, const char *filename = SQL_LOG_FILENAME, bool append = FALSE);
bool WriteSqlLog(const char *logMsg);
void SetDebugErrorMessages(bool state) { silent = !state; }
bool SetSqlLogging(wxDbSqlLogState state, const wxChar *filename = SQL_LOG_FILENAME, bool append = FALSE);
bool WriteSqlLog(const wxChar *logMsg);
wxDBMS Dbms(void);
bool FwdOnlyCursors(void) {return fwdOnlyCursors;}
}; // wxDB
bool FwdOnlyCursors(void) {return fwdOnlyCursors;}
// These two functions are provided strictly for use by wxDbTable.
// DO NOT USE THESE FUNCTIONS, OR MEMORY LEAKS MAY OCCUR
void incrementTableCount() { nTables++; return; }
void decrementTableCount() { nTables--; return; }
}; // wxDb
// This structure forms a node in a linked list. The linked list of "DbList" objects
@@ -481,8 +536,8 @@ public:
struct wxDbList
{
wxDbList *PtrPrev; // Pointer to previous item in the list
char Dsn[SQL_MAX_DSN_LENGTH+1]; // Data Source Name
wxDB *PtrDb; // Pointer to the wxDB object
wxChar Dsn[SQL_MAX_DSN_LENGTH+1]; // Data Source Name
wxDb *PtrDb; // Pointer to the wxDb object
bool Free; // Is item free or in use?
wxDbList *PtrNext; // Pointer to next item in the list
};
@@ -494,7 +549,7 @@ class wxTablesInUse : public wxObject
public:
const char *tableName;
ULONG tableID;
class wxDB *pDb;
class wxDb *pDb;
}; // wxTablesInUse
#endif
@@ -502,14 +557,14 @@ class wxTablesInUse : public wxObject
// The following routines allow a user to get new database connections, free them
// for other code segments to use, or close all of them when the application has
// completed.
wxDB WXDLLEXPORT *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS);
bool WXDLLEXPORT wxDbFreeConnection(wxDB *pDb);
wxDb WXDLLEXPORT *wxDbGetConnection(wxDbConnectInf *pDbConfig, bool FwdOnlyCursors=(bool)wxODBC_FWD_ONLY_CURSORS);
bool WXDLLEXPORT wxDbFreeConnection(wxDb *pDb);
void WXDLLEXPORT wxDbCloseConnections(void);
int WXDLLEXPORT wxDbConnectionsInUse(void);
// This function sets the sql log state for all open wxDB objects
bool wxDbSqlLog(wxSqlLogState state, const char *filename = SQL_LOG_FILENAME);
// This function sets the sql log state for all open wxDb objects
bool wxDbSqlLog(wxDbSqlLogState state, const wxChar *filename = SQL_LOG_FILENAME);
#if 0
@@ -527,22 +582,30 @@ bool WXDLLEXPORT wxDbGetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsD
// Change this to 0 to remove use of all deprecated functions
#if 1
#if wxODBC_BACKWARD_COMPATABILITY
//#################################################################################
//############### DEPRECATED functions for backward compatability #################
//#################################################################################
// Backward compability structures/classes. This will eventually go away
typedef wxColInf CcolInf;
typedef wxSqlTypeInfo SqlTypeInfo;
typedef enum wxSqlLogState sqlLog;
typedef enum wxDBMS dbms;
typedef enum wxDBMS DBMS;
typedef wxODBC_ERRORS ODBC_ERRORS;
typedef wxDbConnectInf DbStuff;
typedef wxDbList DbList;
const int DB_PATH_MAX = wxDB_PATH_MAX;
typedef wxDb wxDB;
typedef wxDbTableInf wxTableInf;
typedef wxDbColInf wxColInf;
typedef wxDbColInf CcolInf;
typedef wxDbColFor wxColFor;
typedef wxDbSqlTypeInfo SqlTypeInfo;
typedef wxDbSqlTypeInfo wxSqlTypeInfo;
typedef enum wxDbSqlLogState sqlLog;
typedef enum wxDbSqlLogState wxSqlLogState;
typedef enum wxDBMS dbms;
typedef enum wxDBMS DBMS;
typedef wxODBC_ERRORS ODBC_ERRORS;
typedef wxDbConnectInf DbStuff;
typedef wxDbList DbList;
#ifdef __WXDEBUG__
typedef wxTablesInUse CstructTablesInUse;
typedef wxTablesInUse CstructTablesInUse;
#endif
// Deprecated function names that are replaced by the function names listed above
@@ -551,7 +614,7 @@ bool WXDLLEXPORT FreeDbConnection(wxDB *pDb);
void WXDLLEXPORT CloseDbConnections(void);
int WXDLLEXPORT NumberDbConnectionsInUse(void);
bool SqlLog(sqlLog state, const char *filename = SQL_LOG_FILENAME);
bool SqlLog(sqlLog state, const wxChar *filename = SQL_LOG_FILENAME);
bool WXDLLEXPORT GetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsDesc, SWORD DsDescMax,
UWORD direction = SQL_FETCH_NEXT);

View File

@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////
// Name: dbtable.h
// Purpose: Declaration of the wxTable class.
// Purpose: Declaration of the wxDbTable class.
// Author: Doug Card
// Modified by: George Tasker
// Created: 9.96
@@ -43,20 +43,20 @@
#include "db.h"
#endif
const int ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger
const int DEFAULT_CURSOR = 0;
const bool QUERY_ONLY = TRUE;
const bool DISABLE_VIEW = TRUE;
const int wxDB_ROWID_LEN = 24; // 18 is the max, 24 is in case it gets larger
const int wxDB_DEFAULT_CURSOR = 0;
const bool wxDB_QUERY_ONLY = TRUE;
const bool wxDB_DISABLE_VIEW = TRUE;
// The following class is used to define a column of a table.
// The wxTable constructor will dynamically allocate as many of
// The wxDbTable constructor will dynamically allocate as many of
// these as there are columns in the table. The class derived
// from wxTable must initialize these column definitions in it's
// from wxDbTable must initialize these column definitions in it's
// constructor. These column definitions provide inf. to the
// wxTable class which allows it to create a table in the data
// wxDbTable class which allows it to create a table in the data
// source, exchange data between the data source and the C++
// object, and so on.
class WXDLLEXPORT wxColDef
class WXDLLEXPORT wxDbColDef
{
public:
char ColName[DB_MAX_COLUMN_NAME_LEN+1]; // Column Name
@@ -70,34 +70,35 @@ public:
bool DerivedCol; // Specifies whether this column is a derived value
SDWORD CbValue; // Internal use only!!!
bool Null; // NOT FULLY IMPLEMENTED - Allows NULL values in Inserts and Updates
}; // wxColDef
}; // wxDbColDef
class WXDLLEXPORT wxColDataPtr
class WXDLLEXPORT wxDbColDataPtr
{
public:
void *PtrDataObj;
int SzDataObj;
int SqlCtype;
}; // wxColDataPtr
}; // wxDbColDataPtr
// This structure is used when creating secondary indexes.
class WXDLLEXPORT wxIdxDef
class WXDLLEXPORT wxDbIdxDef
{
public:
char ColName[DB_MAX_COLUMN_NAME_LEN+1];
bool Ascending;
}; // wxIdxDef
}; // wxDbIdxDef
class WXDLLEXPORT wxTable
class WXDLLEXPORT wxDbTable
{
private:
ULONG tableID; // Used for debugging. This can help to match up mismatched constructors/destructors
// Private member variables
UDWORD cursorType;
bool insertable;
// Private member functions
bool bindInsertParams(void);
@@ -106,117 +107,209 @@ private:
bool getRec(UWORD fetchType);
bool execDelete(const char *pSqlStmt);
bool execUpdate(const char *pSqlStmt);
bool query(int queryType, bool forUpdate, bool distinct, char *pSqlStmt = 0);
bool query(int queryType, bool forUpdate, bool distinct, const char *pSqlStmt = 0);
public:
// Pointer to the database object this table belongs to
wxDB *pDb;
#if !wxODBC_BACKWARD_COMPATABILITY
// these were public
// Where, Order By and From clauses
wxString where; // Standard SQL where clause, minus the word WHERE
wxString orderBy; // Standard SQL order by clause, minus the ORDER BY
wxString from; // Allows for joins in a wxDbTable::Query(). Format: ",tbl,tbl..."
// ODBC Handles
HENV henv; // ODBC Environment handle
HDBC hdbc; // ODBC DB Connection handle
HSTMT hstmt; // ODBC Statement handle
HSTMT *hstmtDefault; // Default cursor
HSTMT hstmtInsert; // ODBC Statement handle used specifically for inserts
HSTMT hstmtDelete; // ODBC Statement handle used specifically for deletes
HSTMT hstmtUpdate; // ODBC Statement handle used specifically for updates
HSTMT hstmtInternal; // ODBC Statement handle used internally only
HSTMT *hstmtCount; // ODBC Statement handle used by Count() function (No binding of columns)
// Table Inf.
char tableName[DB_MAX_TABLE_NAME_LEN+1]; // Table name
char queryTableName[DB_MAX_TABLE_NAME_LEN+1]; // Query Table Name
int noCols; // # of columns in the table
bool queryOnly; // Query Only, no inserts, updates or deletes
char tablePath[DB_PATH_MAX]; // needed for dBase tables
// Column Definitions
wxColDef *colDefs; // Array of wxColDef structures
// Where, Order By and From clauses
char *where; // Standard SQL where clause, minus the word WHERE
char *orderBy; // Standard SQL order by clause, minus the ORDER BY
char *from; // Allows for joins in a wxTable::Query(). Format: ",tbl,tbl..."
HENV henv; // ODBC Environment handle
HDBC hdbc; // ODBC DB Connection handle
HSTMT hstmt; // ODBC Statement handle
HSTMT *hstmtDefault; // Default cursor
HSTMT hstmtInsert; // ODBC Statement handle used specifically for inserts
HSTMT hstmtDelete; // ODBC Statement handle used specifically for deletes
HSTMT hstmtUpdate; // ODBC Statement handle used specifically for updates
HSTMT hstmtInternal; // ODBC Statement handle used internally only
HSTMT *hstmtCount; // ODBC Statement handle used by Count() function (No binding of columns)
// Flags
bool selectForUpdate;
bool selectForUpdate;
// Pointer to the database object this table belongs to
wxDb *pDb;
// Table Inf.
char tablePath[wxDB_PATH_MAX]; // needed for dBase tables
char tableName[DB_MAX_TABLE_NAME_LEN+1]; // Table name
char queryTableName[DB_MAX_TABLE_NAME_LEN+1]; // Query Table Name
int noCols; // # of columns in the table
bool queryOnly; // Query Only, no inserts, updates or deletes
// Column Definitions
wxDbColDef *colDefs; // Array of wxDbColDef structures
#endif
public:
#if wxODBC_BACKWARD_COMPATABILITY
// Where, Order By and From clauses
char *where; // Standard SQL where clause, minus the word WHERE
char *orderBy; // Standard SQL order by clause, minus the ORDER BY
char *from; // Allows for joins in a wxDbTable::Query(). Format: ",tbl,tbl..."
// ODBC Handles
HENV henv; // ODBC Environment handle
HDBC hdbc; // ODBC DB Connection handle
HSTMT hstmt; // ODBC Statement handle
HSTMT *hstmtDefault; // Default cursor
HSTMT hstmtInsert; // ODBC Statement handle used specifically for inserts
HSTMT hstmtDelete; // ODBC Statement handle used specifically for deletes
HSTMT hstmtUpdate; // ODBC Statement handle used specifically for updates
HSTMT hstmtInternal; // ODBC Statement handle used internally only
HSTMT *hstmtCount; // ODBC Statement handle used by Count() function (No binding of columns)
// Flags
bool selectForUpdate;
// Pointer to the database object this table belongs to
wxDb *pDb;
// Table Inf.
char tablePath[wxDB_PATH_MAX]; // needed for dBase tables
char tableName[DB_MAX_TABLE_NAME_LEN+1]; // Table name
char queryTableName[DB_MAX_TABLE_NAME_LEN+1]; // Query Table Name
int noCols; // # of columns in the table
bool queryOnly; // Query Only, no inserts, updates or deletes
// Column Definitions
wxDbColDef *colDefs; // Array of wxDbColDef structures
#endif
// Public member functions
wxTable(wxDB *pwxDB, const char *tblName, const int nCols,
const char *qryTblName = 0, bool qryOnly = !QUERY_ONLY, const char *tblPath=NULL);
virtual ~wxTable();
bool Open(void);
bool CreateTable(bool attemptDrop=TRUE);
bool DropTable(void);
bool CreateIndex(const char * idxName, bool unique, int noIdxCols, wxIdxDef *pIdxDefs, bool attemptDrop=TRUE);
bool DropIndex(const char * idxName);
bool CloseCursor(HSTMT cursor);
int Insert(void);
bool Update(void);
bool Update(const char *pSqlStmt);
bool UpdateWhere(const char *pWhereClause);
bool Delete(void);
bool DeleteWhere(const char *pWhereClause);
bool DeleteMatching(void);
virtual bool Query(bool forUpdate = FALSE, bool distinct = FALSE);
bool QueryBySqlStmt(char *pSqlStmt);
bool QueryMatching(bool forUpdate = FALSE, bool distinct = FALSE);
bool QueryOnKeyFields(bool forUpdate = FALSE, bool distinct = FALSE);
bool GetNext(void) { return(getRec(SQL_FETCH_NEXT)); }
bool operator++(int) { return(getRec(SQL_FETCH_NEXT)); }
wxDbTable(wxDb *pwxDb, const char *tblName, const int nCols,
const char *qryTblName = 0, bool qryOnly = !wxDB_QUERY_ONLY, const char *tblPath=NULL);
virtual ~wxDbTable();
/***** These four functions only work with wxDB instances that are defined *****
bool Open(void);
bool CreateTable(bool attemptDrop=TRUE);
bool DropTable(void);
bool CreateIndex(const char * idxName, bool unique, int noIdxCols, wxDbIdxDef *pIdxDefs, bool attemptDrop=TRUE);
bool DropIndex(const char * idxName);
// Accessors
// The member variables returned by these accessors are all
// set when the wxDbTable instance is createand cannot be
// changed, hence there is no corresponding SetXxxx function
wxDb *GetDb() { return pDb; }
const char *GetTableName() { return tableName; }
const char *GetQueryTableName() { return queryTableName; }
const char *GetTablePath() { return tablePath; }
int GetNumberOfColumns() { return noCols; } // number of "defined" columns for this wxDbTable instance
const char *GetFromClause() { return from; }
const char *GetOrderByClause() { return orderBy; }
const char *GetWhereClause() { return where; }
bool IsQueryOnly() { return queryOnly; }
#if wxODBC_BACKWARD_COMPATABILITY
void SetFromClause(const char *From) { from = (char *)From; }
void SetOrderByClause(const char *OrderBy) { orderBy = (char *)OrderBy; }
void SetWhereClause(const char *Where) { where = (char *)Where; }
#else
void SetFromClause(const wxString& From) { from = From; }
void SetOrderByClause(const wxString& OrderBy) { orderBy = OrderBy; }
void SetWhereClause(const wxString& Where) { where = Where; }
#endif
int Insert(void);
bool Update(void);
bool Update(const char *pSqlStmt);
bool UpdateWhere(const char *pWhereClause);
bool Delete(void);
bool DeleteWhere(const char *pWhereClause);
bool DeleteMatching(void);
virtual bool Query(bool forUpdate = FALSE, bool distinct = FALSE);
bool QueryBySqlStmt(const char *pSqlStmt);
bool QueryMatching(bool forUpdate = FALSE, bool distinct = FALSE);
bool QueryOnKeyFields(bool forUpdate = FALSE, bool distinct = FALSE);
bool Refresh(void);
bool GetNext(void) { return(getRec(SQL_FETCH_NEXT)); }
bool operator++(int) { return(getRec(SQL_FETCH_NEXT)); }
/***** These four functions only work with wxDb instances that are defined *****
***** as not being FwdOnlyCursors *****/
bool GetPrev(void);
bool operator--(int);
bool GetFirst(void);
bool GetLast(void);
bool GetPrev(void);
bool operator--(int);
bool GetFirst(void);
bool GetLast(void);
bool IsCursorClosedOnCommit(void);
bool IsColNull(int colNo);
UWORD GetRowNum(void);
void GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct);
void GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause = 0);
void GetUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause = 0);
void GetWhereClause(char *pWhereClause, int typeOfWhere, const char *qualTableName = 0, bool useLikeComparison=FALSE);
bool CanSelectForUpdate(void);
bool CanUpdByROWID(void);
void ClearMemberVars(void);
bool SetQueryTimeout(UDWORD nSeconds);
void SetColDefs (int index, const char *fieldName, int dataType, void *pData, int cType,
int size, bool keyField = FALSE, bool upd = TRUE,
bool insAllow = TRUE, bool derivedCol = FALSE);
wxColDataPtr* SetColDefs (wxColInf *colInfs, ULONG numCols);
bool IsCursorClosedOnCommit(void);
UWORD GetRowNum(void);
HSTMT *NewCursor(bool setCursor = FALSE, bool bindColumns = TRUE);
bool DeleteCursor(HSTMT *hstmtDel);
void SetCursor(HSTMT *hstmtActivate = (void **) DEFAULT_CURSOR);
HSTMT GetCursor(void) { return(hstmt); }
ULONG Count(const char *args="*");
int DB_STATUS(void) { return(pDb->DB_STATUS); }
bool Refresh(void);
bool SetNull(int colNo);
bool SetNull(const char *colName);
void BuildSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct);
void BuildDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause = 0);
void BuildUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause = 0);
void BuildWhereClause(char *pWhereClause, int typeOfWhere, const char *qualTableName = 0, bool useLikeComparison=FALSE);
#if wxODBC_BACKWARD_COMPATABILITY
// The following member functions are deprecated. You should use the BuildXxxxxStmt functions (above)
void GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct)
{ BuildSelectStmt(pSqlStmt,typeOfSelect,distinct); }
void GetDeleteStmt(char *pSqlStmt, int typeOfDel, const char *pWhereClause = 0)
{ BuildDeleteStmt(pSqlStmt,typeOfDel,pWhereClause); }
void GetUpdateStmt(char *pSqlStmt, int typeOfUpd, const char *pWhereClause = 0)
{ BuildUpdateStmt(pSqlStmt,typeOfUpd,pWhereClause); }
void GetWhereClause(char *pWhereClause, int typeOfWhere,
const char *qualTableName = 0, bool useLikeComparison=FALSE)
{ BuildWhereClause(pWhereClause,typeOfWhere,qualTableName,useLikeComparison); }
#endif
bool CanSelectForUpdate(void);
bool CanUpdByROWID(void);
void ClearMemberVars(void);
bool SetQueryTimeout(UDWORD nSeconds);
#ifdef __WXDEBUG__
ULONG GetTableID() { return tableID; };
wxDbColDef *GetColDefs() { return colDefs; }
void SetColDefs(int index, const char *fieldName, int dataType, void *pData, int cType,
int size, bool keyField = FALSE, bool upd = TRUE,
bool insAllow = TRUE, bool derivedCol = FALSE);
wxDbColDataPtr *SetColDefs(wxDbColInf *colInfs, ULONG numCols);
bool CloseCursor(HSTMT cursor);
bool DeleteCursor(HSTMT *hstmtDel);
void SetCursor(HSTMT *hstmtActivate = (void **) wxDB_DEFAULT_CURSOR);
HSTMT GetCursor(void) { return(hstmt); }
HSTMT *GetNewCursor(bool setCursor = FALSE, bool bindColumns = TRUE);
#if wxODBC_BACKWARD_COMPATABILITY
// The following member function is deprecated. You should use the GetNewCursor
HSTMT *NewCursor(bool setCursor = FALSE, bool bindColumns = TRUE) { return GetNewCursor(setCursor,bindColumns); }
#endif
}; // wxTable
ULONG Count(const char *args="*");
int DB_STATUS(void) { return(pDb->DB_STATUS); }
bool IsColNull(int colNo);
bool SetNull(int colNo);
bool SetNull(const char *colName);
#ifdef __WXDEBUG__
ULONG GetTableID() { return tableID; }
#endif
}; // wxDbTable
// Change this to 0 to remove use of all deprecated functions
#if 1
#if wxODBC_BACKWARD_COMPATABILITY
//#################################################################################
//############### DEPRECATED functions for backward compatability #################
//#################################################################################
// Backward compability. These will eventually go away
typedef wxColDef CcolDef;
typedef wxColDataPtr CcolDataPtr;
typedef wxIdxDef CidxDef;
typedef wxDbTable wxTable;
typedef wxDbIdxDef wxIdxDef;
typedef wxDbIdxDef CidxDef;
typedef wxDbColDef wxColDef;
typedef wxDbColDef CcolDef;
typedef wxDbColDataPtr wxColDataPtr;
typedef wxDbColDataPtr CcolDataPtr;
const int ROWID = wxDB_ROWID_LEN;
const int DEFAULT_CURSOR = wxDB_DEFAULT_CURSOR;
const bool QUERY_ONLY = wxDB_QUERY_ONLY;
const bool DISABLE_VIEW = wxDB_DISABLE_VIEW;
#endif
#endif

View File

@@ -49,7 +49,7 @@ public:
m_clipping = FALSE;
m_ok = TRUE;
m_minX = m_minY = m_maxX = m_maxY = 0;
ResetBoundingBox();
m_signX = m_signY = 1;
@@ -330,6 +330,7 @@ public:
// ---------
// const...
int GetBackgroundMode() const { return m_backgroundMode; }
const wxBrush& GetBackground() const { return m_backgroundBrush; }
const wxBrush& GetBrush() const { return m_brush; }
const wxFont& GetFont() const { return m_font; }
@@ -400,10 +401,29 @@ public:
virtual void CalcBoundingBox(wxCoord x, wxCoord y)
{
if ( x < m_minX ) m_minX = x;
if ( y < m_minY ) m_minY = y;
if ( x > m_maxX ) m_maxX = x;
if ( y > m_maxY ) m_maxY = y;
if ( m_isBBoxValid )
{
if ( x < m_minX ) m_minX = x;
if ( y < m_minY ) m_minY = y;
if ( x > m_maxX ) m_maxX = x;
if ( y > m_maxY ) m_maxY = y;
}
else
{
m_isBBoxValid = TRUE;
m_minX = x;
m_minY = y;
m_maxX = x;
m_maxY = y;
}
}
void ResetBoundingBox()
{
m_isBBoxValid = FALSE;
m_minX = m_maxX = m_minY = m_maxY = 0;
}
// Get the final bounding box of the PostScript or Metafile picture.
@@ -577,6 +597,7 @@ protected:
bool m_ok:1;
bool m_clipping:1;
bool m_isInteractive:1;
bool m_isBBoxValid:1;
// coordinate system variables

View File

@@ -43,6 +43,10 @@
// ----------------------------------------------------------------------------
//@{
// Use of these suppresses compiler warnings about testing constant expression
WXDLLEXPORT_DATA(extern const bool) wxTrue;
WXDLLEXPORT_DATA(extern const bool) wxFalse;
/** @name Macros which are completely disabled in 'release' mode */
//@{
#ifdef __WXDEBUG__
@@ -58,15 +62,8 @@
/// generic assert macro
#define wxASSERT(cond) if ( !(cond) ) wxOnAssert(__TFILE__, __LINE__)
#if 0 // defined(__BORLANDC__) && defined(__WIN16__)
// Too much text, so make wxASSERT_MSG the same as wxASSERT,
// thus removing the text from the program.
#define wxASSERT_MSG(x, m) if ( !(x) ) wxOnAssert(__TFILE__, __LINE__)
#else
/// assert with additional message explaining it's cause
#define wxASSERT_MSG(x, m) if ( !(x) ) wxOnAssert(__TFILE__, __LINE__, m)
#endif
#else
// nothing to do in release modes (hopefully at this moment there are
// no more bugs ;-)
@@ -74,17 +71,11 @@
#define wxASSERT_MSG(x, m)
#endif //__WXDEBUG__
/// special form of assert: always triggers it (in debug mode)
/// special form of assert: always triggers it (in debug mode)
#define wxFAIL wxASSERT(wxFalse)
#if 0 // defined(__BORLANDC__) && defined(__WIN16__)
// Too much text, so make wxFAIL_MSG the same as wxFAIL,
// thus removing the text from the program.
#define wxFAIL_MSG(msg) wxASSERT(wxFalse)
#else
/// FAIL with some message
/// FAIL with some message
#define wxFAIL_MSG(msg) wxASSERT_MSG(wxFalse, msg)
#endif
//@}
// NB: these macros work also in release mode!

View File

@@ -22,8 +22,8 @@
// OS: first test for generic Unix defines, then for particular flavours and
// finally for Unix-like systems
#if defined(__unix) || defined(__unix__) || defined(____SVR4____) || \
defined(__LINUX__) || defined(__sgi) || \
#if defined(__UNIX__) || defined(__unix) || defined(__unix__) || \
defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) || \
defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) || \
defined(__EMX__) || defined(__VMS) || defined(__BEOS__)
@@ -48,6 +48,10 @@
#endif
#endif // Sun
#ifdef __EMX__
#define OS2EMX_PLAIN_CHAR
#endif
#elif defined(applec) || defined(THINK_C) || ( defined( __MWERKS__ ) && !defined(__INTEL__) )
// MacOS
#elif defined(__OS2__)
@@ -380,25 +384,8 @@ typedef int wxWindowID;
#if defined(__WXMSW__)
// _declspec works in BC++ 5 and later, as well as VC++
#if defined(__VISUALC__) || defined(__BORLANDC__)
# ifdef WXMAKINGDLL
# define WXDLLEXPORT _declspec( dllexport )
# define WXDLLEXPORT_DATA(type) _declspec( dllexport ) type
# define WXDLLEXPORT_CTORFN
# elif defined(WXUSINGDLL)
# define WXDLLEXPORT _declspec( dllimport )
# define WXDLLEXPORT_DATA(type) _declspec( dllimport ) type
# define WXDLLEXPORT_CTORFN
# else
# define WXDLLEXPORT
# define WXDLLEXPORT_DATA(type) type
# define WXDLLEXPORT_CTORFN
# endif
#elif defined(__GNUC__)
// __declspec works in BC++ 5 and later, as well as VC++ and gcc
#if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__GNUC__)
# ifdef WXMAKINGDLL
# define WXDLLEXPORT __declspec( dllexport )
# define WXDLLEXPORT_DATA(type) __declspec( dllexport ) type
@@ -412,34 +399,46 @@ typedef int wxWindowID;
# define WXDLLEXPORT_DATA(type) type
# define WXDLLEXPORT_CTORFN
# endif
#elif defined(__WXPM__)
# ifdef WXMAKINGDLL
# define WXDLLEXPORT _Export
# define WXDLLEXPORT_DATA(type) _Export type
# define WXDLLEXPORT_CTORFN
# elif defined(WXUSINGDLL)
# define WXDLLEXPORT _Export
# define WXDLLEXPORT_DATA(type) _Export type
# define WXDLLEXPORT_CTORFN
# else
#else
# define WXDLLEXPORT
# define WXDLLEXPORT_DATA(type) type
# define WXDLLEXPORT_CTORFN
# endif
#else
# define WXDLLEXPORT
# define WXDLLEXPORT_DATA(type) type
# define WXDLLEXPORT_CTORFN
#endif
#else // !Windows
#elif defined(__WXPM__)
# if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
# ifdef WXMAKINGDLL
# define WXDLLEXPORT _Export
# define WXDLLEXPORT_DATA(type) _Export type
# define WXDLLEXPORT_CTORFN
# elif defined(WXUSINGDLL)
# define WXDLLEXPORT _Export
# define WXDLLEXPORT_DATA(type) _Export type
# define WXDLLEXPORT_CTORFN
# else
# define WXDLLEXPORT
# define WXDLLEXPORT_DATA(type) type
# define WXDLLEXPORT_CTORFN
# endif
# else
# define WXDLLEXPORT
# define WXDLLEXPORT_DATA(type) type
# define WXDLLEXPORT_CTORFN
# endif
#else // !(MSW or OS2)
# define WXDLLEXPORT
# define WXDLLEXPORT_DATA(type) type
# define WXDLLEXPORT_CTORFN
#endif // Win/!Win
#endif
// For ostream, istream ofstream
#if defined(__BORLANDC__) && defined( _RTLDLL )
@@ -456,8 +455,12 @@ class WXDLLEXPORT wxEvent;
#define wxNOT_FOUND (-1)
// ----------------------------------------------------------------------------
/** @name Very common macros */
// Very common macros
// ----------------------------------------------------------------------------
// everybody gets the assert and other debug macros
#include "wx/debug.h"
//@{
/// delete pointer if it is not NULL and NULL it afterwards
// (checking that it's !NULL before passing it to delete is just a
@@ -489,10 +492,6 @@ class WXDLLEXPORT wxEvent;
/// size of statically declared array
#define WXSIZEOF(array) (sizeof(array)/sizeof(array[0]))
// Use of these suppresses some compiler warnings
WXDLLEXPORT_DATA(extern const bool) wxTrue;
WXDLLEXPORT_DATA(extern const bool) wxFalse;
// ----------------------------------------------------------------------------
// compiler specific settings
// ----------------------------------------------------------------------------
@@ -519,9 +518,13 @@ WXDLLEXPORT_DATA(extern const bool) wxFalse;
// where should i put this? we need to make sure of this as it breaks
// the <iostream> code.
#if !wxUSE_IOSTREAMH && defined(__WXDEBUG__)
#ifndef __MWERKS__
#undef __WXDEBUG__
#endif
# ifndef __MWERKS__
// #undef __WXDEBUG__
# ifdef wxUSE_DEBUG_NEW_ALWAYS
# undef wxUSE_DEBUG_NEW_ALWAYS
# define wxUSE_DEBUG_NEW_ALWAYS 0
# endif
# endif
#endif
// Callback function type definition
@@ -893,16 +896,21 @@ enum wxStretch
#define wxICONIZE 0x4000
#define wxMINIMIZE wxICONIZE
#define wxMAXIMIZE 0x2000
#define wxTHICK_FRAME 0x1000
// free value: 0x1000
#define wxSYSTEM_MENU 0x0800
#define wxMINIMIZE_BOX 0x0400
#define wxMAXIMIZE_BOX 0x0200
#define wxTINY_CAPTION_HORIZ 0x0100
#define wxTINY_CAPTION_VERT 0x0080
#define wxRESIZE_BOX wxMAXIMIZE_BOX
#define wxRESIZE_BORDER 0x0040
// deprecated versions defined for compatibility reasons
#define wxRESIZE_BOX wxMAXIMIZE_BOX
#define wxTHICK_FRAME wxRESIZE_BORDER
#define wxDIALOG_MODAL 0x0020
#define wxDIALOG_MODELESS 0x0000
// Add for normal Windows frame behaviour
#define wxFRAME_FLOAT_ON_PARENT 0x0020
@@ -918,14 +926,16 @@ enum wxStretch
#endif
#define wxDEFAULT_FRAME_STYLE \
(wxSYSTEM_MENU | wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN)
(wxSYSTEM_MENU | wxRESIZE_BORDER | \
wxMINIMIZE_BOX | wxMAXIMIZE_BOX | \
wxCAPTION | wxCLIP_CHILDREN)
#ifdef __WXMSW__
# define wxDEFAULT_DIALOG_STYLE (wxSYSTEM_MENU|wxCAPTION|wxTHICK_FRAME)
# define wxDEFAULT_DIALOG_STYLE (wxSYSTEM_MENU | wxCAPTION)
#else
// Under Unix, the dialogs don't have a system menu. Specifying
// wxSYSTEM_MENU here, will make a close button appear.
# define wxDEFAULT_DIALOG_STYLE (wxCAPTION|wxTHICK_FRAME)
// Under Unix, the dialogs don't have a system menu. Specifying wxSYSTEM_MENU
// here will make a close button appear.
# define wxDEFAULT_DIALOG_STYLE wxCAPTION
#endif
/*
@@ -1062,6 +1072,10 @@ enum wxStretch
*/
#define wxBU_AUTODRAW 0x0004
#define wxBU_NOAUTODRAW 0x0000
#define wxBU_LEFT 0x0040
#define wxBU_TOP 0x0080
#define wxBU_RIGHT 0x0100
#define wxBU_BOTTOM 0x0200
/*
* wxTreeCtrl flags
@@ -1118,10 +1132,14 @@ enum wxStretch
* wxSplitterWindow flags
*/
#define wxSP_NOBORDER 0x0000
#define wxSP_3D 0x0010
#define wxSP_NOSASH 0x0010
#define wxSP_BORDER 0x0020
#define wxSP_PERMIT_UNSPLIT 0x0040
#define wxSP_LIVE_UPDATE 0x0080
#define wxSP_3DSASH 0x0100
#define wxSP_3DBORDER 0x0200
#define wxSP_FULLSASH 0x0400
#define wxSP_3D (wxSP_3DBORDER | wxSP_3DSASH)
/*
* wxFrame extra flags
@@ -1678,27 +1696,27 @@ typedef enum {
#ifdef __WXMAC__
typedef WindowPtr WXHWND;
typedef Handle WXHANDLE;
typedef CIconHandle WXHICON;
typedef Handle WXHANDLE;
typedef CIconHandle WXHICON;
//typedef unsigned long WXHFONT;
typedef MenuHandle WXHMENU;
typedef MenuHandle WXHMENU;
//typedef unsigned long WXHPEN;
//typedef unsigned long WXHBRUSH;
//typedef unsigned long WXHPALETTE;
typedef CursHandle WXHCURSOR;
typedef CursHandle WXHCURSOR;
typedef RgnHandle WXHRGN;
//typedef unsigned long WXHACCEL;
//typedef unsigned long WXHINSTANCE;
typedef GWorldPtr WXHBITMAP;
typedef GWorldPtr WXHBITMAP;
//typedef unsigned long WXHIMAGELIST;
//typedef unsigned long WXHGLOBAL;
typedef GrafPtr WXHDC;
typedef GrafPtr WXHDC;
typedef unsigned int WXUINT;
typedef unsigned long WXDWORD;
typedef unsigned short WXWORD;
//typedef unsigned int WXWPARAM;
//typedef long WXLPARAM;
typedef RGBColor WXCOLORREF;
typedef RGBColor WXCOLORREF;
//typedef void * WXRGNDATA;
//typedef void * WXMSG;
//typedef unsigned long WXHCONV;
@@ -1708,12 +1726,26 @@ typedef RGBColor WXCOLORREF;
//typedef void * WXLPCREATESTRUCT;
typedef int (*WXFARPROC)();
typedef WindowPtr WXWindow;
typedef ControlHandle WXWidget;
typedef WindowPtr WXWindow;
typedef ControlHandle WXWidget;
#endif
#if defined(__WXMSW__) || defined(__WXPM__)
// the keywords needed for WinMain() declaration
#ifdef __WIN16__
# ifdef __VISUALC__
# define WXFAR __far
# else
# define WXFAR _far
# endif
#else // Win32
# ifndef WXFAR
# define WXFAR
# endif
#endif // Win16/32
// Stand-ins for Windows types or OS/2, to avoid #including all of windows.h or os2.h
typedef unsigned long WXHWND;
typedef unsigned long WXHANDLE;
@@ -1726,7 +1758,7 @@ typedef unsigned long WXHPALETTE;
typedef unsigned long WXHCURSOR;
typedef unsigned long WXHRGN;
typedef unsigned long WXHACCEL;
typedef unsigned long WXHINSTANCE;
typedef void WXFAR * WXHINSTANCE;
typedef unsigned long WXHBITMAP;
typedef unsigned long WXHIMAGELIST;
typedef unsigned long WXHGLOBAL;
@@ -1814,29 +1846,15 @@ typedef struct tagLOGPALETTE
typedef WXHWND WXWidget;
#if defined(__BORLANDC__) && !defined(__WIN32__)
#ifndef LPTSTR
#define LPTSTR LPSTR
#endif
#ifndef LPCTSTR
#define LPCTSTR LPSTR
#endif
# ifndef LPTSTR
# define LPTSTR LPSTR
# endif
# ifndef LPCTSTR
# define LPCTSTR LPSTR
# endif
#endif
// the keywords needed for WinMain() declaration
#ifdef __WIN16__
#ifdef __VISUALC__
#define WXFAR __far
#else // !VC++
#define WXFAR _far
#endif
#else // Win32
#ifndef WXFAR
#define WXFAR
#endif
#endif // Win16/32
#endif // MSW
#endif // MSW or OS2
#ifdef __WXMOTIF__
/* Stand-ins for X/Xt/Motif types */
@@ -1862,6 +1880,8 @@ typedef unsigned long Atom; /* this might fail on a few architectures */
#ifdef __WXGTK__
/* Stand-ins for GLIB types */
typedef char gchar;
typedef signed char gint8;
typedef int gint;
typedef unsigned guint;
typedef unsigned long gulong;

View File

@@ -27,7 +27,6 @@ public:
void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
int GetReturnCode() const { return m_returnCode; }
protected:
// splits text up at newlines and places the
// lines into a vertical wxBoxSizer
wxSizer *CreateTextSizer( const wxString &message );
@@ -35,6 +34,7 @@ protected:
// places buttons into a horizontal wxBoxSizer
wxSizer *CreateButtonSizer( long flags );
protected:
// the return code from modal dialog
int m_returnCode;
};

View File

@@ -24,7 +24,7 @@
class WXDLLEXPORT wxArrayString;
extern const wxChar *wxEmptyString;
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
#define WXDIALUP_MANAGER_DEFAULT_BEACONHOST wxT("www.yahoo.com")

View File

@@ -17,7 +17,6 @@
#endif
#include "wx/defs.h"
#include "wx/debug.h"
/** @name Dynamic arrays and object arrays (array which own their elements)
@memo Arrays which grow on demand and do range checking (only in debug)
@@ -304,7 +303,8 @@ public: \
void Insert(const T* pItem, size_t uiIndex) \
{ wxBaseArray::Insert((long)pItem, uiIndex); } \
\
void Empty(); \
void Empty() { DoEmpty(); wxBaseArray::Empty(); } \
void Clear() { DoEmpty(); wxBaseArray::Clear(); } \
\
T* Detach(size_t uiIndex) \
{ T* p = (T*)wxBaseArray::Item(uiIndex); \
@@ -315,6 +315,7 @@ public: \
void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); } \
\
private: \
void DoEmpty(); \
void DoCopy(const name& src); \
}

View File

@@ -94,6 +94,9 @@ public:
*/
static void * GetSymbol(wxDllType dllHandle, const wxString &name);
// return the standard DLL extension (with leading dot) for this platform
static wxString GetDllExt();
private:
/// forbid construction of objects
wxDllLoader();

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: encconv.h
// Name: wx/encconv.h
// Purpose: wxEncodingConverter class for converting between different
// font encodings
// Author: Vaclav Slavik
@@ -7,26 +7,31 @@
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __ENCCONV_H__
#define __ENCCONV_H__
#ifndef _WX_ENCCONV_H_
#define _WX_ENCCONV_H_
#ifdef __GNUG__
#pragma interface "encconv.h"
#endif
#include "wx/defs.h"
#include "wx/font.h"
#include "wx/object.h"
#include "wx/fontenc.h"
#include "wx/dynarray.h"
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
enum {
enum
{
wxCONVERT_STRICT,
wxCONVERT_SUBSTITUTE
};
enum {
enum
{
wxPLATFORM_CURRENT = -1,
wxPLATFORM_UNIX = 0,
@@ -35,8 +40,11 @@ enum {
wxPLATFORM_MAC
};
WX_DEFINE_ARRAY(wxFontEncoding, wxFontEncodingArray);
// ----------------------------------------------------------------------------
// types
// ----------------------------------------------------------------------------
WX_DEFINE_ARRAY(wxFontEncoding, wxFontEncodingArray);
//--------------------------------------------------------------------------------
// wxEncodingConverter
@@ -52,7 +60,7 @@ class WXDLLEXPORT wxEncodingConverter : public wxObject
~wxEncodingConverter() { if (m_Table) delete[] m_Table; }
// Initialize convertion. Both output or input encoding may
// be wxFONTENCODING_UNICODE, but only if wxUSE_UNICODE is set to 1.
// be wxFONTENCODING_UNICODE, but only if wxUSE_WCHAR_T is set to 1.
//
// All subsequent calls to Convert() will interpret it's argument
// as a string in input_enc encoding and will output string in
@@ -82,15 +90,15 @@ class WXDLLEXPORT wxEncodingConverter : public wxObject
// Convert input string according to settings passed to Init.
// Note that you must call Init before using Convert!
void Convert(const wxChar* input, wxChar* output);
void Convert(wxChar* str) { Convert(str, str); }
wxString Convert(const wxString& input);
#if wxUSE_UNICODE // otherwise wxChar === char
void Convert(const char* input, wxChar* output);
void Convert(const wxChar* input, char* output);
void Convert(const char* input, char* output);
void Convert(char* str) { Convert(str, str); }
wxString Convert(const wxString& input);
#if wxUSE_WCHAR_T
void Convert(const char* input, wchar_t* output);
void Convert(const wchar_t* input, char* output);
void Convert(const wchar_t* input, wchar_t* output);
void Convert(wchar_t* str) { Convert(str, str); }
#endif
// Return equivalent(s) for given font that are used
// under given platform. wxPLATFORM_CURRENT means the plaform
@@ -129,28 +137,15 @@ class WXDLLEXPORT wxEncodingConverter : public wxObject
private:
wxChar *m_Table;
#if wxUSE_WCHAR_T
wchar_t *m_Table;
#else
char *m_Table;
#endif
bool m_UnicodeInput, m_UnicodeOutput;
bool m_JustCopy;
};
#endif // __ENCCONV_H__
#endif // _WX_ENCCONV_H_

View File

@@ -768,7 +768,11 @@ public:
bool MetaDown() const { return m_metaDown; }
bool AltDown() const { return m_altDown; }
bool ShiftDown() const { return m_shiftDown; }
long KeyCode() const { return m_keyCode; }
bool HasModifiers() const { return ControlDown() || AltDown() || MetaDown(); }
// get the key code: an ASCII7 char or an element of wxKeyCode enum
int GetKeyCode() const { return (int)m_keyCode; }
// Find the position of the event
void GetPosition(wxCoord *xpos, wxCoord *ypos) const
@@ -796,6 +800,9 @@ public:
void CopyObject(wxObject& obj) const;
// deprecated
long KeyCode() const { return m_keyCode; }
public:
wxCoord m_x, m_y;
@@ -1369,7 +1376,7 @@ private:
wxEVT_DESTROY
*/
class WXDLLEXPORT wxWindowCreateEvent : public wxEvent
class WXDLLEXPORT wxWindowCreateEvent : public wxCommandEvent
{
DECLARE_DYNAMIC_CLASS(wxWindowCreateEvent)
@@ -1379,7 +1386,7 @@ public:
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
};
class WXDLLEXPORT wxWindowDestroyEvent : public wxEvent
class WXDLLEXPORT wxWindowDestroyEvent : public wxCommandEvent
{
DECLARE_DYNAMIC_CLASS(wxWindowDestroyEvent)

View File

@@ -65,10 +65,11 @@ public:
// returns the number of bytes written
size_t Write(const void *pBuf, size_t nCount);
// returns true on success
bool Write(const wxString& s)
bool Write(const wxString& s, wxMBConv& conv = wxConvLibc)
{
size_t size = s.Len()*sizeof(wxChar);
return Write(s.c_str(), size) == size;
const wxWX2MBbuf buf = s.mb_str(conv);
size_t size = strlen(buf);
return Write((const char *)buf, size) == size;
}
// flush data not yet written
bool Flush();

View File

@@ -99,10 +99,11 @@ public:
// returns the number of bytes written
size_t Write(const void *pBuf, size_t nCount);
// returns true on success
bool Write(const wxString& s)
bool Write(const wxString& s, wxMBConv& conv = wxConvLibc)
{
size_t size = s.Len()*sizeof(wxChar);
return Write(s.c_str(), size) == size;
const wxWX2MBbuf buf = s.mb_str(conv);
size_t size = strlen(buf);
return Write((const char *) buf, size) == size;
}
// flush data not yet written
bool Flush();

View File

@@ -121,7 +121,7 @@ private:
*m_pPrev; // previous one
};
class wxFileConfig : public wxConfigBase
class WXDLLEXPORT wxFileConfig : public wxConfigBase
{
public:
// construct the "standard" full name for global (system-wide) and
@@ -149,6 +149,14 @@ public:
// dtor will save unsaved data
virtual ~wxFileConfig();
// under Unix, set the umask to be used for the file creation, do nothing
// under other systems
#ifdef __UNIX__
void SetUmask(int mode) { m_umask = mode; }
#else // !__UNIX__
void SetUmask(int WXUNUSED(mode)) { }
#endif // __UNIX__/!__UNIX__
// implement inherited pure virtual functions
virtual void SetPath(const wxString& strPath);
virtual const wxString& GetPath() const { return m_strPath; }
@@ -244,6 +252,10 @@ private:
ConfigGroup *m_pRootGroup, // the top (unnamed) group
*m_pCurrentGroup; // the current group
#ifdef __UNIX__
int m_umask; // the umask to use for file creation
#endif // __UNIX__
public:
WX_DEFINE_SORTED_ARRAY(ConfigEntry *, ArrayEntries);
WX_DEFINE_SORTED_ARRAY(ConfigGroup *, ArrayGroups);

View File

@@ -60,6 +60,80 @@ enum wxSeekMode
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
// ----------------------------------------------------------------------------
// declare our versions of low level file functions: some compilers prepend
// underscores to the usual names, some also have Unicode versions of them
// ----------------------------------------------------------------------------
// Microsoft compiler loves underscores, feed them to it
#ifdef __VISUALC__
// functions
#define wxClose _close
#define wxRead _read
#define wxWrite _write
#define wxLseek _lseek
#define wxFsync _commit
#define wxEof _eof
#define wxTell _tell
#if wxUSE_UNICODE
#define wxOpen _wopen
#define wxAccess _waccess
#define wxMkDir _wmkdir
#define wxRmDir _wrmdir
#define wxStat _wstat
#else // !wxUSE_UNICODE
#define wxOpen _open
#define wxAccess _access
#define wxMkDir _mkdir
#define wxRmDir _rmdir
#define wxStat _stat
#endif
// types
#define wxStructStat struct _stat
// constants (unless already defined by the user code)
#ifndef O_RDONLY
#define O_RDONLY _O_RDONLY
#define O_WRONLY _O_WRONLY
#define O_RDWR _O_RDWR
#define O_EXCL _O_EXCL
#define O_CREAT _O_CREAT
#define O_BINARY _O_BINARY
#define S_IFMT _S_IFMT
#define S_IFDIR _S_IFDIR
#define S_IFREG _S_IFREG
#endif // O_RDONLY
#else
// functions
#define wxOpen open
#define wxClose close
#define wxRead read
#define wxWrite write
#define wxLseek lseek
#define wxFsync commit
#define wxAccess access
#define wxEof eof
#define wxMkDir mkdir
#define wxRmDir rmdir
#define wxTell(fd) lseek(fd, 0, SEEK_CUR)
#define wxStat stat
// types
#define wxStructStat struct stat
#endif // VC++
// ----------------------------------------------------------------------------
// functions
// ----------------------------------------------------------------------------

View File

@@ -21,6 +21,7 @@
// ----------------------------------------------------------------------------
#include "wx/defs.h" // for wxDEFAULT &c
#include "wx/fontenc.h" // the font encoding constants
#include "wx/gdiobj.h" // the base class
// ----------------------------------------------------------------------------
@@ -66,62 +67,6 @@ enum wxFontWeight
wxFONTWEIGHT_MAX
};
// font encodings
enum wxFontEncoding
{
wxFONTENCODING_SYSTEM = -1, // system default
wxFONTENCODING_DEFAULT, // current default encoding
// ISO8859 standard defines a number of single-byte charsets
wxFONTENCODING_ISO8859_1, // West European (Latin1)
wxFONTENCODING_ISO8859_2, // Central and East European (Latin2)
wxFONTENCODING_ISO8859_3, // Esperanto (Latin3)
wxFONTENCODING_ISO8859_4, // Baltic languages (Estonian) (Latin4)
wxFONTENCODING_ISO8859_5, // Cyrillic
wxFONTENCODING_ISO8859_6, // Arabic
wxFONTENCODING_ISO8859_7, // Greek
wxFONTENCODING_ISO8859_8, // Hebrew
wxFONTENCODING_ISO8859_9, // Turkish (Latin5)
wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6)
wxFONTENCODING_ISO8859_11, // Thai
wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it
// here anyhow to make all ISO8859
// consecutive numbers
wxFONTENCODING_ISO8859_13, // Latin7
wxFONTENCODING_ISO8859_14, // Latin8
wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro)
wxFONTENCODING_ISO8859_MAX,
// Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
wxFONTENCODING_KOI8, // we don't support any of KOI8 variants
wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
// what would we do without Microsoft? They have their own encodings
// for DOS
wxFONTENCODING_CP437, // original MS-DOS codepage
wxFONTENCODING_CP850, // CP437 merged with Latin1
wxFONTENCODING_CP852, // CP437 merged with Latin2
wxFONTENCODING_CP855, // another cyrillic encoding
wxFONTENCODING_CP866, // and another one
// and for Windows
wxFONTENCODING_CP874, // WinThai
wxFONTENCODING_CP1250, // WinLatin2
wxFONTENCODING_CP1251, // WinCyrillic
wxFONTENCODING_CP1252, // WinLatin1
wxFONTENCODING_CP1253, // WinGreek (8859-7)
wxFONTENCODING_CP1254, // WinTurkish
wxFONTENCODING_CP1255, // WinHebrew
wxFONTENCODING_CP1256, // WinArabic
wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7)
wxFONTENCODING_CP12_MAX,
wxFONTENCODING_UNICODE, // Unicode - currently used only by
// wxEncodingConverter class
wxFONTENCODING_MAX
};
// ----------------------------------------------------------------------------
// wxFontBase represents a font object
// ----------------------------------------------------------------------------

71
include/wx/fontenc.h Normal file
View File

@@ -0,0 +1,71 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/fontenc.h
// Purpose: wxFontEncoding constants
// Author: Vadim Zeitlin
// Modified by:
// Created: 29.03.00
// RCS-ID: $Id$
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FONTENC_H_
#define _WX_FONTENC_H_
// font encodings
enum wxFontEncoding
{
wxFONTENCODING_SYSTEM = -1, // system default
wxFONTENCODING_DEFAULT, // current default encoding
// ISO8859 standard defines a number of single-byte charsets
wxFONTENCODING_ISO8859_1, // West European (Latin1)
wxFONTENCODING_ISO8859_2, // Central and East European (Latin2)
wxFONTENCODING_ISO8859_3, // Esperanto (Latin3)
wxFONTENCODING_ISO8859_4, // Baltic (old) (Latin4)
wxFONTENCODING_ISO8859_5, // Cyrillic
wxFONTENCODING_ISO8859_6, // Arabic
wxFONTENCODING_ISO8859_7, // Greek
wxFONTENCODING_ISO8859_8, // Hebrew
wxFONTENCODING_ISO8859_9, // Turkish (Latin5)
wxFONTENCODING_ISO8859_10, // Variation of Latin4 (Latin6)
wxFONTENCODING_ISO8859_11, // Thai
wxFONTENCODING_ISO8859_12, // doesn't exist currently, but put it
// here anyhow to make all ISO8859
// consecutive numbers
wxFONTENCODING_ISO8859_13, // Baltic (Latin7)
wxFONTENCODING_ISO8859_14, // Latin8
wxFONTENCODING_ISO8859_15, // Latin9 (a.k.a. Latin0, includes euro)
wxFONTENCODING_ISO8859_MAX,
// Cyrillic charset soup (see http://czyborra.com/charsets/cyrillic.html)
wxFONTENCODING_KOI8, // we don't support any of KOI8 variants
wxFONTENCODING_ALTERNATIVE, // same as MS-DOS CP866
wxFONTENCODING_BULGARIAN, // used under Linux in Bulgaria
// what would we do without Microsoft? They have their own encodings
// for DOS
wxFONTENCODING_CP437, // original MS-DOS codepage
wxFONTENCODING_CP850, // CP437 merged with Latin1
wxFONTENCODING_CP852, // CP437 merged with Latin2
wxFONTENCODING_CP855, // another cyrillic encoding
wxFONTENCODING_CP866, // and another one
// and for Windows
wxFONTENCODING_CP874, // WinThai
wxFONTENCODING_CP1250, // WinLatin2
wxFONTENCODING_CP1251, // WinCyrillic
wxFONTENCODING_CP1252, // WinLatin1
wxFONTENCODING_CP1253, // WinGreek (8859-7)
wxFONTENCODING_CP1254, // WinTurkish
wxFONTENCODING_CP1255, // WinHebrew
wxFONTENCODING_CP1256, // WinArabic
wxFONTENCODING_CP1257, // WinBaltic (same as Latin 7)
wxFONTENCODING_CP12_MAX,
wxFONTENCODING_UNICODE, // Unicode - currently used only by
// wxEncodingConverter class
wxFONTENCODING_MAX
};
#endif // _WX_FONTENC_H_

View File

@@ -20,11 +20,18 @@
// headers
// ----------------------------------------------------------------------------
#include "wx/font.h" // for wxFont and wxFontEncoding
#include "wx/fontutil.h" // for wxNativeEncodingInfo
#include "wx/fontenc.h" // for wxFontEncoding
#if wxUSE_GUI
#include "wx/fontutil.h" // for wxNativeEncodingInfo
#endif // wxUSE_GUI
class WXDLLEXPORT wxConfigBase;
class WXDLLEXPORT wxWindow;
#if wxUSE_CONFIG
class WXDLLEXPORT wxConfigBase;
#endif // wxUSE_CONFIG
#if wxUSE_GUI
class WXDLLEXPORT wxWindow;
#endif // wxUSE_GUI
// ----------------------------------------------------------------------------
// wxFontMapper manages user-definable correspondence between logical font
@@ -49,6 +56,7 @@ public:
// virtual dtor for a base class
virtual ~wxFontMapper();
#if wxUSE_GUI
// find an alternative for the given encoding (which is supposed to not be
// available on this system). If successful, return TRUE and fill info
// structure with the parameters required to create the font, otherwise
@@ -69,6 +77,7 @@ public:
// If no facename is given,
virtual bool IsEncodingAvailable(wxFontEncoding encoding,
const wxString& facename = wxEmptyString);
#endif // wxUSE_GUI
// returns the encoding for the given charset (in the form of RFC 2046) or
// wxFONTENCODING_SYSTEM if couldn't decode it
@@ -90,11 +99,13 @@ public:
// configure the appearance of the dialogs we may popup
// ----------------------------------------------------
#if wxUSE_GUI
// the parent window for modal dialogs
void SetDialogParent(wxWindow *parent) { m_windowParent = parent; }
// the title for the dialogs (note that default is quite reasonable)
void SetDialogTitle(const wxString& title) { m_titleDialog = title; }
#endif // wxUSE_GUI
// functions which allow to configure the config object used: by default,
// the global one (from wxConfigBase::Get() will be used) and the default
@@ -102,6 +113,7 @@ public:
// GetDefaultConfigPath()
// ----------------------------------------------------------------------
#if wxUSE_CONFIG
// set the config object to use (may be NULL to use default)
void SetConfig(wxConfigBase *config) { m_config = config; }
@@ -110,8 +122,11 @@ public:
// return default config path
static const wxChar *GetDefaultConfigPath();
#endif
protected:
#if wxUSE_CONFIG
// get the config object we're using - if it wasn't set explicitly, this
// function will use wxConfig::Get() to get the global one
wxConfigBase *GetConfig();
@@ -119,6 +134,7 @@ protected:
// gets the root path for our settings - if itwasn't set explicitly, use
// GetDefaultConfigPath()
const wxString& GetConfigPath();
#endif
// change to the given (relative) path in the config, return TRUE if ok
// (then GetConfig() will return something !NULL), FALSE if no config
@@ -131,6 +147,7 @@ protected:
// restore the config path after use
void RestorePath(const wxString& pathOld);
#if wxUSE_GUI
// GetAltForEncoding() helper: tests for the existence of the given
// encoding and saves the result in config if ok - this results in the
// following (desired) behaviour: when an unknown/unavailable encoding is
@@ -141,16 +158,22 @@ protected:
bool TestAltEncoding(const wxString& configEntry,
wxFontEncoding encReplacement,
wxNativeEncodingInfo *info);
#endif // wxUSE_GUI
#if wxUSE_CONFIG
// config object and path (in it) to use
wxConfigBase *m_config;
#endif
wxString m_configRootPath;
#if wxUSE_GUI
// the title for our dialogs
wxString m_titleDialog;
// the parent window for our dialogs
wxWindow *m_windowParent;
#endif // wxUSE_GUI
friend class wxFontMapperPathChanger;
};

View File

@@ -192,6 +192,10 @@ protected:
// something changes
virtual void PositionStatusBar() { }
// show the help string for this menu item in the given status bar: the
// status bar pointer can be NULL; return TRUE if help was shown
bool ShowMenuHelp(wxStatusBar *statbar, int id);
wxStatusBar *m_frameStatusBar;
#endif // wxUSE_STATUSBAR

View File

@@ -226,8 +226,8 @@ public:
wxRealPoint() { x = y = 0.0; };
wxRealPoint(double xx, double yy) { x = xx; y = yy; };
wxRealPoint operator+(const wxRealPoint& pt) { return wxRealPoint(x + pt.x, y + pt.y); }
wxRealPoint operator-(const wxRealPoint& pt) { return wxRealPoint(x - pt.x, y - pt.y); }
wxRealPoint operator+(const wxRealPoint& pt) const { return wxRealPoint(x + pt.x, y + pt.y); }
wxRealPoint operator-(const wxRealPoint& pt) const { return wxRealPoint(x - pt.x, y - pt.y); }
bool operator==(const wxRealPoint& pt) const { return x == pt.x && y == pt.y; }
};
@@ -247,8 +247,8 @@ public:
bool operator!=(const wxPoint& p) const { return !(*this == p); }
// arithmetic operations (component wise)
wxPoint operator+(const wxPoint& p) { return wxPoint(x + p.x, y + p.y); }
wxPoint operator-(const wxPoint& p) { return wxPoint(x - p.x, y - p.y); }
wxPoint operator+(const wxPoint& p) const { return wxPoint(x + p.x, y + p.y); }
wxPoint operator-(const wxPoint& p) const { return wxPoint(x - p.x, y - p.y); }
wxPoint& operator+=(const wxPoint& p) { x += p.x; y += p.y; return *this; }
wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; }

View File

@@ -48,14 +48,24 @@ public:
// implementation
// --------------
// blink the caret once
void Blink();
// called by wxWindow (not using the event tables)
virtual void OnSetFocus();
virtual void OnKillFocus();
// called by wxCaretTimer
void OnTimer();
protected:
virtual void DoShow();
virtual void DoHide();
virtual void DoMove();
// blink the caret once
void Blink();
// refresh the caret
void Refresh();
// draw the caret on the given DC
void DoDraw(wxDC *dc);
@@ -64,7 +74,8 @@ private:
void InitGeneric();
wxCaretTimer m_timer;
bool m_blinkedOut; // TRUE => caret hidden right now
bool m_blinkedOut, // TRUE => caret hidden right now
m_hasFocus; // TRUE => our window has focus
};
#endif // _WX_CARET_H_

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: colrdlgg.h
// Name: wx/generic/colrdlgg.h
// Purpose: wxGenericColourDialog
// Author: Julian Smart
// Modified by:
@@ -27,88 +27,91 @@
#define wxID_BLUE_SLIDER 3003
class WXDLLEXPORT wxSlider;
class WXDLLEXPORT wxGenericColourDialog: public wxDialog
class WXDLLEXPORT wxGenericColourDialog : public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxGenericColourDialog)
protected:
wxColourData colourData;
wxWindow *dialogParent;
public:
wxGenericColourDialog();
wxGenericColourDialog(wxWindow *parent,
wxColourData *data = (wxColourData *) NULL);
virtual ~wxGenericColourDialog();
// Area reserved for grids of colours
wxRect standardColoursRect;
wxRect customColoursRect;
wxRect singleCustomColourRect;
bool Create(wxWindow *parent, wxColourData *data = (wxColourData *) NULL);
// Size of each colour rectangle
wxPoint smallRectangleSize;
wxColourData &GetColourData() { return colourData; }
// For single customizable colour
wxPoint customRectangleSize;
virtual int ShowModal();
// Grid spacing (between rectangles)
int gridSpacing;
// Internal functions
void OnMouseEvent(wxMouseEvent& event);
void OnPaint(wxPaintEvent& event);
// Section spacing (between left and right halves of dialog box)
int sectionSpacing;
virtual void CalculateMeasurements();
virtual void CreateWidgets();
virtual void InitializeColours();
// 48 'standard' colours
wxColour standardColours[48];
virtual void PaintBasicColours(wxDC& dc);
virtual void PaintCustomColours(wxDC& dc);
virtual void PaintCustomColour(wxDC& dc);
virtual void PaintHighlight(wxDC& dc, bool draw);
// 16 'custom' colours
wxColour customColours[16];
virtual void OnBasicColourClick(int which);
virtual void OnCustomColourClick(int which);
// One single custom colour (use sliders)
wxColour singleCustomColour;
void OnAddCustom(wxCommandEvent& event);
// Which colour is selected? An index into one of the two areas.
int colourSelection;
int whichKind; // 1 for standard colours, 2 for custom colours,
void OnRedSlider(wxCommandEvent& event);
void OnGreenSlider(wxCommandEvent& event);
void OnBlueSlider(wxCommandEvent& event);
wxSlider *redSlider;
wxSlider *greenSlider;
wxSlider *blueSlider;
void OnCloseWindow(wxCloseEvent& event);
int buttonY;
protected:
wxColourData colourData;
wxWindow *dialogParent;
int okButtonX;
int customButtonX;
// Area reserved for grids of colours
wxRect standardColoursRect;
wxRect customColoursRect;
wxRect singleCustomColourRect;
// static bool colourDialogCancelled;
public:
wxGenericColourDialog(void);
wxGenericColourDialog(wxWindow *parent, wxColourData *data = (wxColourData *) NULL);
~wxGenericColourDialog(void);
// Size of each colour rectangle
wxPoint smallRectangleSize;
bool Create(wxWindow *parent, wxColourData *data = (wxColourData *) NULL);
// For single customizable colour
wxPoint customRectangleSize;
int ShowModal(void);
wxColourData &GetColourData(void) { return colourData; }
// Grid spacing (between rectangles)
int gridSpacing;
// Internal functions
void OnMouseEvent(wxMouseEvent& event);
void OnPaint(wxPaintEvent& event);
// Section spacing (between left and right halves of dialog box)
int sectionSpacing;
virtual void CalculateMeasurements(void);
virtual void CreateWidgets(void);
virtual void InitializeColours(void);
virtual void PaintBasicColours(wxDC& dc);
virtual void PaintCustomColours(wxDC& dc);
virtual void PaintCustomColour(wxDC& dc);
virtual void PaintHighlight(wxDC& dc, bool draw);
// 48 'standard' colours
wxColour standardColours[48];
virtual void OnBasicColourClick(int which);
virtual void OnCustomColourClick(int which);
// 16 'custom' colours
wxColour customColours[16];
void OnAddCustom(wxCommandEvent& event);
// One single custom colour (use sliders)
wxColour singleCustomColour;
void OnRedSlider(wxCommandEvent& event);
void OnGreenSlider(wxCommandEvent& event);
void OnBlueSlider(wxCommandEvent& event);
// Which colour is selected? An index into one of the two areas.
int colourSelection;
int whichKind; // 1 for standard colours, 2 for custom colours,
void OnCloseWindow(wxCloseEvent& event);
wxSlider *redSlider;
wxSlider *greenSlider;
wxSlider *blueSlider;
DECLARE_EVENT_TABLE()
int buttonY;
int okButtonX;
int customButtonX;
// static bool colourDialogCancelled;
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxGenericColourDialog)
};
/* This shouldn't be necessary, we have a #define in wx/colordlg.h.

View File

@@ -6,7 +6,7 @@
// Created: 12/12/98
// Copyright: (c) Harm van der Heijden and Robert Roebling
// RCS-ID: $Id$
// Licence: wxWindows licence
// Licence: wxWindows licence
//
// Notes: wxDirDialog class written by Harm van der Heijden,
// uses wxDirCtrl class written by Robert Roebling for the
@@ -106,11 +106,11 @@ public:
wxDirCtrl();
wxDirCtrl(wxWindow *parent, const wxWindowID id = -1,
const wxString &dir = wxDirDialogDefaultFolderStr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const long style = wxTR_HAS_BUTTONS,
const wxString& name = wxTreeCtrlNameStr );
const wxString &dir = wxDirDialogDefaultFolderStr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const long style = wxTR_HAS_BUTTONS,
const wxString& name = wxTreeCtrlNameStr );
void ShowHidden( const bool yesno );
void OnExpandItem(wxTreeEvent &event );
void OnCollapseItem(wxTreeEvent &event );
@@ -118,6 +118,8 @@ public:
void OnEndEditItem(wxTreeEvent &event );
protected:
friend class wxDirDialog;
void CreateItems(const wxTreeItemId &parent);
void SetupSections();
wxArrayString m_paths, m_names;
@@ -136,9 +138,9 @@ class WXDLLEXPORT wxDirDialog: public wxDialog
public:
wxDirDialog() {}
wxDirDialog(wxWindow *parent,
const wxString& message = wxFileSelectorPromptStr,
const wxString& defaultPath = wxEmptyString,
long style = 0, const wxPoint& pos = wxDefaultPosition);
const wxString& message = wxFileSelectorPromptStr,
const wxString& defaultPath = wxEmptyString,
long style = 0, const wxPoint& pos = wxDefaultPosition);
inline void SetMessage(const wxString& message) { m_message = message; }
inline void SetPath(const wxString& path) { m_path = path; }
inline void SetStyle(long style) { m_dialogStyle = style; }

View File

@@ -97,7 +97,11 @@ public:
// Ctors & dtor
////////////////////////////////////////////////////////////////////////////
wxGenericDragImage();
wxGenericDragImage(const wxCursor& cursor = wxNullCursor, const wxPoint& hotspot = wxPoint(0, 0))
{
Init();
Create(cursor, hotspot);
}
wxGenericDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor, const wxPoint& hotspot = wxPoint(0, 0))
{
Init();
@@ -133,9 +137,16 @@ public:
// Attributes
////////////////////////////////////////////////////////////////////////////
// For efficiency, tell wxGenericDragImage to use a bitmap that's already
// created (e.g. from last drag)
void SetBackingBitmap(wxBitmap* bitmap) { m_pBackingBitmap = bitmap; }
// Operations
////////////////////////////////////////////////////////////////////////////
// Create a drag image with a virtual image (need to override DoDrawImage, GetImageRect)
bool Create(const wxCursor& cursor = wxNullCursor, const wxPoint& hotspot = wxPoint(0, 0));
// Create a drag image from a bitmap and optional cursor
bool Create(const wxBitmap& image, const wxCursor& cursor = wxNullCursor, const wxPoint& hotspot = wxPoint(0, 0));
@@ -178,10 +189,22 @@ public:
void Init();
wxRect GetImageRect(const wxPoint& pos) const;
// Override this if you are using a virtual image (drawing your own image)
virtual wxRect GetImageRect(const wxPoint& pos) const;
// Override this if you are using a virtual image (drawing your own image)
virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos) const;
// Override this if you wish to draw the window contents to the backing bitmap
// yourself. This can be desirable if you wish to avoid flicker by not having to
// redraw the window itself before dragging in order to be graphic-minus-dragged-objects.
// Instead, paint the drag image's backing bitmap to be correct, and leave the window
// to be updated only when dragging the objects away (thus giving a smoother appearance).
virtual bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC,
const wxRect& sourceRect, const wxRect& destRect) const;
// Erase and redraw simultaneously if possible
bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew);
virtual bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, bool eraseOld, bool drawNew);
protected:
wxBitmap m_bitmap;
@@ -189,6 +212,7 @@ protected:
wxCursor m_cursor;
wxCursor m_oldCursor;
wxPoint m_hotspot;
wxPoint m_offset; // The hostpot value passed to BeginDrag
wxPoint m_position;
bool m_isDirty;
bool m_isShown;
@@ -197,6 +221,8 @@ protected:
// Stores the window contents while we're dragging the image around
wxBitmap m_backingBitmap;
wxBitmap* m_pBackingBitmap; // Pointer to existing backing bitmap
// (pass to wxGenericDragImage as an efficiency measure)
// A temporary bitmap for repairing/redrawing
wxBitmap m_repairBitmap;

View File

@@ -298,6 +298,8 @@ public:
wxGridCellEditor();
bool IsCreated() { return m_control != NULL; }
wxControl* GetControl() { return m_control; }
void SetControl(wxControl* control) { m_control = control; }
// Creates the actual edit control
virtual void Create(wxWindow* parent,
@@ -326,9 +328,18 @@ public:
// Reset the value in the control back to its starting value
virtual void Reset() = 0;
// If the editor is enabled by pressing keys on the grid,
// this will be called to let the editor do something about
// that first key if desired.
// return TRUE to allow the given key to start editing: the base class
// version only checks that the event has no modifiers. The derived
// classes are supposed to do "if ( base::IsAcceptedKey() && ... )" in
// their IsAcceptedKey() implementation, although, of course, it is not a
// mandatory requirment.
//
// NB: if the key is F2 (special), editing will always start and this
// method will not be called at all (but StartingKey() will)
virtual bool IsAcceptedKey(wxKeyEvent& event);
// If the editor is enabled by pressing keys on the grid, this will be
// called to let the editor do something about that first key if desired
virtual void StartingKey(wxKeyEvent& event);
// if the editor is enabled by clicking on the cell, this method will be
@@ -377,6 +388,7 @@ public:
virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
virtual bool IsAcceptedKey(wxKeyEvent& event);
virtual void BeginEdit(int row, int col, wxGrid* grid);
virtual bool EndEdit(int row, int col, wxGrid* grid);
@@ -414,6 +426,7 @@ public:
wxWindowID id,
wxEvtHandler* evtHandler);
virtual bool IsAcceptedKey(wxKeyEvent& event);
virtual void BeginEdit(int row, int col, wxGrid* grid);
virtual bool EndEdit(int row, int col, wxGrid* grid);
@@ -447,10 +460,13 @@ private:
class WXDLLEXPORT wxGridCellFloatEditor : public wxGridCellTextEditor
{
public:
wxGridCellFloatEditor(int width = -1, int precision = -1);
virtual void Create(wxWindow* parent,
wxWindowID id,
wxEvtHandler* evtHandler);
virtual bool IsAcceptedKey(wxKeyEvent& event);
virtual void BeginEdit(int row, int col, wxGrid* grid);
virtual bool EndEdit(int row, int col, wxGrid* grid);
@@ -460,12 +476,16 @@ public:
virtual wxGridCellEditor *Clone() const
{ return new wxGridCellFloatEditor; }
// parameters string format is "width,precision"
virtual void SetParameters(const wxString& params);
protected:
// string representation of m_valueOld
wxString GetString() const
{ return wxString::Format(_T("%f"), m_valueOld); }
wxString GetString() const;
private:
int m_width,
m_precision;
double m_valueOld;
};
@@ -480,6 +500,7 @@ public:
virtual void SetSize(const wxRect& rect);
virtual void Show(bool show, wxGridCellAttr *attr = (wxGridCellAttr *)NULL);
virtual bool IsAcceptedKey(wxKeyEvent& event);
virtual void BeginEdit(int row, int col, wxGrid* grid);
virtual bool EndEdit(int row, int col, wxGrid* grid);
@@ -502,7 +523,7 @@ class WXDLLEXPORT wxGridCellChoiceEditor : public wxGridCellEditor
public:
// if !allowOthers, user can't type a string not in choices array
wxGridCellChoiceEditor(size_t count = 0,
const wxChar* choices[] = NULL,
const wxString choices[] = NULL,
bool allowOthers = FALSE);
virtual void Create(wxWindow* parent,
@@ -754,11 +775,6 @@ public:
// a wxGridCellAttrProvider if necessary.
virtual bool CanHaveAttributes();
// change row/col number in attribute if needed
virtual void UpdateAttrRows( size_t pos, int numRows );
virtual void UpdateAttrCols( size_t pos, int numCols );
// by default forwarded to wxGridCellAttrProvider if any. May be
// overridden to handle attributes directly in the table.
virtual wxGridCellAttr *GetAttr( int row, int col );
@@ -933,8 +949,8 @@ private:
// For comparisons...
//
extern wxGridCellCoords wxGridNoCellCoords;
extern wxRect wxGridNoCellRect;
extern WXDLLEXPORT wxGridCellCoords wxGridNoCellCoords;
extern WXDLLEXPORT wxRect wxGridNoCellRect;
// An array of cell coords...
//
@@ -979,10 +995,10 @@ public:
// ------ display update functions
//
void CalcRowLabelsExposed( wxRegion& reg );
void CalcRowLabelsExposed( const wxRegion& reg );
void CalcColLabelsExposed( wxRegion& reg );
void CalcCellsExposed( wxRegion& reg );
void CalcColLabelsExposed( const wxRegion& reg );
void CalcCellsExposed( const wxRegion& reg );
// ------ event handlers
@@ -1049,7 +1065,8 @@ public:
// flicker
//
void BeginBatch() { m_batchCount++; }
void EndBatch() { if ( m_batchCount > 0 ) m_batchCount--; }
void EndBatch();
int GetBatchCount() { return m_batchCount; }
@@ -1062,6 +1079,7 @@ public:
void DisableCellEditControl() { EnableCellEditControl(FALSE); }
bool CanEnableCellControl() const;
bool IsCellEditControlEnabled() const;
bool IsCellEditControlShown() const;
bool IsCurrentCellReadOnly() const;
@@ -1131,6 +1149,7 @@ public:
wxString GetRowLabelValue( int row );
wxString GetColLabelValue( int col );
wxColour GetGridLineColour() { return m_gridLineColour; }
wxColour GetCellHighlightColour() { return m_cellHighlightColour; }
void SetRowLabelSize( int width );
void SetColLabelSize( int height );
@@ -1142,6 +1161,7 @@ public:
void SetRowLabelValue( int row, const wxString& );
void SetColLabelValue( int col, const wxString& );
void SetGridLineColour( const wxColour& );
void SetCellHighlightColour( const wxColour& );
void EnableDragRowSize( bool enable = TRUE );
void DisableDragRowSize() { EnableDragRowSize( FALSE ); }
@@ -1296,15 +1316,6 @@ public:
wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft,
const wxGridCellCoords & bottomRight );
// This function returns the rectangle that encloses the selected cells
// in device coords and clipped to the client size of the grid window.
//
wxRect SelectionToDeviceRect()
{
return BlockToDeviceRect( m_selectingTopLeft,
m_selectingBottomRight );
}
// Access or update the selection fore/back colours
wxColour GetSelectionBackground() const
{ return m_selectionBackground; }
@@ -1347,7 +1358,7 @@ public:
int x, int y, int w = -1, int h = -1,
long style = wxWANTS_CHARS,
const wxString& name = wxPanelNameStr )
: wxScrolledWindow( parent, -1, wxPoint(x,y), wxSize(w,h),
: wxScrolledWindow( parent, -1, wxPoint(x,y), wxSize(w,h),
(style|wxWANTS_CHARS), name )
{
Create();
@@ -1579,6 +1590,7 @@ protected:
wxColour m_gridLineColour;
bool m_gridLinesEnabled;
wxColour m_cellHighlightColour;
// common part of AutoSizeColumn/Row() and GetBestSize()
int SetOrCalcColumnSizes(bool calcOnly, bool setAsMin = TRUE);
@@ -1704,6 +1716,7 @@ protected:
void OnPaint( wxPaintEvent& );
void OnSize( wxSizeEvent& );
void OnKeyDown( wxKeyEvent& );
void OnKeyUp( wxKeyEvent& );
void OnEraseBackground( wxEraseEvent& );

View File

@@ -74,7 +74,7 @@ DECLARE_CLASS(wxExtHelpController)
/// Is the viewer a variant of netscape?
bool m_BrowserIsNetscape;
/// Call the browser using a relative URL.
virtual bool DisplayHelp(wxString const &);
virtual bool DisplayHelp(const wxString&);
};
#endif // wxUSE_HELP

View File

@@ -103,6 +103,10 @@ DECLARE_ABSTRACT_CLASS(wxHTMLHelpControllerBase)
/** Display help for id sectionNo -- identical with DisplaySection().
@return true on success
*/
virtual bool DisplaySection(const wxString& section);
/** Display help for URL (using DisplayHelp) or keyword (using KeywordSearch)
@return true on success
*/
virtual bool DisplayBlock(long blockNo);
/** Search comment/documentation fields in map file and present a
list to chose from.
@@ -117,7 +121,7 @@ DECLARE_ABSTRACT_CLASS(wxHTMLHelpControllerBase)
virtual void OnQuit(void);
/// Call the browser using a relative URL.
virtual bool DisplayHelp(wxString const &) = 0;
virtual bool DisplayHelp(const wxString &) = 0;
/// Allows one to override the default settings for the help frame.
virtual void SetFrameParameters(const wxString& WXUNUSED(title),

View File

@@ -58,7 +58,7 @@ DECLARE_CLASS(wxHelpControllerHtml)
private:
/// Call the browser using a relative URL.
virtual bool DisplayHelp(wxString const &);
virtual bool DisplayHelp(const wxString &);
protected:
friend class wxHelpFrame;
class wxHelpFrame *m_Frame;

View File

@@ -104,6 +104,11 @@ class WXDLLEXPORT wxXLPHelpController: public wxHelpControllerBase
virtual bool DisplayBlock(long blockNo);
virtual bool KeywordSearch(const wxString& k);
virtual bool DisplaySection(const wxString& section)
{
return wxHelpControllerBase::DisplaySection(section);
}
virtual bool Quit(void);
virtual void OnQuit(void);

View File

@@ -1,11 +1,11 @@
/////////////////////////////////////////////////////////////////////////////
// Name: imaglist.h
// Name: wx/generic/imaglist.h
// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __IMAGELISTH_G__
@@ -49,15 +49,16 @@ enum {
class wxImageList: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxImageList)
public:
public:
wxImageList() { }
wxImageList( int width, int height, bool mask = TRUE, int initialCount = 1 );
~wxImageList();
bool Create( int width, int height, bool mask = TRUE, int initialCount = 1 );
bool Create();
int GetImageCount() const;
bool GetSize( int index, int &width, int &height ) const;
int Add( const wxBitmap& bitmap );
int Add( const wxBitmap& bitmap, const wxBitmap& mask );
int Add( const wxBitmap& bitmap, const wxColour& maskColour );
@@ -65,15 +66,18 @@ class wxImageList: public wxObject
bool Replace( int index, const wxBitmap &bitmap );
bool Remove( int index );
bool RemoveAll();
bool GetSize( int index, int &width, int &height ) const;
bool Draw(int index, wxDC& dc, int x, int y,
int flags = wxIMAGELIST_DRAW_NORMAL, bool solidBackground = FALSE );
private:
int flags = wxIMAGELIST_DRAW_NORMAL,
bool solidBackground = FALSE);
private:
wxList m_images;
int m_width;
int m_height;
DECLARE_DYNAMIC_CLASS(wxImageList)
};
#endif // __IMAGELISTH_G__

View File

@@ -141,7 +141,18 @@ class WXDLLEXPORT wxSashLayoutWindow: public wxSashWindow
{
DECLARE_CLASS(wxSashLayoutWindow)
public:
wxSashLayoutWindow()
{
Init();
}
wxSashLayoutWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "layoutWindow")
{
Create(parent, id, pos, size, style, name);
}
bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "layoutWindow");
// Accessors
@@ -161,7 +172,10 @@ public:
// Called by layout algorithm to retrieve information about the window.
void OnQueryLayoutInfo(wxQueryLayoutInfoEvent& event);
protected:
private:
void Init();
wxLayoutAlignment m_alignment;
wxLayoutOrientation m_orientation;
wxSize m_defaultSize;
@@ -190,7 +204,7 @@ public:
return LayoutWindow(frame, mainWindow);
}
// mainWindow is sized to whatever's left over. This function for backward
// mainWindow is sized to whatever's left over.
bool LayoutWindow(wxWindow* frame, wxWindow* mainWindow = (wxWindow*) NULL);
};

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: panelg.h
// Purpose: wxPanel: similar to wxWindows but is coloured as for a dialog
// Name: wx/generic/panelg.h
// Purpose: wxPanel: a container for child controls
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
@@ -13,14 +13,23 @@
#define _WX_GENERIC_PANEL_H_
#ifdef __GNUG__
#pragma interface "panelg.h"
#pragma interface "panelg.h"
#endif
// ----------------------------------------------------------------------------
// headers and forward declarations
// ----------------------------------------------------------------------------
#include "wx/window.h"
#include "wx/button.h"
class WXDLLEXPORT wxButton;
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
// ----------------------------------------------------------------------------
// wxPanel contains other controls and implements TAB traversal between them
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxPanel : public wxWindow
{
public:
@@ -106,5 +115,8 @@ private:
DECLARE_EVENT_TABLE()
};
// this function is for wxWindows use only
extern bool wxSetFocusToChild(wxWindow *win, wxWindow **child);
#endif
// _WX_GENERIC_PANEL_H_

View File

@@ -325,9 +325,9 @@ public:
void ResetScrollbar();
private:
friend wxPlotArea;
friend wxPlotXAxisArea;
friend wxPlotYAxisArea;
friend class wxPlotArea;
friend class wxPlotXAxisArea;
friend class wxPlotYAxisArea;
double m_xUnitsPerValue;
double m_xZoom;

View File

@@ -55,8 +55,11 @@ public:
*/
#define wxSW_NOBORDER 0x0000
#define wxSW_3D 0x0010
//#define wxSW_3D 0x0010
#define wxSW_BORDER 0x0020
#define wxSW_3DSASH 0x0040
#define wxSW_3DBORDER 0x0080
#define wxSW_3D (wxSW_3DSASH | wxSW_3DBORDER)
/*
* wxSashWindow allows any of its edges to have a sash which can be dragged
@@ -74,13 +77,24 @@ public:
// Public API
// Default constructor
wxSashWindow();
wxSashWindow()
{
Init();
}
// Normal constructor
wxSashWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "sashWindow");
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "sashWindow")
{
Init();
Create(parent, id, pos, size, style, name);
}
~wxSashWindow();
bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "sashWindow");
// Set whether there's a sash in this position
void SetSashVisible(wxSashEdgePosition edge, bool sash);
@@ -151,7 +165,9 @@ public:
// Initialize colours
void InitColours();
protected:
private:
void Init();
wxSashEdge m_sashes[4];
int m_dragMode;
wxSashEdgePosition m_draggingEdge;

View File

@@ -60,16 +60,30 @@ public:
// Public API
// Default constructor
wxSplitterWindow();
wxSplitterWindow()
{
Init();
}
// Normal constructor
wxSplitterWindow(wxWindow *parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_3D|wxCLIP_CHILDREN,
const wxString& name = "splitter");
const wxString& name = "splitter")
{
Init();
Create(parent, id, pos, size, style, name);
}
~wxSplitterWindow();
bool Create(wxWindow *parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_3D|wxCLIP_CHILDREN,
const wxString& name = "splitter");
// Gets the only or left/top pane
wxWindow *GetWindow1() const { return m_windowOne; }
@@ -164,23 +178,26 @@ public:
void OnIdle(wxIdleEvent& event);
// Draws borders
void DrawBorders(wxDC& dc);
virtual void DrawBorders(wxDC& dc);
// Draws the sash
void DrawSash(wxDC& dc);
virtual void DrawSash(wxDC& dc);
// Draws the sash tracker (for whilst moving the sash)
void DrawSashTracker(int x, int y);
virtual void DrawSashTracker(int x, int y);
// Tests for x, y over sash
bool SashHitTest(int x, int y, int tolerance = 2);
virtual bool SashHitTest(int x, int y, int tolerance = 2);
// Resizes subwindows
void SizeWindows();
virtual void SizeWindows();
// Initialize colours
void InitColours();
void SetNeedUpdating(bool needUpdating) { m_needUpdating = needUpdating; }
bool GetNeedUpdating() const { return m_needUpdating ; }
protected:
// our event handlers
void OnSashPosChanged(wxSplitterEvent& event);
@@ -191,9 +208,13 @@ protected:
void SendUnsplitEvent(wxWindow *winRemoved);
private:
void Init();
int m_splitMode;
bool m_permitUnsplitAlways;
bool m_needUpdating; // when in live mode, set the to TRUE to resize children in idle
bool m_needUpdating; // when in live mode, set this to TRUE to resize children in idle
wxWindow* m_windowOne;
wxWindow* m_windowTwo;
int m_dragMode;

View File

@@ -312,6 +312,8 @@ public:
// expand this item
void Expand(const wxTreeItemId& item);
// expand this item and all subitems recursively
void ExpandAll(const wxTreeItemId& item);
// collapse the item without removing its children
void Collapse(const wxTreeItemId& item);
// collapse the item and remove all children
@@ -408,6 +410,7 @@ protected:
wxTimer *m_renameTimer;
bool m_renameAccept;
bool m_lastOnSame; // last click on the same item as prev
wxString m_renameRes;
// the common part of all ctors

View File

@@ -61,7 +61,7 @@ public:
inline long GetLeftMargin(void) const { return m_leftMargin; }
inline bool GetOrientation(void) const { return m_orientation; }
inline void SetOrientation(bool or) { m_orientation = or; }
inline void SetOrientation(bool orient) { m_orientation = orient; }
private:
void CalcLayout(long node_id, int level, wxDC& dc);

View File

@@ -24,12 +24,12 @@ public:
int id = -1,
const wxString& title = wxEmptyString,
const wxBitmap& bitmap = wxNullBitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize);
const wxPoint& pos = wxDefaultPosition);
// implement base class pure virtuals
virtual bool RunWizard(wxWizardPage *firstPage);
virtual wxWizardPage *GetCurrentPage() const;
virtual void SetPageSize(const wxSize& size);
virtual wxSize GetPageSize() const;
// implementation only from now on
@@ -39,15 +39,27 @@ public:
bool IsRunning() const { return m_page != NULL; }
// show the prev/next page, but call TransferDataFromWindow on the current
// page first and return FALSE without changing the page if it returns
// FALSE
// page first and return FALSE without changing the page if
// TransferDataFromWindow() returns FALSE - otherwise, returns TRUE
bool ShowPage(wxWizardPage *page, bool goingForward = TRUE);
private:
// was the dialog really created?
bool WasCreated() const { return m_btnPrev != NULL; }
// do fill the dialog with controls
void DoCreateControls();
// event handlers
void OnCancel(wxCommandEvent& event);
void OnBackOrNext(wxCommandEvent& event);
// the page size requested by user
wxSize m_sizePage;
// the dialog position from the ctor
wxPoint m_posWizard;
// wizard dimensions
int m_x, m_y; // the origin for the pages
int m_width, // the size of the page itself

View File

@@ -70,8 +70,8 @@ public:
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
~wxBitmap();
wxBitmap& operator = ( const wxBitmap& bmp );
bool operator == ( const wxBitmap& bmp );
bool operator != ( const wxBitmap& bmp );
bool operator == ( const wxBitmap& bmp ) const;
bool operator != ( const wxBitmap& bmp ) const;
bool Ok() const;
bool Create(int width, int height, int depth = -1);

View File

@@ -74,6 +74,10 @@ public:
void SetBitmapLabel( const wxBitmap& bitmap );
void SetBitmapSelected( const wxBitmap& bitmap );
void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
int GetMarginX() const { return m_marginX; }
int GetMarginY() const { return m_marginY; }
virtual bool Enable(bool enable);
// implementation
@@ -93,6 +97,10 @@ public:
wxBitmap m_focus;
wxBitmap m_selected;
protected:
int m_marginX;
int m_marginY;
private:
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
};

View File

@@ -40,8 +40,8 @@ public:
wxBrush( const wxBrush &brush );
~wxBrush();
wxBrush& operator = ( const wxBrush& brush );
bool operator == ( const wxBrush& brush );
bool operator != ( const wxBrush& brush );
bool operator == ( const wxBrush& brush ) const;
bool operator != ( const wxBrush& brush ) const;
bool Ok() const;
int GetStyle() const;

View File

@@ -148,7 +148,6 @@ public:
bool m_needComputeScaleX,
m_needComputeScaleY; // not yet used
float m_scaleFactor; // wxPSDC wants to have this. Will disappear.
private:
DECLARE_ABSTRACT_CLASS(wxDC)

View File

@@ -103,6 +103,9 @@ protected:
// common part of all ctors
void Init();
// common part of Destroy() and ~wxDialog
void CleanUp();
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);

View File

@@ -36,6 +36,16 @@ class wxFileDropTarget;
class wxDropSource;
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
// this macro may be used instead for wxDropSource ctor arguments: it will use
// the icon 'name' from an XPM file under GTK, but will expand to something
// else under MSW. If you don't use it, you will have to use #ifdef in the
// application code.
#define wxDROP_ICON(name) wxICON(name)
//-------------------------------------------------------------------------
// wxDropTarget
//-------------------------------------------------------------------------
@@ -78,12 +88,16 @@ class wxDropSource: public wxDropSourceBase
public:
/* constructor. set data later with SetData() */
wxDropSource( wxWindow *win = (wxWindow *)NULL,
const wxIcon &go = wxNullIcon );
const wxIcon &copy = wxNullIcon,
const wxIcon &move = wxNullIcon,
const wxIcon &none = wxNullIcon);
/* constructor for setting one data object */
wxDropSource( wxDataObject& data,
wxWindow *win,
const wxIcon &go = wxNullIcon );
const wxIcon &copy = wxNullIcon,
const wxIcon &move = wxNullIcon,
const wxIcon &none = wxNullIcon);
~wxDropSource();
@@ -94,7 +108,7 @@ public:
void RegisterWindow();
void UnregisterWindow();
void PrepareIcon( int hot_x, int hot_y, GdkDragContext *context );
void PrepareIcon( int action, GdkDragContext *context );
GtkWidget *m_widget;
GtkWidget *m_iconWindow;
@@ -102,9 +116,17 @@ public:
wxWindow *m_window;
wxDragResult m_retValue;
wxIcon m_icon;
wxIcon m_iconCopy,
m_iconMove,
m_iconNone;
bool m_waiting;
private:
// common part of both ctors
void SetIcons(const wxIcon& copy,
const wxIcon& move,
const wxIcon& none);
};
#endif

View File

@@ -1,10 +1,10 @@
/////////////////////////////////////////////////////////////////////////////
// Name: mdi.h
// Name: gtk/mdi.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -45,12 +45,20 @@ extern const wxChar* wxStatusLineNameStr;
class wxMDIParentFrame: public wxFrame
{
public:
wxMDIParentFrame();
wxMDIParentFrame( wxWindow *parent,
wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxFrameNameStr );
wxMDIParentFrame() { Init(); }
wxMDIParentFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxFrameNameStr)
{
Init();
(void)Create(parent, id, title, pos, size, style, name);
}
~wxMDIParentFrame(void);
bool Create( wxWindow *parent,
wxWindowID id, const wxString& title,
@@ -60,32 +68,31 @@ public:
void GetClientSize(int *width, int *height) const;
wxMDIChildFrame *GetActiveChild() const;
wxMDIClientWindow *GetClientWindow() const;
wxMDIClientWindow *GetClientWindow() const;
virtual wxMDIClientWindow *OnCreateClient();
virtual void Cascade() {}
virtual void Tile() {}
virtual void ArrangeIcons() {}
virtual void ActivateNext();
virtual void ActivatePrevious();
void OnActivate( wxActivateEvent& event );
void OnSysColourChanged( wxSysColourChangedEvent& event );
// implementation
// implementation
wxMDIClientWindow *m_clientWindow;
bool m_justInserted;
virtual void GtkOnSize( int x, int y, int width, int height );
virtual void OnInternalIdle();
protected:
void Init();
private:
friend class wxMDIChildFrame;
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
DECLARE_EVENT_TABLE()
};
//-----------------------------------------------------------------------------
@@ -105,7 +112,7 @@ public:
wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr );
virtual void SetMenuBar( wxMenuBar *menu_bar );
virtual wxMenuBar *GetMenuBar() const;
@@ -113,11 +120,11 @@ public:
virtual void AddChild( wxWindowBase *child );
virtual void Activate();
#if wxUSE_STATUSBAR
// no status bars
virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1,
long WXUNUSED(style) = 1,
long WXUNUSED(style) = 1,
wxWindowID WXUNUSED(id) = 1,
const wxString& WXUNUSED(name) = wxEmptyString)
{ return (wxStatusBar*)NULL; }
@@ -131,37 +138,38 @@ public:
virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH),
int WXUNUSED(maxW), int WXUNUSED(maxH),
int WXUNUSED(incW), int WXUNUSED(incH) ) {}
#if wxUSE_TOOLBAR
// no toolbar bars
virtual wxToolBar* CreateToolBar( long WXUNUSED(style), wxWindowID WXUNUSED(id),
virtual wxToolBar* CreateToolBar( long WXUNUSED(style), wxWindowID WXUNUSED(id),
const wxString& WXUNUSED(name) ) { return (wxToolBar*)NULL; }
virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
#endif
// no icon
void SetIcon( const wxIcon &icon ) { m_icon = icon; }
// no title
void SetTitle( const wxString &title ) { m_title = title; }
// no title
void SetTitle( const wxString &title );
wxString GetTitle() const { return m_title; }
// no maximize etc
virtual void Maximize( bool WXUNUSED(maximize) ) {}
virtual void Restore() {}
virtual bool IsTopLevel() const { return FALSE; }
void OnActivate( wxActivateEvent &event );
// implementation
void OnActivate( wxActivateEvent& event );
void OnMenuHighlight( wxMenuEvent& event );
// implementation
wxMenuBar *m_menuBar;
GtkNotebookPage *m_page;
bool m_justInserted;
private:
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
};

View File

@@ -21,15 +21,13 @@
#include "wx/gdiobj.h"
#include "wx/gdicmn.h"
#include <gtk/gtk.h> // only needed for wxGTKDash, should it go elsewhere..
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxPen;
#if GTK_CHECK_VERSION(1,2,7)
#ifdef __WXGTK127__
typedef gint8 wxGTKDash;
#else
typedef gchar wxGTKDash;
@@ -47,8 +45,8 @@ public:
wxPen( const wxPen& pen );
~wxPen();
wxPen& operator = ( const wxPen& pen );
bool operator == ( const wxPen& pen );
bool operator != ( const wxPen& pen );
bool operator == ( const wxPen& pen ) const;
bool operator != ( const wxPen& pen ) const;
void SetColour( const wxColour &colour );
void SetColour( int red, int green, int blue );

View File

@@ -43,24 +43,37 @@ extern const char *wxRadioBoxNameStr;
class wxRadioBox: public wxControl
{
public:
wxRadioBox();
inline wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
int majorDim = 1, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxRadioBoxNameStr )
wxRadioBox() { Init(); }
wxRadioBox(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0,
const wxString choices[] = (const wxString *) NULL,
int majorDim = 1,
long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxRadioBoxNameStr)
{
Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
Init();
Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
}
~wxRadioBox(void);
bool Create( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxRadioBoxNameStr );
~wxRadioBox();
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0,
const wxString choices[] = (const wxString *) NULL,
int majorDim = 0,
long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxRadioBoxNameStr);
int FindString( const wxString& s) const;
void SetSelection( int n );
int GetSelection() const;
@@ -100,12 +113,20 @@ public:
void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
#endif // wxUSE_TOOLTIPS
wxSize LayoutItems();
void DoSetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO );
virtual void DoSetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO );
virtual void OnInternalIdle();
bool m_alreadySent;
bool m_hasFocus,
m_lostFocus;
int m_majorDim;
wxList m_boxes;
protected:
// common part of all ctors
void Init();
private:
DECLARE_DYNAMIC_CLASS(wxRadioBox)
};

View File

@@ -70,8 +70,8 @@ public:
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
~wxBitmap();
wxBitmap& operator = ( const wxBitmap& bmp );
bool operator == ( const wxBitmap& bmp );
bool operator != ( const wxBitmap& bmp );
bool operator == ( const wxBitmap& bmp ) const;
bool operator != ( const wxBitmap& bmp ) const;
bool Ok() const;
bool Create(int width, int height, int depth = -1);

View File

@@ -74,6 +74,10 @@ public:
void SetBitmapLabel( const wxBitmap& bitmap );
void SetBitmapSelected( const wxBitmap& bitmap );
void SetMargins(int x, int y) { m_marginX = x; m_marginY = y; }
int GetMarginX() const { return m_marginX; }
int GetMarginY() const { return m_marginY; }
virtual bool Enable(bool enable);
// implementation
@@ -93,6 +97,10 @@ public:
wxBitmap m_focus;
wxBitmap m_selected;
protected:
int m_marginX;
int m_marginY;
private:
DECLARE_DYNAMIC_CLASS(wxBitmapButton)
};

View File

@@ -40,8 +40,8 @@ public:
wxBrush( const wxBrush &brush );
~wxBrush();
wxBrush& operator = ( const wxBrush& brush );
bool operator == ( const wxBrush& brush );
bool operator != ( const wxBrush& brush );
bool operator == ( const wxBrush& brush ) const;
bool operator != ( const wxBrush& brush ) const;
bool Ok() const;
int GetStyle() const;

View File

@@ -148,7 +148,6 @@ public:
bool m_needComputeScaleX,
m_needComputeScaleY; // not yet used
float m_scaleFactor; // wxPSDC wants to have this. Will disappear.
private:
DECLARE_ABSTRACT_CLASS(wxDC)

View File

@@ -103,6 +103,9 @@ protected:
// common part of all ctors
void Init();
// common part of Destroy() and ~wxDialog
void CleanUp();
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);

View File

@@ -36,6 +36,16 @@ class wxFileDropTarget;
class wxDropSource;
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
// this macro may be used instead for wxDropSource ctor arguments: it will use
// the icon 'name' from an XPM file under GTK, but will expand to something
// else under MSW. If you don't use it, you will have to use #ifdef in the
// application code.
#define wxDROP_ICON(name) wxICON(name)
//-------------------------------------------------------------------------
// wxDropTarget
//-------------------------------------------------------------------------
@@ -78,12 +88,16 @@ class wxDropSource: public wxDropSourceBase
public:
/* constructor. set data later with SetData() */
wxDropSource( wxWindow *win = (wxWindow *)NULL,
const wxIcon &go = wxNullIcon );
const wxIcon &copy = wxNullIcon,
const wxIcon &move = wxNullIcon,
const wxIcon &none = wxNullIcon);
/* constructor for setting one data object */
wxDropSource( wxDataObject& data,
wxWindow *win,
const wxIcon &go = wxNullIcon );
const wxIcon &copy = wxNullIcon,
const wxIcon &move = wxNullIcon,
const wxIcon &none = wxNullIcon);
~wxDropSource();
@@ -94,7 +108,7 @@ public:
void RegisterWindow();
void UnregisterWindow();
void PrepareIcon( int hot_x, int hot_y, GdkDragContext *context );
void PrepareIcon( int action, GdkDragContext *context );
GtkWidget *m_widget;
GtkWidget *m_iconWindow;
@@ -102,9 +116,17 @@ public:
wxWindow *m_window;
wxDragResult m_retValue;
wxIcon m_icon;
wxIcon m_iconCopy,
m_iconMove,
m_iconNone;
bool m_waiting;
private:
// common part of both ctors
void SetIcons(const wxIcon& copy,
const wxIcon& move,
const wxIcon& none);
};
#endif

View File

@@ -1,10 +1,10 @@
/////////////////////////////////////////////////////////////////////////////
// Name: mdi.h
// Name: gtk/mdi.h
// Purpose:
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -45,12 +45,20 @@ extern const wxChar* wxStatusLineNameStr;
class wxMDIParentFrame: public wxFrame
{
public:
wxMDIParentFrame();
wxMDIParentFrame( wxWindow *parent,
wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxFrameNameStr );
wxMDIParentFrame() { Init(); }
wxMDIParentFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxFrameNameStr)
{
Init();
(void)Create(parent, id, title, pos, size, style, name);
}
~wxMDIParentFrame(void);
bool Create( wxWindow *parent,
wxWindowID id, const wxString& title,
@@ -60,32 +68,31 @@ public:
void GetClientSize(int *width, int *height) const;
wxMDIChildFrame *GetActiveChild() const;
wxMDIClientWindow *GetClientWindow() const;
wxMDIClientWindow *GetClientWindow() const;
virtual wxMDIClientWindow *OnCreateClient();
virtual void Cascade() {}
virtual void Tile() {}
virtual void ArrangeIcons() {}
virtual void ActivateNext();
virtual void ActivatePrevious();
void OnActivate( wxActivateEvent& event );
void OnSysColourChanged( wxSysColourChangedEvent& event );
// implementation
// implementation
wxMDIClientWindow *m_clientWindow;
bool m_justInserted;
virtual void GtkOnSize( int x, int y, int width, int height );
virtual void OnInternalIdle();
protected:
void Init();
private:
friend class wxMDIChildFrame;
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
DECLARE_EVENT_TABLE()
};
//-----------------------------------------------------------------------------
@@ -105,7 +112,7 @@ public:
wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr );
virtual void SetMenuBar( wxMenuBar *menu_bar );
virtual wxMenuBar *GetMenuBar() const;
@@ -113,11 +120,11 @@ public:
virtual void AddChild( wxWindowBase *child );
virtual void Activate();
#if wxUSE_STATUSBAR
// no status bars
virtual wxStatusBar* CreateStatusBar( int WXUNUSED(number) = 1,
long WXUNUSED(style) = 1,
long WXUNUSED(style) = 1,
wxWindowID WXUNUSED(id) = 1,
const wxString& WXUNUSED(name) = wxEmptyString)
{ return (wxStatusBar*)NULL; }
@@ -131,37 +138,38 @@ public:
virtual void SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH),
int WXUNUSED(maxW), int WXUNUSED(maxH),
int WXUNUSED(incW), int WXUNUSED(incH) ) {}
#if wxUSE_TOOLBAR
// no toolbar bars
virtual wxToolBar* CreateToolBar( long WXUNUSED(style), wxWindowID WXUNUSED(id),
virtual wxToolBar* CreateToolBar( long WXUNUSED(style), wxWindowID WXUNUSED(id),
const wxString& WXUNUSED(name) ) { return (wxToolBar*)NULL; }
virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
#endif
// no icon
void SetIcon( const wxIcon &icon ) { m_icon = icon; }
// no title
void SetTitle( const wxString &title ) { m_title = title; }
// no title
void SetTitle( const wxString &title );
wxString GetTitle() const { return m_title; }
// no maximize etc
virtual void Maximize( bool WXUNUSED(maximize) ) {}
virtual void Restore() {}
virtual bool IsTopLevel() const { return FALSE; }
void OnActivate( wxActivateEvent &event );
// implementation
void OnActivate( wxActivateEvent& event );
void OnMenuHighlight( wxMenuEvent& event );
// implementation
wxMenuBar *m_menuBar;
GtkNotebookPage *m_page;
bool m_justInserted;
private:
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
};

View File

@@ -21,15 +21,13 @@
#include "wx/gdiobj.h"
#include "wx/gdicmn.h"
#include <gtk/gtk.h> // only needed for wxGTKDash, should it go elsewhere..
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxPen;
#if GTK_CHECK_VERSION(1,2,7)
#ifdef __WXGTK127__
typedef gint8 wxGTKDash;
#else
typedef gchar wxGTKDash;
@@ -47,8 +45,8 @@ public:
wxPen( const wxPen& pen );
~wxPen();
wxPen& operator = ( const wxPen& pen );
bool operator == ( const wxPen& pen );
bool operator != ( const wxPen& pen );
bool operator == ( const wxPen& pen ) const;
bool operator != ( const wxPen& pen ) const;
void SetColour( const wxColour &colour );
void SetColour( int red, int green, int blue );

View File

@@ -43,24 +43,37 @@ extern const char *wxRadioBoxNameStr;
class wxRadioBox: public wxControl
{
public:
wxRadioBox();
inline wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
int majorDim = 1, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxRadioBoxNameStr )
wxRadioBox() { Init(); }
wxRadioBox(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0,
const wxString choices[] = (const wxString *) NULL,
int majorDim = 1,
long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxRadioBoxNameStr)
{
Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
Init();
Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
}
~wxRadioBox(void);
bool Create( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxRadioBoxNameStr );
~wxRadioBox();
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0,
const wxString choices[] = (const wxString *) NULL,
int majorDim = 0,
long style = wxRA_HORIZONTAL,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxRadioBoxNameStr);
int FindString( const wxString& s) const;
void SetSelection( int n );
int GetSelection() const;
@@ -100,12 +113,20 @@ public:
void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
#endif // wxUSE_TOOLTIPS
wxSize LayoutItems();
void DoSetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO );
virtual void DoSetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO );
virtual void OnInternalIdle();
bool m_alreadySent;
bool m_hasFocus,
m_lostFocus;
int m_majorDim;
wxList m_boxes;
protected:
// common part of all ctors
void Init();
private:
DECLARE_DYNAMIC_CLASS(wxRadioBox)
};

View File

@@ -200,8 +200,8 @@ private:
// defines a new type safe hash table which stores the elements of type eltype
// in lists of class listclass
#define WX_DECLARE_HASH(eltype, listclass, hashclass) \
class WXDLLEXPORT hashclass : public wxHashTableBase \
#define _WX_DECLARE_HASH(eltype, listclass, hashclass, classexp) \
classexp hashclass : public wxHashTableBase \
{ \
public: \
hashclass(wxKeyType keyType = wxKEY_INTEGER, \
@@ -258,5 +258,14 @@ private:
} \
}
// this macro is to be used in the user code
#define WX_DECLARE_HASH(el, list, hash) \
_WX_DECLARE_HASH(el, list, hash, class)
// and this one does exactly the same thing but should be used inside the
// library
#define WX_DECLARE_EXPORTED_HASH(el, list, hash) \
_WX_DECLARE_HASH(el, list, hash, class WXDLLEXPORT)
#endif
// _WX_HASH_H__

View File

@@ -30,48 +30,52 @@
// Defines the API for help controllers
class WXDLLEXPORT wxHelpControllerBase: public wxObject
{
DECLARE_CLASS(wxHelpControllerBase)
DECLARE_CLASS(wxHelpControllerBase)
public:
inline wxHelpControllerBase() {}
inline ~wxHelpControllerBase() {};
// Must call this to set the filename and server name.
// server is only required when implementing TCP/IP-based
// help controllers.
virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return FALSE; }
virtual bool Initialize(const wxString& WXUNUSED(file)) { return FALSE; }
// Set viewer: only relevant to some kinds of controller
virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
// If file is "", reloads file given in Initialize
virtual bool LoadFile(const wxString& file = "") = 0;
virtual bool DisplayContents(void) = 0;
virtual bool DisplaySection(int sectionNo) = 0;
public:
inline wxHelpControllerBase() {}
inline ~wxHelpControllerBase() {};
// Must call this to set the filename and server name.
// server is only required when implementing TCP/IP-based
// help controllers.
virtual bool Initialize(const wxString& WXUNUSED(file), int WXUNUSED(server) ) { return FALSE; }
virtual bool Initialize(const wxString& WXUNUSED(file)) { return FALSE; }
// Set viewer: only relevant to some kinds of controller
virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
// If file is "", reloads file given in Initialize
virtual bool LoadFile(const wxString& file = "") = 0;
virtual bool DisplayContents(void) = 0;
virtual bool DisplaySection(int sectionNo) = 0;
virtual bool DisplayBlock(long blockNo) = 0;
virtual bool KeywordSearch(const wxString& k) = 0;
/// Allows one to override the default settings for the help frame.
virtual void SetFrameParameters(const wxString& WXUNUSED(title),
const wxSize& WXUNUSED(size),
const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
bool WXUNUSED(newFrameEachTime) = FALSE)
{
// does nothing by default
}
/// Obtains the latest settings used by the help frame and the help
/// frame.
virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
wxPoint *WXUNUSED(pos) = NULL,
bool *WXUNUSED(newFrameEachTime) = NULL)
{
return (wxFrame*) NULL;// does nothing by default
}
virtual bool Quit(void) = 0;
virtual void OnQuit(void) {};
// By default, uses KeywordSection to display a topic. Implementations
// may override this for more specific behaviour.
virtual bool DisplaySection(const wxString& section) { return KeywordSearch(section); };
virtual bool DisplayBlock(long blockNo) = 0;
virtual bool KeywordSearch(const wxString& k) = 0;
/// Allows one to override the default settings for the help frame.
virtual void SetFrameParameters(const wxString& WXUNUSED(title),
const wxSize& WXUNUSED(size),
const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
bool WXUNUSED(newFrameEachTime) = FALSE)
{
// does nothing by default
}
/// Obtains the latest settings used by the help frame and the help
/// frame.
virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
wxPoint *WXUNUSED(pos) = NULL,
bool *WXUNUSED(newFrameEachTime) = NULL)
{
return (wxFrame*) NULL;// does nothing by default
}
virtual bool Quit(void) = 0;
virtual void OnQuit(void) {};
};
#endif // wxUSE_HELP
#endif
// _WX_HELPBASEH__
// _WX_HELPBASEH__

View File

@@ -70,6 +70,7 @@ class WXDLLEXPORT wxHtmlHelpController : public wxHelpControllerBase // wxEvtHan
virtual void SetViewer(const wxString& WXUNUSED(viewer), long WXUNUSED(flags) = 0) {}
virtual bool LoadFile(const wxString& file = "");
virtual bool DisplaySection(int sectionNo);
virtual bool DisplaySection(const wxString& section) { return Display(section); }
virtual bool DisplayBlock(long blockNo) { return DisplaySection(blockNo); }
virtual void SetFrameParameters(const wxString& title,
const wxSize& size,

View File

@@ -43,7 +43,9 @@
#define wxHF_BOOKMARKS 0x0010
#define wxHF_OPENFILES 0x0020
#define wxHF_PRINT 0x0040
#define wxHF_DEFAULTSTYLE (wxHF_TOOLBAR | wxHF_CONTENTS | wxHF_INDEX | wxHF_SEARCH | wxHF_BOOKMARKS | wxHF_PRINT)
#define wxHF_FLATTOOLBAR 0x0080
#define wxHF_DEFAULTSTYLE (wxHF_TOOLBAR | wxHF_CONTENTS | wxHF_INDEX | \
wxHF_SEARCH | wxHF_BOOKMARKS | wxHF_PRINT)
// Command IDs :

View File

@@ -179,14 +179,14 @@ class WXDLLEXPORT wxHtmlEasyPrinting : public wxObject
wxHtmlEasyPrinting(const wxString& name = "Printing", wxFrame *parent_frame = NULL);
~wxHtmlEasyPrinting();
void PreviewFile(const wxString &htmlfile);
void PreviewText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
bool PreviewFile(const wxString &htmlfile);
bool PreviewText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
// Preview file / html-text for printing
// (and offers printing)
// basepath is base directory for opening subsequent files (e.g. from <img> tag)
void PrintFile(const wxString &htmlfile);
void PrintText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
bool PrintFile(const wxString &htmlfile);
bool PrintText(const wxString &htmltext, const wxString& basepath = wxEmptyString);
// Print file / html-text w/o preview
void PrinterSetup();
@@ -211,8 +211,8 @@ class WXDLLEXPORT wxHtmlEasyPrinting : public wxObject
private:
wxHtmlPrintout *CreatePrintout();
void DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2);
void DoPrint(wxHtmlPrintout *printout);
bool DoPreview(wxHtmlPrintout *printout1, wxHtmlPrintout *printout2);
bool DoPrint(wxHtmlPrintout *printout);
wxPrintData *m_PrintData;
wxPageSetupDialogData *m_PageSetupData;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View File

@@ -66,6 +66,7 @@ class WXDLLEXPORT wxHtmlWinParser : public wxHtmlParser
static void AddModule(wxHtmlTagsModule *module);
// Adds tags module. see wxHtmlTagsModule for details.
static void RemoveModule(wxHtmlTagsModule *module);
// parsing-related methods. These methods are called by tag handlers:
wxHtmlContainerCell *GetContainer() const {return m_Container;}

View File

@@ -16,28 +16,29 @@
#include "wx/image.h"
//-----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxBMPHandler
//-----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBMPHandler: public wxImageHandler
class WXDLLEXPORT wxBMPHandler : public wxImageHandler
{
DECLARE_DYNAMIC_CLASS(wxBMPHandler)
public:
inline wxBMPHandler()
wxBMPHandler()
{
m_name = "BMP file";
m_extension = "bmp";
m_name = _T("BMP file");
m_extension = _T("bmp");
m_type = wxBITMAP_TYPE_BMP;
m_mime = "image/bmp";
m_mime = _T("image/bmp");
};
#if wxUSE_STREAMS
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=0 );
virtual bool DoCanRead( wxInputStream& stream );
#endif
#endif // wxUSE_STREAMS
DECLARE_DYNAMIC_CLASS(wxBMPHandler)
};

View File

@@ -89,6 +89,7 @@ class WXDLLEXPORT wxImage: public wxObject
public:
wxImage();
wxImage( int width, int height );
wxImage( int width, int height, unsigned char* data, bool static_data = FALSE );
wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY );
wxImage( wxInputStream& stream, long type = wxBITMAP_TYPE_ANY );
wxImage( const wxString& name, const wxString& mimetype );
@@ -97,7 +98,6 @@ public:
wxImage( const wxImage& image );
wxImage( const wxImage* image );
// these functions get implemented in /src/(platform)/bitmap.cpp
wxImage( const wxBitmap &bitmap );
operator wxBitmap() const { return ConvertToBitmap(); }
wxBitmap ConvertToBitmap() const;
@@ -106,10 +106,19 @@ public:
#endif
void Create( int width, int height );
void Create( int width, int height, unsigned char* data, bool static_data = FALSE );
void Destroy();
// creates an identical copy of the image (the = operator
// just raises the ref count)
wxImage Copy() const;
// return the new image with size width*height
wxImage GetSubImage( const wxRect& ) const;
// pastes image into this instance and takes care of
// the mask colour and out of bounds problems
void Paste( const wxImage &image, int x, int y );
// return the new image with size width*height
wxImage Scale( int width, int height ) const;
@@ -120,7 +129,10 @@ public:
// Rotates the image about the given point, 'angle' radians.
// Returns the rotated image, leaving this image intact.
wxImage Rotate(double angle, const wxPoint & centre_of_rotation,
bool interpolating = TRUE, wxPoint * offset_after_rotation = (wxPoint*) NULL) const ;
bool interpolating = TRUE, wxPoint * offset_after_rotation = (wxPoint*) NULL) const;
wxImage Rotate90( bool clockwise = TRUE ) const;
wxImage Mirror( bool horizontally = TRUE ) const;
// replace one colour with another
void Replace( unsigned char r1, unsigned char g1, unsigned char b1,
@@ -128,9 +140,9 @@ public:
// these routines are slow but safe
void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b );
unsigned char GetRed( int x, int y );
unsigned char GetGreen( int x, int y );
unsigned char GetBlue( int x, int y );
unsigned char GetRed( int x, int y ) const;
unsigned char GetGreen( int x, int y ) const;
unsigned char GetBlue( int x, int y ) const;
static bool CanRead( const wxString& name );
virtual bool LoadFile( const wxString& name, long type = wxBITMAP_TYPE_ANY );
@@ -156,7 +168,8 @@ public:
char unsigned *GetData() const;
void SetData( char unsigned *data );
void SetData( char unsigned *data, int new_width, int new_height );
void SetMaskColour( unsigned char r, unsigned char g, unsigned char b );
unsigned char GetMaskRed() const;
unsigned char GetMaskGreen() const;

View File

@@ -48,7 +48,8 @@ class WXDLLEXPORT wxClientBase;
class WXDLLEXPORT wxConnectionBase: public wxObject
{
DECLARE_CLASS(wxConnectionBase)
public:
public:
inline wxConnectionBase(void) {}
inline ~wxConnectionBase(void) {}
@@ -102,8 +103,7 @@ class WXDLLEXPORT wxConnectionBase: public wxObject
wxIPCFormat WXUNUSED(format) )
{ return FALSE; };
// Callbacks to BOTH
// Callbacks to BOTH - override at will
// Default behaviour is to delete connection and return TRUE
virtual bool OnDisconnect(void) = 0;
};
@@ -111,28 +111,35 @@ class WXDLLEXPORT wxConnectionBase: public wxObject
class WXDLLEXPORT wxServerBase: public wxObject
{
DECLARE_CLASS(wxServerBase)
public:
public:
inline wxServerBase(void) {}
inline ~wxServerBase(void) {};
virtual bool Create(const wxString& serverName) = 0; // Returns FALSE if can't create server (e.g. port
// number is already in use)
virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0;
// Returns FALSE on error (e.g. port number is already in use)
virtual bool Create(const wxString& serverName) = 0;
// Callbacks to SERVER - override at will
virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0;
};
class WXDLLEXPORT wxClientBase: public wxObject
{
DECLARE_CLASS(wxClientBase)
public:
public:
inline wxClientBase(void) {};
inline ~wxClientBase(void) {};
virtual bool ValidHost(const wxString& host) = 0;
virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic) = 0;
// Call this to make a connection.
// Returns NULL if cannot.
virtual wxConnectionBase *OnMakeConnection(void) = 0; // Tailor this to return own connection.
virtual bool ValidHost(const wxString& host) = 0;
// Call this to make a connection. Returns NULL if cannot.
virtual wxConnectionBase *MakeConnection(const wxString& host,
const wxString& server,
const wxString& topic) = 0;
// Callbacks to CLIENT - override at will
virtual wxConnectionBase *OnMakeConnection(void) = 0;
};
#endif

View File

@@ -34,7 +34,6 @@
// -----------------------------------------------------------------------------
#include "wx/defs.h"
#include "wx/debug.h"
#include "wx/object.h"
#include "wx/string.h"
@@ -353,10 +352,10 @@ private:
// wxWindowBase pointers are put into the list, but wxWindow pointers are
// retrieved from it.
#define WX_DECLARE_LIST_3(T, Tbase, name, nodetype) \
#define WX_DECLARE_LIST_3(T, Tbase, name, nodetype, classexp) \
typedef int (*wxSortFuncFor_##name)(const T **, const T **); \
\
class WXDLLEXPORT nodetype : public wxNodeBase \
classexp nodetype : public wxNodeBase \
{ \
public: \
nodetype(wxListBase *list = (wxListBase *)NULL, \
@@ -379,7 +378,7 @@ private:
virtual void DeleteData(); \
}; \
\
class WXDLLEXPORT name : public wxListBase \
classexp name : public wxListBase \
{ \
public: \
typedef nodetype Node; \
@@ -389,6 +388,9 @@ private:
name(size_t count, T *elements[]) \
: wxListBase(count, (void **)elements) { } \
\
name& operator=(const name& list) \
{ return (name&)wxListBase::operator=(list); } \
\
nodetype *GetFirst() const \
{ return (nodetype *)wxListBase::GetFirst(); } \
nodetype *GetLast() const \
@@ -447,12 +449,16 @@ private:
} \
}
#define WX_DECLARE_LIST_2(elementtype, listname, nodename) \
WX_DECLARE_LIST_3(elementtype, elementtype, listname, nodename)
#define WX_DECLARE_LIST_2(elementtype, listname, nodename, classexp) \
WX_DECLARE_LIST_3(elementtype, elementtype, listname, nodename, classexp)
#define WX_DECLARE_LIST(elementtype, listname) \
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node)
WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class)
#define WX_DECLARE_EXPORTED_LIST(elementtype, listname) \
typedef elementtype _WX_LIST_ITEM_TYPE_##listname; \
WX_DECLARE_LIST_2(elementtype, listname, wx##listname##Node, class WXDLLEXPORT)
// this macro must be inserted in your program after
// #include <wx/listimpl.cpp>
@@ -472,13 +478,16 @@ private:
// wxList compatibility class: in fact, it's a list of wxObjects
// -----------------------------------------------------------------------------
WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode);
WX_DECLARE_LIST_2(wxObject, wxObjectList, wxObjectListNode, class WXDLLEXPORT);
class WXDLLEXPORT wxList : public wxObjectList
{
public:
wxList(int key_type = wxKEY_NONE) : wxObjectList((wxKeyType)key_type) { }
wxList& operator=(const wxList& list)
{ return (wxList&)wxListBase::operator=(list); }
// compatibility methods
void Sort(wxSortCompareFunction compfunc) { wxListBase::Sort(compfunc); }
@@ -489,7 +498,7 @@ public:
// wxStringList class for compatibility with the old code
// -----------------------------------------------------------------------------
WX_DECLARE_LIST_2(wxChar, wxStringListBase, wxStringListNode);
WX_DECLARE_LIST_2(wxChar, wxStringListBase, wxStringListNode, class WXDLLEXPORT);
class WXDLLEXPORT wxStringList : public wxStringListBase
{

View File

@@ -9,10 +9,10 @@
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#define _DEFINE_LIST(T, name) \
void wx##name##Node::DeleteData() \
{ \
delete (T *)GetData(); \
#define _DEFINE_LIST(T, name) \
void wx##name##Node::DeleteData() \
{ \
delete (T *)GetData(); \
}
// redefine the macro so that now it will generate the class implementation

View File

@@ -298,12 +298,6 @@ protected:
// empty everything
void Clear();
// the translated titles for misc message boxes: only translate ones to
// avoid reentrancy problems later
wxString m_error,
m_warning,
m_info;
wxArrayString m_aMessages; // the log message texts
wxArrayInt m_aSeverity; // one of wxLOG_XXX values
wxArrayLong m_aTimes; // the time of each message
@@ -327,15 +321,15 @@ public:
~wxLogWindow();
// window operations
// show/hide the log window
// show/hide the log window
void Show(bool bShow = TRUE);
// retrieve the pointer to the frame
// retrieve the pointer to the frame
wxFrame *GetFrame() const;
// accessors
// the previous log target (may be NULL)
// the previous log target (may be NULL)
wxLog *GetOldLog() const { return m_pOldLog; }
// are we passing the messages to the previous log target?
// are we passing the messages to the previous log target?
bool IsPassingMessages() const { return m_bPassMessages; }
// we can pass the messages to the previous log target (we're in this mode by
@@ -344,14 +338,20 @@ public:
void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; }
// base class virtuals
// we don't need it ourselves, but we pass it to the previous logger
// we don't need it ourselves, but we pass it to the previous logger
virtual void Flush();
// overridables
// called immediately after the log frame creation allowing for
// any extra initializations
// called immediately after the log frame creation allowing for
// any extra initializations
virtual void OnFrameCreate(wxFrame *frame);
// called right before the log frame is going to be deleted
// called if the user closes the window interactively, will not be
// called if it is destroyed for another reason (such as when program
// exits) - return TRUE from here to allow the frame to close, FALSE
// to prevent this from happening
virtual bool OnFrameClose(wxFrame *frame);
// called right before the log frame is going to be deleted: will
// always be called unlike OnFrameClose()
virtual void OnFrameDelete(wxFrame *frame);
protected:
@@ -471,7 +471,7 @@ DECLARE_LOG_FUNCTION2(SysError, long lErrCode);
// this second version will only log the message if the mask had been
// added to the list of masks with AddTraceMask()
DECLARE_LOG_FUNCTION2(Trace, const char *mask);
DECLARE_LOG_FUNCTION2(Trace, const wxChar *mask);
// the last one does nothing if all of level bits are not set
// in wxLog::GetActive()->GetTraceMask() - it's deprecated in favour of
@@ -500,13 +500,13 @@ DECLARE_LOG_FUNCTION2(SysError, long lErrCode);
#ifdef __VISUALC__
#define wxLogApiError(api, rc) \
wxLogDebug(wxT("%s(%d): '%s' failed with error 0x%08lx (%s)."), \
__TFILE__, __LINE__, _T(api), \
__TFILE__, __LINE__, api, \
rc, wxSysErrorMsg(rc))
#else // !VC++
#define wxLogApiError(api, rc) \
wxLogDebug(wxT("In file %s at line %d: '%s' failed with " \
"error 0x%08lx (%s)."), \
__TFILE__, __LINE__, _T(api), \
__TFILE__, __LINE__, api, \
rc, wxSysErrorMsg(rc))
#endif // VC++/!VC++

View File

@@ -3,8 +3,6 @@
// Purpose: declaration of wxLongLong class - best implementation of a 64
// bit integer for the current platform.
// Author: Jeffrey C. Ollie <jeff@ollie.clive.ia.us>, Vadim Zeitlin
// Remarks: this class is not public in wxWindows 2.0! It is intentionally
// not documented and is for private use only.
// Modified by:
// Created: 10.02.99
// RCS-ID: $Id$
@@ -21,7 +19,6 @@
#include "wx/defs.h"
#include "wx/wxchar.h"
#include "wx/debug.h"
#include <limits.h> // for LONG_MAX
@@ -30,7 +27,7 @@
// wxLongLongNative -- this is extremely useful to find the bugs in
// wxLongLongWx class!
//#define wxLONGLONG_TEST_MODE
// #define wxLONGLONG_TEST_MODE
#ifdef wxLONGLONG_TEST_MODE
#define wxUSE_LONGLONG_WX 1
@@ -53,7 +50,7 @@
#define wxLongLongIsLong
#elif (defined(__VISUALC__) && defined(__WIN32__)) || defined( __VMS__ )
#define wxLongLong_t __int64
#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x530)
#elif defined(__BORLANDC__) && defined(__WIN32__) && (__BORLANDC__ >= 0x520)
#define wxLongLong_t __int64
#elif defined(__GNUG__)
#define wxLongLong_t long long
@@ -75,7 +72,6 @@
#pragma warning "Your compiler does not appear to support 64 bit "\
"integers, using emulation class instead."
#endif
#define wxUSE_LONGLONG_WX 1
#endif // compiler
@@ -460,6 +456,17 @@ public:
bool operator>=(const wxLongLongWx& ll) const
{ return *this > ll || *this == ll; }
bool operator<(long l) const { return *this < wxLongLongWx(l); }
bool operator>(long l) const { return *this > wxLongLongWx(l); }
bool operator==(long l) const
{
return l >= 0 ? (m_hi == 0 && m_lo == (unsigned long)l)
: (m_hi == -1 && m_lo == (unsigned long)l);
}
bool operator<=(long l) const { return *this < l || *this == l; }
bool operator>=(long l) const { return *this > l || *this == l; }
// multiplication
wxLongLongWx operator*(const wxLongLongWx& ll) const;
wxLongLongWx& operator*=(const wxLongLongWx& ll);

View File

@@ -375,8 +375,6 @@ class WXDLLEXPORT wxDC: public wxObject
bool m_needComputeScaleX,m_needComputeScaleY; // not yet used
float m_scaleFactor; // wxPSDC wants to have this. Will disappear.
long m_clipX1,m_clipY1,m_clipX2,m_clipY2;
long m_minX,m_maxX,m_minY,m_maxY;

View File

@@ -262,17 +262,27 @@
// Set this to 0 if your compiler can't cope
// with omission of prototype parameters.
#define wxUSE_ODBC 1
// Define 1 to use ODBC classes
#define wxUSE_ODBC 1
// Define 1 to use ODBC classes
#define wxODBC_FWD_ONLY_CURSORS 1
// Some databases/ODBC drivers only allow forward scrolling cursors.
// Unless you specifically want to use backward scrolling
// cursors, and you know that all of the databases/ODBC drivers
// that you will use these odbc classes with allow backward
// scrolling cursors, this setting should remain set to 1
// for maximum database/driver compatibilty
#define wxODBC_FWD_ONLY_CURSORS 1
// For backward compatibility reasons, this parameter now only
// controls the default scrolling method used by cursors. This
// default behavior can be overriden by setting the second param
// of wxDB::GetDbConnection() to indicate whether the connection
// (and any wxTable()s that use the connection) should support
// forward only scrolling of cursors, or both forward and backward
// Support for backward scrolling cursors is dependent on the
// data source as well as the ODBC driver being used.
#define wxODBC_BACKWARD_COMPATABILITY 0
// Default is 0. Set to 1 to use the deprecated classes, enum
// types, function, member variables. With a setting of 1, full
// backward compatability with the 2.0.x release is possible.
// It is STRONGLY recommended that this be set to 0, as
// future development will be done only on the non-deprecated
// functions/classes/member variables/etc.

View File

@@ -32,8 +32,8 @@ class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxMenuItem;
// pseudo template list classes
WX_DECLARE_LIST(wxMenu, wxMenuList);
WX_DECLARE_LIST(wxMenuItem, wxMenuItemList);
WX_DECLARE_EXPORTED_LIST(wxMenu, wxMenuList);
WX_DECLARE_EXPORTED_LIST(wxMenuItem, wxMenuItemList);
// ----------------------------------------------------------------------------
// conditional compilation
@@ -102,6 +102,59 @@ public:
// insert an item before given position
bool Insert(size_t pos, wxMenuItem *item);
void Insert(size_t pos,
int id,
const wxString& text,
const wxString& help = wxEmptyString,
bool isCheckable = FALSE)
{
Insert(pos, wxMenuItem::New((wxMenu *)this, id, text, help, isCheckable));
}
// insert a separator
void InsertSeparator(size_t pos)
{
Insert(pos, wxMenuItem::New((wxMenu *)this));
}
// insert a submenu
void Insert(size_t pos,
int id,
const wxString& text,
wxMenu *submenu,
const wxString& help = wxEmptyString)
{
Insert(pos, wxMenuItem::New((wxMenu *)this, id, text, help, FALSE, submenu));
}
// prepend an item to the menu
void Prepend(wxMenuItem *item)
{
Insert(0u, item);
}
void Prepend(int id,
const wxString& text,
const wxString& help = wxEmptyString,
bool isCheckable = FALSE)
{
Insert(0u, id, text, help, isCheckable);
}
// insert a separator
void PrependSeparator()
{
InsertSeparator(0u);
}
// insert a submenu
void Prepend(int id,
const wxString& text,
wxMenu *submenu,
const wxString& help = wxEmptyString)
{
Insert(0u, id, text, submenu, help);
}
// detach an item from the menu, but don't delete it so that it can be
// added back later (but if it's not, the caller is responsible for

View File

@@ -21,7 +21,7 @@
// declare a linked list of modules
class wxModule;
WX_DECLARE_LIST(wxModule, wxModuleList);
WX_DECLARE_EXPORTED_LIST(wxModule, wxModuleList);
// declaring a class derived from wxModule will automatically create an
// instance of this class on program startup, call its OnInit() method and call

View File

@@ -183,8 +183,8 @@ public:
void SetMask(wxMask *mask) ;
wxBitmap& operator = (const wxBitmap& bitmap) { if (*this == bitmap) return (*this); Ref(bitmap); return *this; }
bool operator == (const wxBitmap& bitmap) { return m_refData == bitmap.m_refData; }
bool operator != (const wxBitmap& bitmap) { return m_refData != bitmap.m_refData; }
bool operator == (const wxBitmap& bitmap) const { return m_refData == bitmap.m_refData; }
bool operator != (const wxBitmap& bitmap) const { return m_refData != bitmap.m_refData; }
// Format handling
static wxList& GetHandlers() { return sm_handlers; }

View File

@@ -56,8 +56,8 @@ public:
virtual void SetStipple(const wxBitmap& stipple) ;
inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; }
inline bool operator == (const wxBrush& brush) { return m_refData == brush.m_refData; }
inline bool operator != (const wxBrush& brush) { return m_refData != brush.m_refData; }
inline bool operator == (const wxBrush& brush) const { return m_refData == brush.m_refData; }
inline bool operator != (const wxBrush& brush) const { return m_refData != brush.m_refData; }
inline wxColour& GetColour() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
inline int GetStyle() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); };

View File

@@ -96,6 +96,8 @@ protected:
WXWidget* m_widgetList ;
WXWidget m_formWidget;
wxStringList m_stringList;
wxList m_clientList; // contains the client data for the items
virtual void DoSetSize(int x, int y,
int width, int height,

View File

@@ -162,8 +162,6 @@ public:
// recompute scale?
bool m_needComputeScaleX, m_needComputeScaleY;
// wxPSDC wants to have this. Will disappear.
float m_scaleFactor;
};
#endif

View File

@@ -34,7 +34,7 @@ public:
wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
private:
friend wxPaintDC;
friend class wxPaintDC;
wxBitmap m_bitmap;
};

View File

@@ -61,8 +61,8 @@ public:
{ return wxBitmap::LoadFile(name, type); }
inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
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)); }
};

View File

@@ -66,8 +66,8 @@ public:
virtual bool Ok() const { return (m_refData != NULL) ; }
wxPalette& operator = (const wxPalette& palette) { if (*this == palette) return (*this); Ref(palette); return *this; }
bool operator == (const wxPalette& palette) { return m_refData == palette.m_refData; }
bool operator != (const wxPalette& palette) { 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
WXColormap GetXColormap(WXDisplay* display = NULL) const;

View File

@@ -57,8 +57,8 @@ public:
~wxPen();
inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; }
inline bool operator == (const wxPen& pen) { return m_refData == pen.m_refData; }
inline bool operator != (const wxPen& pen) { return m_refData != pen.m_refData; }
inline bool operator == (const wxPen& pen) const { return m_refData == pen.m_refData; }
inline bool operator != (const wxPen& pen) const { return m_refData != pen.m_refData; }
virtual bool Ok() const { return (m_refData != NULL) ; }

View File

@@ -142,8 +142,8 @@ public:
wxMask *GetMask() const { return (GetBitmapData() ? GetBitmapData()->m_bitmapMask : (wxMask*) NULL); }
void SetMask(wxMask *mask) ;
bool operator==(const wxBitmap& bitmap) { return m_refData == bitmap.m_refData; }
bool operator!=(const wxBitmap& bitmap) { return m_refData != bitmap.m_refData; }
bool operator==(const wxBitmap& bitmap) const { return m_refData == bitmap.m_refData; }
bool operator!=(const wxBitmap& bitmap) const { return m_refData != bitmap.m_refData; }
#if WXWIN_COMPATIBILITY_2
void SetOk(bool isOk);

View File

@@ -57,8 +57,8 @@ public:
virtual void SetStipple(const wxBitmap& stipple) ;
inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; }
inline bool operator == (const wxBrush& brush) { return m_refData == brush.m_refData; }
inline bool operator != (const wxBrush& brush) { return m_refData != brush.m_refData; }
inline bool operator == (const wxBrush& brush) const { return m_refData == brush.m_refData; }
inline bool operator != (const wxBrush& brush) const { return m_refData != brush.m_refData; }
inline wxColour& GetColour(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
inline int GetStyle(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); };

View File

@@ -66,6 +66,8 @@ public:
// MSW only
virtual bool MSWCommand(WXUINT param, WXWORD id);
long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
protected:
virtual void DoSetItemClientData( int n, void* clientData );

View File

@@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: colordlg.h
// Name: wx/msw/colordlg.h
// Purpose: wxColourDialog class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COLORDLG_H_
@@ -20,25 +20,37 @@
#include "wx/dialog.h"
#include "wx/cmndata.h"
/*
* COLOUR DIALOG
*/
// ----------------------------------------------------------------------------
// wxColourDialog: dialog for choosing a colours
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxColourDialog: public wxDialog
class WXDLLEXPORT wxColourDialog : public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxColourDialog)
public:
wxColourDialog(void);
wxColourDialog();
wxColourDialog(wxWindow *parent, wxColourData *data = NULL);
bool Create(wxWindow *parent, wxColourData *data = NULL);
int ShowModal(void);
wxColourData& GetColourData(void) { return m_colourData; }
wxColourData& GetColourData() { return m_colourData; }
// override some base class virtuals
virtual void SetTitle(const wxString& title);
virtual wxString GetTitle();
virtual int ShowModal();
protected:
virtual void DoGetSize(int *width, int *height) const;
virtual void DoGetClientSize(int *width, int *height) const;
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
wxColourData m_colourData;
wxWindow* m_dialogParent;
wxString m_title;
DECLARE_DYNAMIC_CLASS(wxColourDialog)
};
#endif

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: combobox.h
// Name: wx/msw/combobox.h
// Purpose: wxComboBox class
// Author: Julian Smart
// Modified by:
@@ -46,14 +46,16 @@ public:
Create(parent, id, value, pos, size, n, choices, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr);
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0,
const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr);
// List functions: see wxChoice
@@ -75,7 +77,13 @@ public:
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
// implementation only from now on
virtual bool MSWCommand(WXUINT param, WXWORD id);
bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam);
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
WXHWND GetEditHWND() const;
protected:
virtual void DoMoveWindow(int x, int y, int width, int height);

View File

@@ -78,6 +78,11 @@ public:
virtual bool RealizeResource();
virtual WXHANDLE GetResourceHandle();
virtual bool FreeResource(bool force = FALSE);
// for consistency with other wxMSW classes and to have a const
// GetResourceHandle()-like function we have a synonym for it
WXHFONT GetHFONT() const;
/*
virtual bool UseResource();
virtual bool ReleaseResource();

View File

@@ -149,6 +149,9 @@ protected:
static bool m_useNativeStatusBar;
#endif // wxUSE_STATUSBAR
// the last focused child: we restore focus to it on activation
wxWindow *m_winLastFocused;
// Data to save/restore when calling ShowFullScreen
long m_fsStyle; // Passed to ShowFullScreen
wxRect m_fsOldSize;

Some files were not shown because too many files have changed in this diff Show More