Compare commits
1 Commits
before_gtk
...
BEFORE_LON
Author | SHA1 | Date | |
---|---|---|---|
|
1186b7e57e |
2
include/.cvsignore
Normal file
2
include/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile.in
|
||||
|
2
include/wx/.cvsignore
Normal file
2
include/wx/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile.in
|
||||
|
21
include/wx/accel.h
Normal file
21
include/wx/accel.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_ACCEL_H_BASE_
|
||||
#define _WX_ACCEL_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/accel.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/accel.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/accel.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/accel.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/accel.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/accel.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/accel.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_ACCEL_H_BASE_
|
385
include/wx/app.h
Normal file
385
include/wx/app.h
Normal file
@@ -0,0 +1,385 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: app.h
|
||||
// Purpose: wxAppBase class and macros used for declaration of wxApp
|
||||
// derived class in the user code
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_APP_H_BASE_
|
||||
#define _WX_APP_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "appbase.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// typedefs
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __WXMSW__
|
||||
class WXDLLEXPORT wxApp;
|
||||
typedef wxApp* (*wxAppInitializerFunction)();
|
||||
#else
|
||||
// returning wxApp* won't work with gcc
|
||||
#include "wx/object.h"
|
||||
|
||||
typedef wxObject* (*wxAppInitializerFunction)();
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers we have to include here
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/event.h" // for the base class
|
||||
|
||||
#if wxUSE_GUI
|
||||
#include "wx/window.h" // for wxTopLevelWindows
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
#if wxUSE_LOG
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static const int wxPRINT_WINDOWS = 1;
|
||||
static const int wxPRINT_POSTSCRIPT = 2;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the common part of wxApp implementations for all platforms
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxAppBase : public wxEvtHandler
|
||||
{
|
||||
public:
|
||||
// the virtual functions which may/must be overridden in the derived class
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// called during the program initialization, returning FALSE from here
|
||||
// prevents the program from continuing - it's a good place to create
|
||||
// the top level program window and return TRUE.
|
||||
//
|
||||
// Override: always in GUI application, rarely in console ones.
|
||||
#if wxUSE_GUI
|
||||
virtual bool OnInit() { return FALSE; };
|
||||
#else // !GUI
|
||||
virtual bool OnInit() { return TRUE; };
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
#if wxUSE_GUI
|
||||
// a platform-dependent version of OnInit(): the code here is likely to
|
||||
// depend on the toolkit. default version does nothing.
|
||||
//
|
||||
// Override: rarely.
|
||||
virtual bool OnInitGui() { return TRUE; }
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
// called to start program execution - the default version just enters
|
||||
// the main GUI loop in which events are received and processed until
|
||||
// the last window is not deleted (if GetExitOnFrameDelete) or
|
||||
// ExitMainLoop() is called. In console mode programs, the execution
|
||||
// of the program really starts here
|
||||
//
|
||||
// Override: rarely in GUI applications, always in console ones.
|
||||
#if wxUSE_GUI
|
||||
virtual int OnRun() { return MainLoop(); };
|
||||
#else // !GUI
|
||||
virtual int OnRun() = 0;
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
// called after the main loop termination. This is a good place for
|
||||
// cleaning up (it may be too late in dtor) and is also useful if you
|
||||
// want to return some non-default exit code - this is just the return
|
||||
// value of this method.
|
||||
//
|
||||
// Override: often.
|
||||
virtual int OnExit() { return 0; }
|
||||
|
||||
// called when a fatal exception occurs, this function should take care
|
||||
// not to do anything which might provoke a nested exception! It may be
|
||||
// overridden if you wish to react somehow in non-default way (core
|
||||
// dump under Unix, application crash under Windows) to fatal program
|
||||
// errors, however extreme care should be taken if you don't want this
|
||||
// function to crash.
|
||||
//
|
||||
// Override: rarely.
|
||||
virtual void OnFatalException() { }
|
||||
|
||||
// the worker functions - usually not used directly by the user code
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
#if wxUSE_GUI
|
||||
// execute the main GUI loop, the function returns when the loop ends
|
||||
virtual int MainLoop() = 0;
|
||||
|
||||
// exit the main GUI loop during the next iteration (i.e. it does not
|
||||
// stop the program immediately!)
|
||||
virtual void ExitMainLoop() = 0;
|
||||
|
||||
// returns TRUE if the program is initialized
|
||||
virtual bool Initialized() = 0;
|
||||
|
||||
// returns TRUE if there are unprocessed events in the event queue
|
||||
virtual bool Pending() = 0;
|
||||
|
||||
// process the first event in the event queue (blocks until an event
|
||||
// apperas if there are none currently)
|
||||
virtual void Dispatch() = 0;
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
// application info: name, description, vendor
|
||||
// -------------------------------------------
|
||||
|
||||
// NB: all these should be set by the application itself, there are no
|
||||
// reasonable default except for the application name which is taken to
|
||||
// be argv[0]
|
||||
|
||||
// set/get the application name
|
||||
wxString GetAppName() const
|
||||
{
|
||||
if ( !m_appName )
|
||||
return m_className;
|
||||
else
|
||||
return m_appName;
|
||||
}
|
||||
void SetAppName(const wxString& name) { m_appName = name; }
|
||||
|
||||
// set/get the app class name
|
||||
wxString GetClassName() const { return m_className; }
|
||||
void SetClassName(const wxString& name) { m_className = name; }
|
||||
|
||||
// set/get the vendor name
|
||||
const wxString& GetVendorName() const { return m_vendorName; }
|
||||
void SetVendorName(const wxString& name) { m_vendorName = name; }
|
||||
|
||||
#if wxUSE_GUI
|
||||
// top level window functions
|
||||
// --------------------------
|
||||
|
||||
// set the "main" top level window
|
||||
void SetTopWindow(wxWindow *win) { m_topWindow = win; }
|
||||
|
||||
// return the "main" top level window (if it hadn't been set previously
|
||||
// with SetTopWindow(), will return just some top level window and, if
|
||||
// there are none, will return NULL)
|
||||
wxWindow *GetTopWindow() const
|
||||
{
|
||||
if (m_topWindow)
|
||||
return m_topWindow;
|
||||
else if (wxTopLevelWindows.GetCount() > 0)
|
||||
return wxTopLevelWindows.GetFirst()->GetData();
|
||||
else
|
||||
return (wxWindow *)NULL;
|
||||
}
|
||||
|
||||
// control the exit behaviour: by default, the program will exit the
|
||||
// main loop (and so, usually, terminate) when the last top-level
|
||||
// program window is deleted. Beware that if you disabel this (with
|
||||
// SetExitOnFrameDelete(FALSE)), you'll have to call ExitMainLoop()
|
||||
// explicitly from somewhere.
|
||||
void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
|
||||
bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
|
||||
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
// miscellaneous customization functions
|
||||
// -------------------------------------
|
||||
|
||||
#if wxUSE_LOG
|
||||
// override this function to create default log target of arbitrary
|
||||
// user-defined class (default implementation creates a wxLogGui
|
||||
// object) - this log object is used by default by all wxLogXXX()
|
||||
// functions.
|
||||
virtual wxLog *CreateLogTarget()
|
||||
#if wxUSE_GUI
|
||||
{ return new wxLogGui; }
|
||||
#else // !GUI
|
||||
{ return new wxLogStderr; }
|
||||
#endif // wxUSE_GUI
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
#if wxUSE_GUI
|
||||
// get the standard icon used by wxWin dialogs - this allows the user
|
||||
// to customize the standard dialogs. The 'which' parameter is one of
|
||||
// wxICON_XXX values
|
||||
virtual wxIcon GetStdIcon(int which) const = 0;
|
||||
|
||||
// VZ: what does this do exactly?
|
||||
void SetWantDebugOutput( bool flag ) { m_wantDebugOutput = flag; }
|
||||
bool GetWantDebugOutput() const { return m_wantDebugOutput; }
|
||||
|
||||
// set/get printing mode: see wxPRINT_XXX constants.
|
||||
//
|
||||
// default behaviour is the normal one for Unix: always use PostScript
|
||||
// printing.
|
||||
virtual void SetPrintMode(int WXUNUSED(mode)) { }
|
||||
int GetPrintMode() const { return wxPRINT_POSTSCRIPT; }
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
// helpers for dynamic wxApp construction
|
||||
static void SetInitializerFunction(wxAppInitializerFunction fn)
|
||||
{ m_appInitFn = fn; }
|
||||
static wxAppInitializerFunction GetInitializerFunction()
|
||||
{ return m_appInitFn; }
|
||||
|
||||
// access to the command line arguments
|
||||
int argc;
|
||||
wxChar **argv;
|
||||
|
||||
//private:
|
||||
protected:
|
||||
// function used for dynamic wxApp creation
|
||||
static wxAppInitializerFunction m_appInitFn;
|
||||
|
||||
// application info (must be set from the user code)
|
||||
wxString m_vendorName, // vendor name (ACME Inc)
|
||||
m_appName, // app name
|
||||
m_className; // class name
|
||||
|
||||
// if TRUE, exit the main loop when the last top level window is deleted
|
||||
bool m_exitOnFrameDelete;
|
||||
|
||||
// TRUE if the application wants to get debug output
|
||||
bool m_wantDebugOutput;
|
||||
|
||||
#if wxUSE_GUI
|
||||
// the main top level window - may be NULL
|
||||
wxWindow *m_topWindow;
|
||||
#endif // wxUSE_GUI
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// now include the declaration of the real class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_GUI
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/app.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/app.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/app.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/app.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/app.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/app.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/app.h"
|
||||
#endif
|
||||
#else // !GUI
|
||||
typedef wxAppBase wxApp;
|
||||
#endif // GUI/!GUI
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the global data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// the one and only application object - use of wxTheApp in application code
|
||||
// is discouraged, consider using DECLARE_APP() after which you may call
|
||||
// wxGetApp() which will return the object of the correct type (i.e. MyApp and
|
||||
// not wxApp)
|
||||
WXDLLEXPORT_DATA(extern wxApp*) wxTheApp;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// event loop related functions only work in GUI programs
|
||||
// ------------------------------------------------------
|
||||
|
||||
#if wxUSE_GUI
|
||||
|
||||
// Force an exit from main loop
|
||||
extern void WXDLLEXPORT wxExit();
|
||||
|
||||
// Yield to other apps/messages
|
||||
extern bool WXDLLEXPORT wxYield();
|
||||
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
// console applications may avoid using DECLARE_APP and IMPLEMENT_APP macros
|
||||
// and call these functions instead at the program startup and termination
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_NOGUI
|
||||
|
||||
// initialize the library (may be called as many times as needed, but each
|
||||
// call to wxInitialize() must be matched by wxUninitialize())
|
||||
extern bool WXDLLEXPORT wxInitialize();
|
||||
|
||||
// clean up - the library can't be used any more after the last call to
|
||||
// wxUninitialize()
|
||||
extern void WXDLLEXPORT wxUninitialize();
|
||||
|
||||
#endif // wxUSE_NOGUI
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros for dynamic creation of the application object
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Having a global instance of this class allows wxApp to be aware of the app
|
||||
// creator function. wxApp can then call this function to create a new app
|
||||
// object. Convoluted, but necessary.
|
||||
|
||||
class WXDLLEXPORT wxAppInitializer
|
||||
{
|
||||
public:
|
||||
wxAppInitializer(wxAppInitializerFunction fn)
|
||||
{ wxApp::SetInitializerFunction(fn); }
|
||||
};
|
||||
|
||||
// Here's a macro you can use if your compiler really, really wants main() to
|
||||
// be in your main program (e.g. hello.cpp). Now IMPLEMENT_APP should add this
|
||||
// code if required.
|
||||
|
||||
#if defined(__AIX__) || defined(__HPUX__)
|
||||
#define IMPLEMENT_WXWIN_MAIN \
|
||||
extern int wxEntry( int argc, char *argv[] ); \
|
||||
int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
|
||||
#elif defined(__WXMSW__) && defined(WXUSINGDLL)
|
||||
// NT defines APIENTRY, 3.x not
|
||||
#if !defined(WXAPIENTRY)
|
||||
#ifdef __WATCOMC__
|
||||
#define WXAPIENTRY PASCAL
|
||||
#else
|
||||
#define WXAPIENTRY FAR PASCAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#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);\
|
||||
}
|
||||
|
||||
#else
|
||||
#define IMPLEMENT_WXWIN_MAIN
|
||||
#endif
|
||||
|
||||
// use this macro exactly once, the argument is the name of the wxApp-derived
|
||||
// class which is the class of your application
|
||||
#define IMPLEMENT_APP(appname) \
|
||||
wxApp *wxCreateApp() { return new appname; } \
|
||||
wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
|
||||
appname& wxGetApp() { return *(appname *)wxTheApp; } \
|
||||
IMPLEMENT_WXWIN_MAIN
|
||||
|
||||
#define DECLARE_APP(appname) extern appname& wxGetApp();
|
||||
|
||||
#endif
|
||||
// _WX_APP_H_BASE_
|
111
include/wx/arrimpl.cpp
Normal file
111
include/wx/arrimpl.cpp
Normal file
@@ -0,0 +1,111 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: listimpl.cpp
|
||||
// Purpose: helper file for implementation of dynamic lists
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 16.10.97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1997 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*****************************************************************************
|
||||
* Purpose: implements methods of "template" class declared in *
|
||||
* DECLARE_OBJARRAY macro and which couldn't be implemented inline *
|
||||
* (because they need the full definition of type T in scope) *
|
||||
* *
|
||||
* Usage: 1) #include dynarray.h *
|
||||
* 2) WX_DECLARE_OBJARRAY *
|
||||
* 3) #include arrimpl.cpp *
|
||||
* 4) WX_DEFINE_OBJARRAY *
|
||||
*****************************************************************************/
|
||||
|
||||
// needed to resolve the conflict between global T and macro parameter T
|
||||
#define _WX_ERROR_REMOVE2(x) wxT("bad index in " #x "::Remove()")
|
||||
|
||||
// macro implements remaining (not inline) methods of template list
|
||||
// (it's private to this file)
|
||||
#undef _DEFINE_OBJARRAY
|
||||
#define _DEFINE_OBJARRAY(T, name) \
|
||||
name::~name() \
|
||||
{ \
|
||||
Empty(); \
|
||||
} \
|
||||
\
|
||||
void name::DoCopy(const name& src) \
|
||||
{ \
|
||||
for ( size_t ui = 0; ui < src.Count(); ui++ ) \
|
||||
Add(src[ui]); \
|
||||
} \
|
||||
\
|
||||
name& name::operator=(const name& src) \
|
||||
{ \
|
||||
Empty(); \
|
||||
DoCopy(src); \
|
||||
\
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
name::name(const name& src) \
|
||||
{ \
|
||||
DoCopy(src); \
|
||||
} \
|
||||
\
|
||||
void name::Empty() \
|
||||
{ \
|
||||
for ( size_t ui = 0; ui < Count(); ui++ ) \
|
||||
delete (T*)wxBaseArray::Item(ui); \
|
||||
\
|
||||
wxBaseArray::Clear(); \
|
||||
} \
|
||||
\
|
||||
void name::Remove(size_t uiIndex) \
|
||||
{ \
|
||||
wxCHECK_RET( uiIndex < Count(), _WX_ERROR_REMOVE2(name) ); \
|
||||
\
|
||||
delete (T*)wxBaseArray::Item(uiIndex); \
|
||||
\
|
||||
wxBaseArray::Remove(uiIndex); \
|
||||
} \
|
||||
\
|
||||
void name::Add(const T& item) \
|
||||
{ \
|
||||
T* pItem = new T(item); \
|
||||
if ( pItem != NULL ) \
|
||||
Add(pItem); \
|
||||
} \
|
||||
\
|
||||
void name::Insert(const T& item, size_t uiIndex) \
|
||||
{ \
|
||||
T* pItem = new T(item); \
|
||||
if ( pItem != NULL ) \
|
||||
Insert(pItem, uiIndex); \
|
||||
} \
|
||||
\
|
||||
int name::Index(const T& Item, bool bFromEnd) const \
|
||||
{ \
|
||||
if ( bFromEnd ) { \
|
||||
if ( Count() > 0 ) { \
|
||||
size_t ui = Count() - 1; \
|
||||
do { \
|
||||
if ( (T*)wxBaseArray::Item(ui) == &Item ) \
|
||||
return ui; \
|
||||
ui--; \
|
||||
} \
|
||||
while ( ui != 0 ); \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
for( size_t ui = 0; ui < Count(); ui++ ) { \
|
||||
if( (T*)wxBaseArray::Item(ui) == &Item ) \
|
||||
return ui; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
return wxNOT_FOUND; \
|
||||
}
|
||||
|
||||
// redefine the macro so that now it will generate the class implementation
|
||||
// old value would provoke a compile-time error if this file is not included
|
||||
#undef WX_DEFINE_OBJARRAY
|
||||
#define WX_DEFINE_OBJARRAY(name) _DEFINE_OBJARRAY(_L##name, name)
|
21
include/wx/bitmap.h
Normal file
21
include/wx/bitmap.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_BITMAP_H_BASE_
|
||||
#define _WX_BITMAP_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/bitmap.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/bitmap.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/bitmap.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/bitmap.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/bitmap.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/bitmap.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/bitmap.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_BITMAP_H_BASE_
|
20
include/wx/bmpbuttn.h
Normal file
20
include/wx/bmpbuttn.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef _WX_BMPBUTTON_H_BASE_
|
||||
#define _WX_BMPBUTTON_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/bmpbuttn.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/bmpbuttn.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/bmpbuttn.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/bmpbuttn.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/bmpbuttn.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/bmpbuttn.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/bmpbuttn.h"
|
||||
#endif
|
||||
|
||||
#endif
|
21
include/wx/brush.h
Normal file
21
include/wx/brush.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_BRUSH_H_BASE_
|
||||
#define _WX_BRUSH_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/brush.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/brush.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/brush.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/brush.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/brush.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/brush.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/brush.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_BRUSH_H_BASE_
|
128
include/wx/buffer.h
Normal file
128
include/wx/buffer.h
Normal file
@@ -0,0 +1,128 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: buffer.h
|
||||
// Purpose: auto buffer classes: buffers which automatically free memory
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 12.04.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// these classes are for private use only for now, they're not documented
|
||||
|
||||
#ifndef _WX_BUFFER_H
|
||||
#define _WX_BUFFER_H
|
||||
|
||||
#include "wx/wxchar.h"
|
||||
|
||||
#include <string.h> // strdup
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Special classes for (wide) character strings: they use malloc/free instead
|
||||
// of new/delete
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxCharBuffer
|
||||
{
|
||||
public:
|
||||
wxCharBuffer(const char *str)
|
||||
{
|
||||
wxASSERT_MSG( str, wxT("NULL string in wxCharBuffer") );
|
||||
|
||||
m_str = str ? strdup(str) : (char *)NULL;
|
||||
}
|
||||
wxCharBuffer(size_t len)
|
||||
{
|
||||
m_str = (char *)malloc(len+1);
|
||||
m_str[len] = '\0';
|
||||
}
|
||||
// no need to check for NULL, free() does it
|
||||
~wxCharBuffer() { free(m_str); }
|
||||
|
||||
wxCharBuffer(const wxCharBuffer& src)
|
||||
{
|
||||
m_str = src.m_str;
|
||||
// no reference count yet...
|
||||
((wxCharBuffer*)&src)->m_str = (char *)NULL;
|
||||
}
|
||||
wxCharBuffer& operator=(const wxCharBuffer& src)
|
||||
{
|
||||
m_str = src.m_str;
|
||||
// no reference count yet...
|
||||
((wxCharBuffer*)&src)->m_str = (char *)NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator const char *() const { return m_str; }
|
||||
char operator[](size_t n) const { return m_str[n]; }
|
||||
|
||||
private:
|
||||
char *m_str;
|
||||
};
|
||||
|
||||
#if wxUSE_WCHAR_T
|
||||
class wxWCharBuffer
|
||||
{
|
||||
public:
|
||||
wxWCharBuffer(const wchar_t *wcs)
|
||||
{
|
||||
wxASSERT_MSG( wcs, wxT("NULL string in wxWCharBuffer") );
|
||||
|
||||
if (wcs) {
|
||||
size_t siz = (wcslen(wcs)+1)*sizeof(wchar_t);
|
||||
m_wcs = (wchar_t *)malloc(siz);
|
||||
memcpy(m_wcs, wcs, siz);
|
||||
}
|
||||
else m_wcs = (wchar_t *)NULL;
|
||||
}
|
||||
wxWCharBuffer(size_t len)
|
||||
{
|
||||
m_wcs = (wchar_t *)malloc((len+1)*sizeof(wchar_t));
|
||||
m_wcs[len] = L'\0';
|
||||
}
|
||||
|
||||
// no need to check for NULL, free() does it
|
||||
~wxWCharBuffer() { free(m_wcs); }
|
||||
|
||||
wxWCharBuffer(const wxWCharBuffer& src)
|
||||
{
|
||||
m_wcs = src.m_wcs;
|
||||
// no reference count yet...
|
||||
((wxWCharBuffer*)&src)->m_wcs = (wchar_t *)NULL;
|
||||
}
|
||||
wxWCharBuffer& operator=(const wxWCharBuffer& src)
|
||||
{
|
||||
m_wcs = src.m_wcs;
|
||||
// no reference count yet...
|
||||
((wxWCharBuffer*)&src)->m_wcs = (wchar_t *)NULL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator const wchar_t *() const { return m_wcs; }
|
||||
wchar_t operator[](size_t n) const { return m_wcs[n]; }
|
||||
|
||||
private:
|
||||
wchar_t *m_wcs;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
#define wxMB2WXbuf wxWCharBuffer
|
||||
#define wxWX2MBbuf wxCharBuffer
|
||||
#define wxWC2WXbuf wxChar*
|
||||
#define wxWX2WCbuf wxChar*
|
||||
#else // ANSI
|
||||
#define wxMB2WXbuf wxChar*
|
||||
#define wxWX2MBbuf wxChar*
|
||||
#define wxWC2WXbuf wxCharBuffer
|
||||
#define wxWX2WCbuf wxWCharBuffer
|
||||
#endif // Unicode/ANSI
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// template class for any kind of data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// TODO
|
||||
|
||||
#endif // _WX_BUFFER_H
|
53
include/wx/busyinfo.h
Normal file
53
include/wx/busyinfo.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: busyinfo.h
|
||||
// Purpose: Information window (when app is busy)
|
||||
// Author: Vaclav Slavik
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __INFOWIN_H__
|
||||
#define __INFOWIN_H__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORDLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/frame.h"
|
||||
|
||||
#if wxUSE_BUSYINFO
|
||||
|
||||
class WXDLLEXPORT wxInfoFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
wxInfoFrame(wxWindow *parent, const wxString& message);
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxBusyInfo
|
||||
// Displays progress information
|
||||
// Can be used in exactly same way as wxBusyCursor
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxBusyInfo : public wxObject
|
||||
{
|
||||
public:
|
||||
wxBusyInfo(const wxString& message);
|
||||
~wxBusyInfo();
|
||||
|
||||
private:
|
||||
wxInfoFrame *m_InfoFrame;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
21
include/wx/button.h
Normal file
21
include/wx/button.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_BUTTON_H_BASE_
|
||||
#define _WX_BUTTON_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/button.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/button.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/button.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/button.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/button.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/button.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/button.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_BUTTON_H_BASE_
|
190
include/wx/caret.h
Normal file
190
include/wx/caret.h
Normal file
@@ -0,0 +1,190 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: caret.h
|
||||
// Purpose: wxCaretBase class - the interface of wxCaret
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 23.05.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CARET_H_BASE_
|
||||
#define _WX_CARET_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "caret.h"
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxWindow;
|
||||
class WXDLLEXPORT wxWindowBase;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers we have to include
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/gdicmn.h" // for wxPoint, wxSize
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// A caret is a blinking cursor showing the position where the typed text will
|
||||
// appear. It can be either a solid block or a custom bitmap (TODO)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxCaretBase
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
// -----
|
||||
// default - use Create
|
||||
wxCaretBase() { Init(); }
|
||||
// create the caret of given (in pixels) width and height and associate
|
||||
// with the given window
|
||||
wxCaretBase(wxWindowBase *window, int width, int height)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(window, width, height);
|
||||
}
|
||||
// same as above
|
||||
wxCaretBase(wxWindowBase *window, const wxSize& size)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(window, size);
|
||||
}
|
||||
|
||||
// Create() functions - same as ctor but returns the success code
|
||||
// --------------------------------------------------------------
|
||||
|
||||
// same as ctor
|
||||
bool Create(wxWindowBase *window, int width, int height)
|
||||
{ return DoCreate(window, width, height); }
|
||||
// same as ctor
|
||||
bool Create(wxWindowBase *window, const wxSize& size)
|
||||
{ return DoCreate(window, size.x, size.y); }
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
// is the caret valid?
|
||||
bool IsOk() const { return m_width != 0 && m_height != 0; }
|
||||
|
||||
// is the caret currently shown?
|
||||
bool IsVisible() const { return m_countVisible > 0; }
|
||||
|
||||
// get the caret position
|
||||
void GetPosition(int *x, int *y) const
|
||||
{
|
||||
if ( x ) *x = m_x;
|
||||
if ( y ) *y = m_y;
|
||||
}
|
||||
wxPoint GetPosition() const { return wxPoint(m_x, m_y); }
|
||||
|
||||
// get the caret size
|
||||
void GetSize(int *width, int *height) const
|
||||
{
|
||||
if ( width ) *width = m_width;
|
||||
if ( height ) *height = m_height;
|
||||
}
|
||||
wxSize GetSize() const { return wxSize(m_width, m_height); }
|
||||
|
||||
// get the window we're associated with
|
||||
wxWindow *GetWindow() const { return (wxWindow *)m_window; }
|
||||
|
||||
// operations
|
||||
// ----------
|
||||
|
||||
// move the caret to given position (in logical coords)
|
||||
void Move(int x, int y) { m_x = x; m_y = y; DoMove(); }
|
||||
void Move(const wxPoint& pt) { m_x = pt.x; m_y = pt.y; DoMove(); }
|
||||
|
||||
// show/hide the caret (should be called by wxWindow when needed):
|
||||
// Show() must be called as many times as Hide() + 1 to make the caret
|
||||
// visible
|
||||
virtual void Show(bool show = TRUE)
|
||||
{
|
||||
if ( show )
|
||||
{
|
||||
if ( m_countVisible++ == 0 )
|
||||
DoShow();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( --m_countVisible == 0 )
|
||||
DoHide();
|
||||
}
|
||||
}
|
||||
virtual void Hide() { Show(FALSE); }
|
||||
|
||||
// blink time is measured in milliseconds and is the time elapsed
|
||||
// between 2 inversions of the caret (blink time of the caret is common
|
||||
// to all carets in the Universe, so these functions are static)
|
||||
static int GetBlinkTime();
|
||||
static void SetBlinkTime(int milliseconds);
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
// these functions should be called by wxWindow when the window gets/loses
|
||||
// the focus - we create/show and hide/destroy the caret here
|
||||
virtual void OnSetFocus() { }
|
||||
virtual void OnKillFocus() { }
|
||||
|
||||
protected:
|
||||
// these functions may be overriden in the derived classes, but they
|
||||
// should call the base class version first
|
||||
virtual bool DoCreate(wxWindowBase *window, int width, int height)
|
||||
{
|
||||
m_window = window;
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// pure virtuals to implement in the derived class
|
||||
virtual void DoShow() = 0;
|
||||
virtual void DoHide() = 0;
|
||||
virtual void DoMove() = 0;
|
||||
|
||||
// the common initialization
|
||||
void Init()
|
||||
{
|
||||
m_window = (wxWindowBase *)NULL;
|
||||
m_x = m_y = 0;
|
||||
m_width = m_height = 0;
|
||||
m_countVisible = 0;
|
||||
}
|
||||
|
||||
// the size of the caret
|
||||
int m_width, m_height;
|
||||
|
||||
// the position of the caret
|
||||
int m_x, m_y;
|
||||
|
||||
// the window we're associated with
|
||||
wxWindowBase *m_window;
|
||||
|
||||
// visibility count: the caret is visible only if it's positive
|
||||
int m_countVisible;
|
||||
|
||||
private:
|
||||
DECLARE_NO_COPY_CLASS(wxCaretBase);
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// now include the real thing
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/caret.h"
|
||||
#else
|
||||
#include "wx/generic/caret.h"
|
||||
#endif // platform
|
||||
|
||||
#endif // _WX_CARET_H_BASE_
|
||||
|
21
include/wx/checkbox.h
Normal file
21
include/wx/checkbox.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_CHECKBOX_H_BASE_
|
||||
#define _WX_CHECKBOX_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/checkbox.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/checkbox.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/checkbox.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/checkbox.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/checkbox.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/checkbox.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/checkbox.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_CHECKBOX_H_BASE_
|
21
include/wx/checklst.h
Normal file
21
include/wx/checklst.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_CHECKLST_H_BASE_
|
||||
#define _WX_CHECKLST_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/checklst.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/checklst.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/checklst.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/checklst.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/checklst.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/checklst.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/checklst.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_CHECKLST_H_BASE_
|
7
include/wx/choicdlg.h
Normal file
7
include/wx/choicdlg.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef _WX_CHOICDLG_H_BASE_
|
||||
#define _WX_CHOICDLG_H_BASE_
|
||||
|
||||
#include "wx/generic/choicdgg.h"
|
||||
|
||||
#endif
|
||||
// _WX_CHOICDLG_H_BASE_
|
135
include/wx/choice.h
Normal file
135
include/wx/choice.h
Normal file
@@ -0,0 +1,135 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/choice.h
|
||||
// Purpose: wxChoice class interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 26.07.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CHOICE_H_BASE_
|
||||
#define _WX_CHOICE_H_BASE_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "choicebase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/control.h" // the base class
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global data
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxChoice allows to select one of a non-modifiable list of strings
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxChoiceBase : public wxControl
|
||||
{
|
||||
public:
|
||||
// ctor
|
||||
wxChoiceBase() { m_clientDataItemsType = ClientData_None; }
|
||||
|
||||
// add a new item to the list
|
||||
// no client data
|
||||
void Append(const wxString& item) { DoAppend(item); }
|
||||
// with client data which belongs to the caller
|
||||
void Append(const wxString &item, void* clientData)
|
||||
{ int n = DoAppend(item); SetClientData(n, clientData); }
|
||||
// with client data which will be deleted by the control
|
||||
void Append(const wxString &item, wxClientData* clientData)
|
||||
{ int n = DoAppend(item); SetClientObject(n, clientData); }
|
||||
|
||||
// delete items from the list
|
||||
// one item
|
||||
virtual void Delete(int n) = 0;
|
||||
// all of them
|
||||
virtual void Clear() = 0;
|
||||
|
||||
// selection (at most one item may be selected in wxChoice)
|
||||
// get the index of currently selected item or -1
|
||||
virtual int GetSelection() const = 0;
|
||||
// get the text of the currently selected item or empty string
|
||||
virtual wxString GetStringSelection() const;
|
||||
|
||||
// set selectionto current item
|
||||
virtual void SetSelection(int n) = 0;
|
||||
// set selection to the current item, returns TRUE if ok
|
||||
virtual bool SetStringSelection(const wxString& sel);
|
||||
|
||||
// accessors to the list of strings
|
||||
// get the number of items in the list of strings
|
||||
virtual int GetCount() const = 0;
|
||||
|
||||
// find string in the list, return wxNOT_FOUND if not found
|
||||
virtual int FindString(const wxString& s) const = 0;
|
||||
// get the string with the specified index
|
||||
virtual wxString GetString(int n) const = 0;
|
||||
|
||||
// set/get the number of columns in the control (as they're not supporte on
|
||||
// most platforms, they do nothing by default)
|
||||
virtual void SetColumns(int WXUNUSED(n) = 1 ) { }
|
||||
virtual int GetColumns() const { return 1 ; }
|
||||
|
||||
// client data
|
||||
// untyped (isn't deleted by the control)
|
||||
void SetClientData( int n, void* clientData );
|
||||
void* GetClientData( int n ) const;
|
||||
// typed (is owned and deleted by the control)
|
||||
void SetClientObject( int n, wxClientData* clientData );
|
||||
wxClientData* GetClientObject( int n ) const;
|
||||
|
||||
// emulate selecting the item event.GetInt() from the control
|
||||
virtual void Command(wxCommandEvent &event);
|
||||
|
||||
// deprecated functions, heer for backwards compatibility only
|
||||
int Number() const { return GetCount(); }
|
||||
|
||||
private:
|
||||
// pure virtuals to implement in the derived classes
|
||||
virtual int DoAppend(const wxString& item) = 0;
|
||||
|
||||
virtual void DoSetClientData( int n, void* clientData ) = 0;
|
||||
virtual void* DoGetClientData( int n ) const = 0;
|
||||
virtual void DoSetClientObject( int n, wxClientData* clientData ) = 0;
|
||||
virtual wxClientData* DoGetClientObject( int n ) const = 0;
|
||||
|
||||
// the type of the client data for the items
|
||||
wxClientDataType m_clientDataItemsType;
|
||||
// the above pure virtuals hide these virtuals in wxWindowBase
|
||||
virtual void DoSetClientData(void* clientData ) { wxWindowBase::DoSetClientData(clientData); };
|
||||
virtual void* DoGetClientData() const { return(wxWindowBase::DoGetClientData()); };
|
||||
virtual void DoSetClientObject( wxClientData* clientData ) { wxWindowBase::DoSetClientObject(clientData); };
|
||||
virtual wxClientData* DoGetClientObject() const { return(wxWindowBase::DoGetClientObject()); };
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include the platform-dependent class definition
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/choice.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/choice.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/choice.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/choice.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/choice.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/choice.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/choice.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_CHOICE_H_BASE_
|
21
include/wx/clipbrd.h
Normal file
21
include/wx/clipbrd.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_CLIPBRD_H_BASE_
|
||||
#define _WX_CLIPBRD_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/clipbrd.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/clipbrd.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/clipbrd.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/gtk/clipbrd.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/clipbrd.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/clipbrd.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/clipbrd.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_CLIPBRD_H_BASE_
|
391
include/wx/cmndata.h
Normal file
391
include/wx/cmndata.h
Normal file
@@ -0,0 +1,391 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: cmndata.h
|
||||
// Purpose: Common GDI data classes
|
||||
// Author: Julian Smart and others
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CMNDATA_H_BASE_
|
||||
#define _WX_CMNDATA_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "cmndata.h"
|
||||
#endif
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/font.h"
|
||||
#include "wx/colour.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
#if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__)) && wxUSE_POSTSCRIPT
|
||||
class WXDLLEXPORT wxPrintSetupData;
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxColourData: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxColourData)
|
||||
public:
|
||||
wxColourData();
|
||||
wxColourData(const wxColourData& data);
|
||||
~wxColourData();
|
||||
|
||||
void SetChooseFull(bool flag) { chooseFull = flag; }
|
||||
bool GetChooseFull() const { return chooseFull; }
|
||||
void SetColour(wxColour& colour) { dataColour = colour; }
|
||||
wxColour &GetColour() { return dataColour; }
|
||||
|
||||
// Array of 16 custom colours
|
||||
void SetCustomColour(int i, wxColour& colour);
|
||||
wxColour GetCustomColour(int i);
|
||||
|
||||
void operator=(const wxColourData& data);
|
||||
|
||||
public:
|
||||
wxColour dataColour;
|
||||
wxColour custColours[16];
|
||||
bool chooseFull;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxFontData: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFontData)
|
||||
public:
|
||||
wxFontData();
|
||||
wxFontData(const wxFontData& fontData);
|
||||
~wxFontData();
|
||||
|
||||
void SetAllowSymbols(bool flag) { allowSymbols = flag; }
|
||||
bool GetAllowSymbols() const { return allowSymbols; }
|
||||
|
||||
void SetColour(const wxColour& colour) { fontColour = colour; }
|
||||
wxColour &GetColour() { return fontColour; }
|
||||
|
||||
void SetShowHelp(bool flag) { showHelp = flag; }
|
||||
bool GetShowHelp() const { return showHelp; }
|
||||
|
||||
void EnableEffects(bool flag) { enableEffects = flag; }
|
||||
bool GetEnableEffects() const { return enableEffects; }
|
||||
|
||||
void SetInitialFont(const wxFont& font) { initialFont = font; }
|
||||
wxFont GetInitialFont() const { return initialFont; }
|
||||
|
||||
void SetChosenFont(const wxFont& font) { chosenFont = font; }
|
||||
wxFont GetChosenFont() const { return chosenFont; }
|
||||
|
||||
void SetRange(int minRange, int maxRange) { minSize = minRange; maxSize = maxRange; }
|
||||
|
||||
void operator=(const wxFontData& data);
|
||||
|
||||
public:
|
||||
wxColour fontColour;
|
||||
bool showHelp;
|
||||
bool allowSymbols;
|
||||
bool enableEffects;
|
||||
wxFont initialFont;
|
||||
wxFont chosenFont;
|
||||
int minSize;
|
||||
int maxSize;
|
||||
};
|
||||
|
||||
#if wxUSE_PRINTING_ARCHITECTURE
|
||||
/*
|
||||
* wxPrintData
|
||||
* Encapsulates printer information (not printer dialog information)
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxPrintData: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPrintData)
|
||||
|
||||
wxPrintData();
|
||||
wxPrintData(const wxPrintData& printData);
|
||||
~wxPrintData();
|
||||
|
||||
int GetNoCopies() const { return m_printNoCopies; };
|
||||
bool GetCollate() const { return m_printCollate; };
|
||||
int GetOrientation() const { return m_printOrientation; };
|
||||
|
||||
const wxString& GetPrinterName() const { return m_printerName; }
|
||||
bool GetColour() const { return m_colour; }
|
||||
wxDuplexMode GetDuplex() const { return m_duplexMode; }
|
||||
wxPaperSize GetPaperId() const { return m_paperId; }
|
||||
const wxSize& GetPaperSize() const { return m_paperSize; } // Not used yet: confusable with paper size
|
||||
// in wxPageSetupDialogData
|
||||
wxPrintQuality GetQuality() const { return m_printQuality; }
|
||||
|
||||
void SetNoCopies(int v) { m_printNoCopies = v; };
|
||||
void SetCollate(bool flag) { m_printCollate = flag; };
|
||||
void SetOrientation(int orient) { m_printOrientation = orient; };
|
||||
|
||||
void SetPrinterName(const wxString& name) { m_printerName = name; }
|
||||
void SetColour(bool colour) { m_colour = colour; }
|
||||
void SetDuplex(wxDuplexMode duplex) { m_duplexMode = duplex; }
|
||||
void SetPaperId(wxPaperSize sizeId) { m_paperId = sizeId; }
|
||||
void SetPaperSize(const wxSize& sz) { m_paperSize = sz; }
|
||||
void SetQuality(wxPrintQuality quality) { m_printQuality = quality; }
|
||||
|
||||
// PostScript-specific data
|
||||
const wxString& GetPrinterCommand() const { return m_printerCommand; }
|
||||
const wxString& GetPrinterOptions() const { return m_printerOptions; }
|
||||
const wxString& GetPreviewCommand() const { return m_previewCommand; }
|
||||
const wxString& GetFilename() const { return m_filename; }
|
||||
const wxString& GetFontMetricPath() const { return m_afmPath; }
|
||||
double GetPrinterScaleX() const { return m_printerScaleX; }
|
||||
double GetPrinterScaleY() const { return m_printerScaleY; }
|
||||
long GetPrinterTranslateX() const { return m_printerTranslateX; }
|
||||
long GetPrinterTranslateY() const { return m_printerTranslateY; }
|
||||
wxPrintMode GetPrintMode() const { return m_printMode; }
|
||||
|
||||
void SetPrinterCommand(const wxString& command) { m_printerCommand = command; }
|
||||
void SetPrinterOptions(const wxString& options) { m_printerOptions = options; }
|
||||
void SetPreviewCommand(const wxString& command) { m_previewCommand = command; }
|
||||
void SetFilename(const wxString& filename) { m_filename = filename; }
|
||||
void SetFontMetricPath(const wxString& path) { m_afmPath = path; }
|
||||
void SetPrinterScaleX(double x) { m_printerScaleX = x; }
|
||||
void SetPrinterScaleY(double y) { m_printerScaleY = y; }
|
||||
void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; }
|
||||
void SetPrinterTranslateX(long x) { m_printerTranslateX = x; }
|
||||
void SetPrinterTranslateY(long y) { m_printerTranslateY = y; }
|
||||
void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; }
|
||||
void SetPrintMode(wxPrintMode printMode) { m_printMode = printMode; }
|
||||
|
||||
void operator=(const wxPrintData& data);
|
||||
|
||||
// For compatibility
|
||||
#if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXPM__)) && wxUSE_POSTSCRIPT
|
||||
void operator=(const wxPrintSetupData& setupData);
|
||||
#endif
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
// Convert to/from the DEVMODE structure
|
||||
void ConvertToNative();
|
||||
void ConvertFromNative();
|
||||
void* GetNativeData() const { return m_devMode; }
|
||||
void SetNativeData(void* data) { m_devMode = data; }
|
||||
#endif
|
||||
|
||||
public:
|
||||
#ifdef __WXMSW__
|
||||
void* m_devMode;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
int m_printNoCopies;
|
||||
int m_printOrientation;
|
||||
bool m_printCollate;
|
||||
|
||||
// New members, 24/3/99
|
||||
wxString m_printerName;
|
||||
bool m_colour;
|
||||
wxDuplexMode m_duplexMode;
|
||||
wxPrintQuality m_printQuality;
|
||||
wxPaperSize m_paperId;
|
||||
wxSize m_paperSize;
|
||||
|
||||
// PostScript-specific data
|
||||
wxString m_printerCommand;
|
||||
wxString m_previewCommand;
|
||||
wxString m_printerOptions;
|
||||
wxString m_filename;
|
||||
wxString m_afmPath;
|
||||
double m_printerScaleX;
|
||||
double m_printerScaleY;
|
||||
long m_printerTranslateX;
|
||||
long m_printerTranslateY;
|
||||
wxPrintMode m_printMode;
|
||||
};
|
||||
|
||||
/*
|
||||
* wxPrintDialogData
|
||||
* Encapsulates information displayed and edited in the printer dialog box.
|
||||
* Contains a wxPrintData object which is filled in according to the values retrieved
|
||||
* from the dialog.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxPrintDialogData: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPrintDialogData)
|
||||
|
||||
wxPrintDialogData();
|
||||
wxPrintDialogData(const wxPrintDialogData& dialogData);
|
||||
wxPrintDialogData(const wxPrintData& printData);
|
||||
~wxPrintDialogData();
|
||||
|
||||
int GetFromPage() const { return m_printFromPage; };
|
||||
int GetToPage() const { return m_printToPage; };
|
||||
int GetMinPage() const { return m_printMinPage; };
|
||||
int GetMaxPage() const { return m_printMaxPage; };
|
||||
int GetNoCopies() const { return m_printNoCopies; };
|
||||
bool GetAllPages() const { return m_printAllPages; };
|
||||
bool GetSelection() const { return m_printSelection; };
|
||||
bool GetCollate() const { return m_printCollate; };
|
||||
bool GetPrintToFile() const { return m_printToFile; };
|
||||
bool GetSetupDialog() const { return m_printSetupDialog; };
|
||||
|
||||
void SetFromPage(int v) { m_printFromPage = v; };
|
||||
void SetToPage(int v) { m_printToPage = v; };
|
||||
void SetMinPage(int v) { m_printMinPage = v; };
|
||||
void SetMaxPage(int v) { m_printMaxPage = v; };
|
||||
void SetNoCopies(int v) { m_printNoCopies = v; };
|
||||
void SetAllPages(bool flag) { m_printAllPages = flag; };
|
||||
void SetSelection(bool flag) { m_printSelection = flag; };
|
||||
void SetCollate(bool flag) { m_printCollate = flag; };
|
||||
void SetPrintToFile(bool flag) { m_printToFile = flag; };
|
||||
void SetSetupDialog(bool flag) { m_printSetupDialog = flag; };
|
||||
|
||||
void EnablePrintToFile(bool flag) { m_printEnablePrintToFile = flag; };
|
||||
void EnableSelection(bool flag) { m_printEnableSelection = flag; };
|
||||
void EnablePageNumbers(bool flag) { m_printEnablePageNumbers = flag; };
|
||||
void EnableHelp(bool flag) { m_printEnableHelp = flag; };
|
||||
|
||||
bool GetEnablePrintToFile() const { return m_printEnablePrintToFile; };
|
||||
bool GetEnableSelection() const { return m_printEnableSelection; };
|
||||
bool GetEnablePageNumbers() const { return m_printEnablePageNumbers; };
|
||||
bool GetEnableHelp() const { return m_printEnableHelp; };
|
||||
|
||||
wxPrintData& GetPrintData() { return m_printData; }
|
||||
void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
|
||||
|
||||
void operator=(const wxPrintDialogData& data);
|
||||
void operator=(const wxPrintData& data); // Sets internal m_printData member
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Convert to/from the PRINTDLG structure
|
||||
void ConvertToNative();
|
||||
void ConvertFromNative();
|
||||
void SetOwnerWindow(wxWindow* win);
|
||||
void* GetNativeData() const { return m_printDlgData; }
|
||||
#endif
|
||||
|
||||
#ifdef __WXMSW__
|
||||
void* m_printDlgData;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
int m_printFromPage;
|
||||
int m_printToPage;
|
||||
int m_printMinPage;
|
||||
int m_printMaxPage;
|
||||
int m_printNoCopies;
|
||||
bool m_printAllPages;
|
||||
bool m_printCollate;
|
||||
bool m_printToFile;
|
||||
bool m_printSelection;
|
||||
bool m_printEnableSelection;
|
||||
bool m_printEnablePageNumbers;
|
||||
bool m_printEnableHelp;
|
||||
bool m_printEnablePrintToFile;
|
||||
bool m_printSetupDialog;
|
||||
|
||||
wxPrintData m_printData;
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the data used (and returned) by the wxPageSetupDialog.
|
||||
*/
|
||||
|
||||
// Compatibility with old name
|
||||
#define wxPageSetupData wxPageSetupDialogData
|
||||
|
||||
class WXDLLEXPORT wxPageSetupDialogData: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPageSetupDialogData)
|
||||
|
||||
public:
|
||||
wxPageSetupDialogData();
|
||||
wxPageSetupDialogData(const wxPageSetupDialogData& dialogData);
|
||||
wxPageSetupDialogData(const wxPrintData& printData);
|
||||
~wxPageSetupDialogData();
|
||||
|
||||
wxSize GetPaperSize() const { return m_paperSize; };
|
||||
wxPaperSize GetPaperId() const { return m_printData.GetPaperId(); };
|
||||
wxPoint GetMinMarginTopLeft() const { return m_minMarginTopLeft; };
|
||||
wxPoint GetMinMarginBottomRight() const { return m_minMarginBottomRight; };
|
||||
wxPoint GetMarginTopLeft() const { return m_marginTopLeft; };
|
||||
wxPoint GetMarginBottomRight() const { return m_marginBottomRight; };
|
||||
|
||||
bool GetDefaultMinMargins() const { return m_defaultMinMargins; };
|
||||
bool GetEnableMargins() const { return m_enableMargins; };
|
||||
bool GetEnableOrientation() const { return m_enableOrientation; };
|
||||
bool GetEnablePaper() const { return m_enablePaper; };
|
||||
bool GetEnablePrinter() const { return m_enablePrinter; };
|
||||
bool GetDefaultInfo() const { return m_getDefaultInfo; };
|
||||
bool GetEnableHelp() const { return m_enableHelp; };
|
||||
|
||||
// If a corresponding paper type is found in the paper database, will set the m_printData
|
||||
// paper size id member as well.
|
||||
void SetPaperSize(const wxSize& sz);
|
||||
|
||||
void SetPaperId(wxPaperSize& id) { m_printData.SetPaperId(id); };
|
||||
|
||||
// Sets the wxPrintData id, plus the paper width/height if found in the paper database.
|
||||
void SetPaperSize(wxPaperSize id);
|
||||
|
||||
void SetMinMarginTopLeft(const wxPoint& pt) { m_minMarginTopLeft = pt; };
|
||||
void SetMinMarginBottomRight(const wxPoint& pt) { m_minMarginBottomRight = pt; };
|
||||
void SetMarginTopLeft(const wxPoint& pt) { m_marginTopLeft = pt; };
|
||||
void SetMarginBottomRight(const wxPoint& pt) { m_marginBottomRight = pt; };
|
||||
void SetDefaultMinMargins(bool flag) { m_defaultMinMargins = flag; };
|
||||
void SetDefaultInfo(bool flag) { m_getDefaultInfo = flag; };
|
||||
|
||||
void EnableMargins(bool flag) { m_enableMargins = flag; };
|
||||
void EnableOrientation(bool flag) { m_enableOrientation = flag; };
|
||||
void EnablePaper(bool flag) { m_enablePaper = flag; };
|
||||
void EnablePrinter(bool flag) { m_enablePrinter = flag; };
|
||||
void EnableHelp(bool flag) { m_enableHelp = flag; };
|
||||
|
||||
#if defined(__WIN95__)
|
||||
// Convert to/from the PAGESETUPDLG structure
|
||||
void ConvertToNative();
|
||||
void ConvertFromNative();
|
||||
void SetOwnerWindow(wxWindow* win);
|
||||
void* GetNativeData() const { return m_pageSetupData; }
|
||||
#endif
|
||||
|
||||
// Use paper size defined in this object to set the wxPrintData
|
||||
// paper id
|
||||
void CalculateIdFromPaperSize();
|
||||
|
||||
// Use paper id in wxPrintData to set this object's paper size
|
||||
void CalculatePaperSizeFromId();
|
||||
|
||||
void operator=(const wxPageSetupData& data);
|
||||
void operator=(const wxPrintData& data);
|
||||
|
||||
wxPrintData& GetPrintData() { return m_printData; }
|
||||
void SetPrintData(const wxPrintData& printData) { m_printData = printData; }
|
||||
|
||||
#if defined(__WIN95__)
|
||||
void* m_pageSetupData;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
wxSize m_paperSize; // The dimensions selected by the user (on return, same as in wxPrintData?)
|
||||
wxPoint m_minMarginTopLeft;
|
||||
wxPoint m_minMarginBottomRight;
|
||||
wxPoint m_marginTopLeft;
|
||||
wxPoint m_marginBottomRight;
|
||||
|
||||
// Flags
|
||||
bool m_defaultMinMargins;
|
||||
bool m_enableMargins;
|
||||
bool m_enableOrientation;
|
||||
bool m_enablePaper;
|
||||
bool m_enablePrinter;
|
||||
bool m_getDefaultInfo; // Equiv. to PSD_RETURNDEFAULT
|
||||
bool m_enableHelp;
|
||||
|
||||
wxPrintData m_printData;
|
||||
};
|
||||
|
||||
#endif // wxUSE_PRINTING_ARCHITECTURE
|
||||
|
||||
#endif
|
||||
// _WX_CMNDATA_H_BASE_
|
26
include/wx/colordlg.h
Normal file
26
include/wx/colordlg.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef _WX_COLORDLG_H_BASE_
|
||||
#define _WX_COLORDLG_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/colordlg.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/generic/colrdlgg.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/colrdlgg.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/generic/colrdlgg.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/generic/colrdlgg.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/generic/colrdlgg.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/generic/colrdlgg.h"
|
||||
#endif
|
||||
|
||||
#if !defined(__WXMSW__)
|
||||
#define wxColourDialog wxGenericColourDialog
|
||||
#define sm_classwxColourDialog sm_classwxGenericColourDialog
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_COLORDLG_H_BASE_
|
23
include/wx/colour.h
Normal file
23
include/wx/colour.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _WX_COLOUR_H_BASE_
|
||||
#define _WX_COLOUR_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/colour.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/colour.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/colour.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/colour.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/colour.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/colour.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/colour.h"
|
||||
#endif
|
||||
|
||||
#define wxColor wxColour
|
||||
|
||||
#endif
|
||||
// _WX_COLOUR_H_BASE_
|
21
include/wx/combobox.h
Normal file
21
include/wx/combobox.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_COMBOBOX_H_BASE_
|
||||
#define _WX_COMBOBOX_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/combobox.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/combobox.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/combobox.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/combobox.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/combobox.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/combobox.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/combobox.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_COMBOBOX_H_BASE_
|
318
include/wx/confbase.h
Normal file
318
include/wx/confbase.h
Normal file
@@ -0,0 +1,318 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: confbase.h
|
||||
// Purpose: declaration of the base class of all config implementations
|
||||
// (see also: fileconf.h and msw/regconf.h and iniconf.h)
|
||||
// Author: Karsten Ball<6C>der & Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 07.04.98 (adapted from appconf.h)
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1997 Karsten Ball<6C>der Ballueder@usa.net
|
||||
// Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CONFBASE_H_
|
||||
#define _WX_CONFBASE_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "confbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_CONFIG
|
||||
|
||||
#include "wx/string.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/// shall we be case sensitive in parsing variable names?
|
||||
#ifndef wxCONFIG_CASE_SENSITIVE
|
||||
#define wxCONFIG_CASE_SENSITIVE FALSE
|
||||
#endif
|
||||
|
||||
/// separates group and entry names (probably shouldn't be changed)
|
||||
#ifndef wxCONFIG_PATH_SEPARATOR
|
||||
#define wxCONFIG_PATH_SEPARATOR '/'
|
||||
#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 '!'
|
||||
#endif
|
||||
|
||||
/// should we use registry instead of configuration files under Win32?
|
||||
// (i.e. whether wxConfigBase::Create() will create a wxFileConfig (if it's
|
||||
// FALSE) or wxRegConfig (if it's true and we're under Win32) or wxIniConfig
|
||||
// (under Win16))
|
||||
#ifndef wxCONFIG_WIN32_NATIVE
|
||||
#define wxCONFIG_WIN32_NATIVE TRUE
|
||||
#endif
|
||||
|
||||
// Style flags for constructor style parameter
|
||||
enum
|
||||
{
|
||||
wxCONFIG_USE_LOCAL_FILE = 1,
|
||||
wxCONFIG_USE_GLOBAL_FILE = 2,
|
||||
wxCONFIG_USE_RELATIVE_PATH = 4
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// abstract base class wxConfigBase which defines the interface for derived
|
||||
// classes
|
||||
//
|
||||
// wxConfig organizes the items in a tree-like structure (modeled after the
|
||||
// Unix/Dos filesystem). There are groups (directories) and keys (files).
|
||||
// There is always one current group given by the current path.
|
||||
//
|
||||
// Keys are pairs "key_name = value" where value may be of string or integer
|
||||
// (long) type (TODO doubles and other types such as wxDate coming soon).
|
||||
// ----------------------------------------------------------------------------
|
||||
class WXDLLEXPORT wxConfigBase
|
||||
{
|
||||
public:
|
||||
// constants
|
||||
// the type of an entry
|
||||
enum EntryType
|
||||
{
|
||||
Type_Unknown,
|
||||
Type_String,
|
||||
Type_Boolean,
|
||||
Type_Integer, // use Read(long *)
|
||||
Type_Float // use Read(double *)
|
||||
};
|
||||
|
||||
// static functions
|
||||
// sets the config object, returns the previous pointer
|
||||
static wxConfigBase *Set(wxConfigBase *pConfig);
|
||||
// get the config object, creates it on demand unless DontCreateOnDemand
|
||||
// was called
|
||||
static wxConfigBase *Get() { if ( !ms_pConfig ) Create(); return ms_pConfig; }
|
||||
// create a new config object: this function will create the "best"
|
||||
// implementation of wxConfig available for the current platform, see
|
||||
// comments near definition wxCONFIG_WIN32_NATIVE for details. It returns
|
||||
// the created object and also sets it as ms_pConfig.
|
||||
static wxConfigBase *Create();
|
||||
// should Get() try to create a new log object if the current one is NULL?
|
||||
static void DontCreateOnDemand() { ms_bAutoCreate = FALSE; }
|
||||
|
||||
// ctor & virtual dtor
|
||||
// ctor (can be used as default ctor too)
|
||||
//
|
||||
// Not all args will always be used by derived classes, but including
|
||||
// them all in each class ensures compatibility. If appName is empty,
|
||||
// uses wxApp name
|
||||
wxConfigBase(const wxString& appName = wxEmptyString,
|
||||
const wxString& vendorName = wxEmptyString,
|
||||
const wxString& localFilename = wxEmptyString,
|
||||
const wxString& globalFilename = wxEmptyString,
|
||||
long style = 0);
|
||||
|
||||
// empty but ensures that dtor of all derived classes is virtual
|
||||
virtual ~wxConfigBase() { }
|
||||
|
||||
// path management
|
||||
// set current path: if the first character is '/', it's the absolute path,
|
||||
// otherwise it's a relative path. '..' is supported. If the strPath
|
||||
// doesn't exist it is created.
|
||||
virtual void SetPath(const wxString& strPath) = 0;
|
||||
// retrieve the current path (always as absolute path)
|
||||
virtual const wxString& GetPath() const = 0;
|
||||
|
||||
// enumeration: all functions here return false when there are no more items.
|
||||
// you must pass the same lIndex to GetNext and GetFirst (don't modify it)
|
||||
// enumerate subgroups
|
||||
virtual bool GetFirstGroup(wxString& str, long& lIndex) const = 0;
|
||||
virtual bool GetNextGroup (wxString& str, long& lIndex) const = 0;
|
||||
// enumerate entries
|
||||
virtual bool GetFirstEntry(wxString& str, long& lIndex) const = 0;
|
||||
virtual bool GetNextEntry (wxString& str, long& lIndex) const = 0;
|
||||
// get number of entries/subgroups in the current group, with or without
|
||||
// it's subgroups
|
||||
virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const = 0;
|
||||
virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const = 0;
|
||||
|
||||
// tests of existence
|
||||
// returns TRUE if the group by this name exists
|
||||
virtual bool HasGroup(const wxString& strName) const = 0;
|
||||
// same as above, but for an entry
|
||||
virtual bool HasEntry(const wxString& strName) const = 0;
|
||||
// returns TRUE if either a group or an entry with a given name exist
|
||||
bool Exists(const wxString& strName) const
|
||||
{ return HasGroup(strName) || HasEntry(strName); }
|
||||
|
||||
// get the entry type
|
||||
virtual EntryType GetEntryType(const wxString& name) const
|
||||
{
|
||||
// by default all entries are strings
|
||||
return HasEntry(name) ? Type_String : Type_Unknown;
|
||||
}
|
||||
|
||||
// key access: returns TRUE if value was really read, FALSE if default used
|
||||
// (and if the key is not found the default value is returned.)
|
||||
// read a string from the key
|
||||
virtual bool Read(const wxString& key, wxString *pStr) const = 0;
|
||||
virtual bool Read(const wxString& key, wxString *pStr, const wxString& defVal) const;
|
||||
|
||||
virtual wxString Read(const wxString& key, const wxString& defVal = wxEmptyString) const;
|
||||
|
||||
virtual bool Read(const wxString& key, long *pl) const = 0;
|
||||
virtual bool Read(const wxString& key, long *pl, long defVal) const;
|
||||
|
||||
virtual long Read(const wxString& strKey, long defVal) const
|
||||
{ long l; Read(strKey, &l, defVal); return l; }
|
||||
|
||||
// Convenience functions that are built on other forms
|
||||
|
||||
// int
|
||||
virtual bool Read(const wxString& key, int *pi) const;
|
||||
virtual bool Read(const wxString& key, int *pi, int defVal) const;
|
||||
|
||||
// double
|
||||
virtual bool Read(const wxString& key, double* val) const;
|
||||
virtual bool Read(const wxString& key, double* val, double defVal) const;
|
||||
|
||||
// bool
|
||||
virtual bool Read(const wxString& key, bool* val) const;
|
||||
virtual bool Read(const wxString& key, bool* val, bool defVal) const;
|
||||
|
||||
// write the value (return true on success)
|
||||
virtual bool Write(const wxString& key, const wxString& value) = 0;
|
||||
virtual bool Write(const wxString& key, long value) = 0;
|
||||
|
||||
// Convenience functions
|
||||
virtual bool Write(const wxString& key, double value);
|
||||
virtual bool Write(const wxString& key, bool value);
|
||||
|
||||
// permanently writes all changes
|
||||
virtual bool Flush(bool bCurrentOnly = FALSE) = 0;
|
||||
|
||||
// renaming, all functions return FALSE on failure (probably because the new
|
||||
// name is already taken by an existing entry)
|
||||
// rename an entry
|
||||
virtual bool RenameEntry(const wxString& oldName,
|
||||
const wxString& newName) = 0;
|
||||
// rename a group
|
||||
virtual bool RenameGroup(const wxString& oldName,
|
||||
const wxString& newName) = 0;
|
||||
|
||||
// delete entries/groups
|
||||
// deletes the specified entry and the group it belongs to if
|
||||
// it was the last key in it and the second parameter is true
|
||||
virtual bool DeleteEntry(const wxString& key,
|
||||
bool bDeleteGroupIfEmpty = TRUE) = 0;
|
||||
// delete the group (with all subgroups)
|
||||
virtual bool DeleteGroup(const wxString& key) = 0;
|
||||
// delete the whole underlying object (disk file, registry key, ...)
|
||||
// primarly for use by desinstallation routine.
|
||||
virtual bool DeleteAll() = 0;
|
||||
|
||||
// options
|
||||
// we can automatically expand environment variables in the config entries
|
||||
// (this option is on by default, you can turn it on/off at any time)
|
||||
bool IsExpandingEnvVars() const { return m_bExpandEnvVars; }
|
||||
void SetExpandEnvVars(bool bDoIt = TRUE) { m_bExpandEnvVars = bDoIt; }
|
||||
// recording of default values
|
||||
void SetRecordDefaults(bool bDoIt = TRUE) { m_bRecordDefaults = bDoIt; }
|
||||
bool IsRecordingDefaults() const { return m_bRecordDefaults; }
|
||||
// does expansion only if needed
|
||||
wxString ExpandEnvVars(const wxString& str) const;
|
||||
|
||||
// misc accessors
|
||||
wxString GetAppName() const { return m_appName; }
|
||||
wxString GetVendorName() const { return m_vendorName; }
|
||||
|
||||
void SetStyle(long style) { m_style = style; }
|
||||
long GetStyle() const { return m_style; }
|
||||
|
||||
protected:
|
||||
static bool IsImmutable(const wxString& key)
|
||||
#if !defined(__WXMAC__) && !defined(__EMX__)
|
||||
{ return !key.IsEmpty() && key[0u] == wxCONFIG_IMMUTABLE_PREFIX; }
|
||||
#else
|
||||
{ return !key.IsEmpty() && key[0ul] == wxCONFIG_IMMUTABLE_PREFIX; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
// are we doing automatic environment variable expansion?
|
||||
bool m_bExpandEnvVars;
|
||||
// do we record default values?
|
||||
bool m_bRecordDefaults;
|
||||
|
||||
// static variables
|
||||
static wxConfigBase *ms_pConfig;
|
||||
static bool ms_bAutoCreate;
|
||||
|
||||
// Application name and organisation name
|
||||
wxString m_appName;
|
||||
wxString m_vendorName;
|
||||
|
||||
// Style flag
|
||||
long m_style;
|
||||
};
|
||||
|
||||
// a handy little class which changes current path to the path of given entry
|
||||
// and restores it in dtor: so if you declare a local variable of this type,
|
||||
// you work in the entry directory and the path is automatically restored
|
||||
// when the function returns
|
||||
// Taken out of wxConfig since not all compilers can cope with nested classes.
|
||||
class wxConfigPathChanger
|
||||
{
|
||||
public:
|
||||
// ctor/dtor do path changing/restorin
|
||||
wxConfigPathChanger(const wxConfigBase *pContainer, const wxString& strEntry);
|
||||
~wxConfigPathChanger();
|
||||
|
||||
// get the key name
|
||||
const wxString& Name() const { return m_strName; }
|
||||
|
||||
private:
|
||||
wxConfigBase *m_pContainer; // object we live in
|
||||
wxString m_strName, // name of entry (i.e. name only)
|
||||
m_strOldPath; // saved path
|
||||
bool m_bChanged; // was the path changed?
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the native wxConfigBase implementation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// under Windows we prefer to use the native implementation
|
||||
#if defined(__WXMSW__) && wxCONFIG_WIN32_NATIVE
|
||||
#ifdef __WIN32__
|
||||
#define wxConfig wxRegConfig
|
||||
#define sm_classwxConfig sm_classwxRegConfig
|
||||
#else //WIN16
|
||||
#define wxConfig wxIniConfig
|
||||
#define sm_classwxConfig sm_classwxIniConfig
|
||||
#endif
|
||||
#else // either we're under Unix or wish to use files even under Windows
|
||||
#define wxConfig wxFileConfig
|
||||
#define sm_classwxConfig sm_classwxFileConfig
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_CONFIG
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// various helper global functions (defined even if !wxUSE_CONFIG)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
Replace environment variables ($SOMETHING) with their values. The format is
|
||||
$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);
|
||||
|
||||
/*
|
||||
Split path into parts removing '..' in progress
|
||||
*/
|
||||
extern void wxSplitPath(wxArrayString& aParts, const wxChar *sz);
|
||||
|
||||
#endif
|
||||
// _WX_CONFIG_H_
|
||||
|
17
include/wx/config.h
Normal file
17
include/wx/config.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef _WX_CONFIG_H_BASE_
|
||||
#define _WX_CONFIG_H_BASE_
|
||||
|
||||
#include "wx/confbase.h"
|
||||
|
||||
#if defined(__WXMSW__) && defined(wxCONFIG_WIN32_NATIVE)
|
||||
# ifdef __WIN32__
|
||||
# include "wx/msw/regconf.h"
|
||||
#else
|
||||
# include "wx/msw/iniconf.h"
|
||||
# endif
|
||||
#else
|
||||
# include "wx/fileconf.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_CONFIG_H_BASE_
|
72
include/wx/control.h
Normal file
72
include/wx/control.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/control.h
|
||||
// Purpose: wxControl common interface
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 26.07.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CONTROL_H_BASE_
|
||||
#define _WX_CONTROL_H_BASE_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "controlbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/window.h" // base class
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxControl is the base class for all controls
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxControlBase : public wxWindow
|
||||
{
|
||||
public:
|
||||
// simulates the event of given type (i.e. wxButton::Command() is just as
|
||||
// if the button was clicked)
|
||||
virtual void Command(wxCommandEvent &event);
|
||||
|
||||
protected:
|
||||
// creates the controls (invokes wxWindowBase::CreateBase) and adds it to
|
||||
// the list of parents children
|
||||
bool CreateControl(wxWindowBase *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name);
|
||||
|
||||
// inherit colour and font settings from the parent window
|
||||
void InheritAttributes();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// include platform-dependent wxControl declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/control.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/control.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/control.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/control.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/control.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/control.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/control.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_CONTROL_H_BASE_
|
43
include/wx/cursor.h
Normal file
43
include/wx/cursor.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef _WX_CURSOR_H_BASE_
|
||||
#define _WX_CURSOR_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/cursor.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/cursor.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/cursor.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/cursor.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/cursor.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/cursor.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/cursor.h"
|
||||
#endif
|
||||
|
||||
#include "wx/utils.h"
|
||||
/* This is a small class which can be used by all ports
|
||||
to temporarily suspend the busy cursor. Useful in modal
|
||||
dialogs.
|
||||
*/
|
||||
class wxBusyCursorSuspender
|
||||
{
|
||||
public:
|
||||
wxBusyCursorSuspender()
|
||||
{
|
||||
m_wasBusy = wxIsBusy();
|
||||
if(m_wasBusy)
|
||||
wxEndBusyCursor();
|
||||
}
|
||||
~wxBusyCursorSuspender()
|
||||
{
|
||||
if(m_wasBusy)
|
||||
wxBeginBusyCursor();
|
||||
}
|
||||
private:
|
||||
bool m_wasBusy;
|
||||
};
|
||||
#endif
|
||||
// _WX_CURSOR_H_BASE_
|
98
include/wx/dataobj.h
Normal file
98
include/wx/dataobj.h
Normal file
@@ -0,0 +1,98 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dataobj.h
|
||||
// Purpose: common data object classes
|
||||
// Author: Robert Roebling, Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 26.05.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows Team
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DATAOBJ_H_BASE_
|
||||
#define _WX_DATAOBJ_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/ole/dataobj.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dataobj.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dataobj.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dnd.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dnd.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dnd.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dnd.h"
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxPrivateDataObject is a specialization of wxDataObject for app specific
|
||||
// data (of some given kind, derive directly from wxDataObject if you wish to
|
||||
// efficiently support multiple formats)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPrivateDataObject : public wxDataObject
|
||||
{
|
||||
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||
DECLARE_DYNAMIC_CLASS( wxPrivateDataObject )
|
||||
#endif
|
||||
|
||||
public:
|
||||
wxPrivateDataObject();
|
||||
virtual ~wxPrivateDataObject() { Free(); }
|
||||
|
||||
// get the format object - it is used to decide whether we support the
|
||||
// given output format or not
|
||||
wxDataFormat& GetFormat() { return m_format; }
|
||||
|
||||
// set data. will make copy of the data
|
||||
void SetData( const void *data, size_t size );
|
||||
|
||||
// returns pointer to data
|
||||
void *GetData() const { return m_data; }
|
||||
|
||||
// get the size of the data
|
||||
virtual size_t GetSize() const;
|
||||
|
||||
// copy data to the given buffer
|
||||
virtual void WriteData( void *dest ) const;
|
||||
|
||||
// these functions are provided for wxGTK compatibility, their usage is
|
||||
// deprecated - use GetFormat().SetId() instead
|
||||
void SetId( const wxString& id ) { m_format.SetId(id); }
|
||||
wxString GetId() const { return m_format.GetId(); }
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual wxDataFormat GetPreferredFormat() const
|
||||
{ return m_format; }
|
||||
virtual bool IsSupportedFormat(wxDataFormat format) const
|
||||
{ return m_format == format; }
|
||||
virtual size_t GetDataSize() const
|
||||
{ return m_size; }
|
||||
virtual void GetDataHere(void *dest) const
|
||||
{ WriteData(dest); }
|
||||
|
||||
// the function which really copies the data - called by WriteData() above
|
||||
// and uses GetSize() to get the size of the data
|
||||
void WriteData( const void *data, void *dest ) const;
|
||||
|
||||
private:
|
||||
// free the data
|
||||
void Free();
|
||||
|
||||
// the data
|
||||
size_t m_size;
|
||||
void *m_data;
|
||||
|
||||
#if !defined(__WXGTK__) && !defined(__WXMOTIF__)
|
||||
// the data format
|
||||
wxDataFormat m_format;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
// _WX_DATAOBJ_H_BASE_
|
146
include/wx/date.h
Normal file
146
include/wx/date.h
Normal file
@@ -0,0 +1,146 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: date.h
|
||||
// Purpose: wxDate class
|
||||
// Author: Julian Smart, Steve Marcus, Eric Simon, Chris Hill,
|
||||
// Charles D. Price
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DATE_H_
|
||||
#define _WX_DATE_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "date.h"
|
||||
#endif
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/string.h"
|
||||
|
||||
#if wxUSE_TIMEDATE
|
||||
// These lines necessary to stop VC++ 6 being confused about namespaces
|
||||
class WXDLLEXPORT wxDate;
|
||||
bool WXDLLEXPORT operator<(const wxDate &dt1, const wxDate &dt2);
|
||||
bool WXDLLEXPORT operator<(const wxDate &dt1, const wxDate &dt2);
|
||||
bool WXDLLEXPORT operator <= (const wxDate &dt1, const wxDate &dt2);
|
||||
bool WXDLLEXPORT operator > (const wxDate &dt1, const wxDate &dt2);
|
||||
bool WXDLLEXPORT operator >= (const wxDate &dt1, const wxDate &dt2);
|
||||
bool WXDLLEXPORT operator == (const wxDate &dt1, const wxDate &dt2);
|
||||
bool WXDLLEXPORT operator != (const wxDate &dt1, const wxDate &dt2);
|
||||
|
||||
enum wxdate_format_type {wxMDY, wxDAY, wxMONTH, wxFULL, wxEUROPEAN};
|
||||
|
||||
#define wxNO_CENTURY 0x02
|
||||
#define wxDATE_ABBR 0x04
|
||||
|
||||
class WXDLLEXPORT wxDate : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxDate)
|
||||
|
||||
protected:
|
||||
unsigned long julian; // see julDate(); days since 1/1/4713 B.C.
|
||||
int month; // see NMonth()
|
||||
int day; // see Day()
|
||||
int year; // see NYear4()
|
||||
int day_of_week; // see NDOW(); 1 = Sunday, ... 7 = Saturday
|
||||
|
||||
private:
|
||||
int DisplayFormat;
|
||||
unsigned char DisplayOptions;
|
||||
|
||||
void julian_to_mdy (); // convert julian day to mdy
|
||||
void julian_to_wday (); // convert julian day to day_of_week
|
||||
void mdy_to_julian (); // convert mdy to julian day
|
||||
|
||||
public:
|
||||
wxDate ();
|
||||
wxDate (long j);
|
||||
wxDate (int m, int d, int y);
|
||||
wxDate (const wxString& dat);
|
||||
wxDate (const wxDate &dt);
|
||||
|
||||
#ifndef __SALFORDC__
|
||||
operator wxString (void);
|
||||
#endif
|
||||
|
||||
void operator = (const wxDate& date);
|
||||
void operator = (const wxString& date);
|
||||
|
||||
wxDate operator + (long i);
|
||||
wxDate operator + (int i);
|
||||
|
||||
wxDate operator - (long i);
|
||||
wxDate operator - (int i);
|
||||
|
||||
long operator - (const wxDate &dt);
|
||||
|
||||
wxDate &operator += (long i);
|
||||
wxDate &operator -= (long i);
|
||||
|
||||
wxDate &operator ++ (); // Prefix increment
|
||||
wxDate &operator ++ (int); // Postfix increment
|
||||
wxDate &operator -- (); // Prefix decrement
|
||||
wxDate &operator -- (int); // Postfix decrement
|
||||
|
||||
friend bool WXDLLEXPORT operator < (const wxDate &dt1, const wxDate &dt2);
|
||||
friend bool WXDLLEXPORT operator <= (const wxDate &dt1, const wxDate &dt2);
|
||||
friend bool WXDLLEXPORT operator > (const wxDate &dt1, const wxDate &dt2);
|
||||
friend bool WXDLLEXPORT operator >= (const wxDate &dt1, const wxDate &dt2);
|
||||
friend bool WXDLLEXPORT operator == (const wxDate &dt1, const wxDate &dt2);
|
||||
friend bool WXDLLEXPORT operator != (const wxDate &dt1, const wxDate &dt2);
|
||||
|
||||
#if wxUSE_STD_IOSTREAM
|
||||
friend ostream WXDLLEXPORT & operator << (ostream &os, const wxDate &dt);
|
||||
#endif
|
||||
|
||||
wxString FormatDate (int type=-1) const;
|
||||
void SetFormat (int format);
|
||||
int SetOption (int option, bool enable=TRUE);
|
||||
|
||||
long GetJulianDate() const; // returns julian date
|
||||
int GetDayOfYear() const; // returns relative date since Jan. 1
|
||||
bool IsLeapYear() const; // returns TRUE if leap year, FALSE if not
|
||||
|
||||
// Version 4.0 Extension to Public Interface - CDP
|
||||
|
||||
// These 'Set's modify the date object and actually SET it
|
||||
// They all return a reference to self (*this)
|
||||
|
||||
wxDate &Set(); // Sets to current system date
|
||||
wxDate &Set(long lJulian);
|
||||
wxDate &Set(int nMonth, int nDay, int nYear);
|
||||
|
||||
wxDate &AddWeeks(int nCount = 1); //
|
||||
wxDate &AddMonths(int nCount = 1); // May also pass neg# to decrement
|
||||
wxDate &AddYears(int nCount = 1); //
|
||||
|
||||
int GetDay() const; // Numeric Day of date object
|
||||
int GetDaysInMonth(); // Number of days in month (1..31)
|
||||
int GetFirstDayOfMonth() const; // First Day Of Month (1..7)
|
||||
|
||||
wxString GetDayOfWeekName(); // Character Day Of Week ('Sunday'..'Saturday')
|
||||
int GetDayOfWeek() const; // (1..7)
|
||||
|
||||
int GetWeekOfMonth(); // Numeric Week Of Month (1..6)
|
||||
int GetWeekOfYear(); // Numeric Week Of Year (1..52)
|
||||
|
||||
wxString GetMonthName(); // Character Month name
|
||||
int GetMonth() const; // Month Number (1..12)
|
||||
wxDate GetMonthStart(); // First Date Of Month
|
||||
wxDate GetMonthEnd(); // Last Date Of Month
|
||||
|
||||
int GetYear() const; // eg. 1992
|
||||
wxDate GetYearStart(); // First Date Of Year
|
||||
wxDate GetYearEnd(); // Last Date Of Year
|
||||
|
||||
bool IsBetween(const wxDate& first, const wxDate& second) const;
|
||||
|
||||
wxDate Previous(int dayOfWeek) const;
|
||||
};
|
||||
|
||||
#endif // wxUSE_TIMEDATE
|
||||
#endif
|
||||
// _WX_DATE_H_
|
82
include/wx/datstrm.h
Normal file
82
include/wx/datstrm.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: datstrm.h
|
||||
// Purpose: Data stream classes
|
||||
// Author: Guilhem Lavaux
|
||||
// Modified by:
|
||||
// Created: 28/06/1998
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Guilhem Lavaux
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DATSTREAM_H_
|
||||
#define _WX_DATSTREAM_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "datstrm.h"
|
||||
#endif
|
||||
|
||||
#include "wx/stream.h"
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
|
||||
class WXDLLEXPORT wxDataInputStream {
|
||||
public:
|
||||
wxDataInputStream(wxInputStream& s);
|
||||
~wxDataInputStream();
|
||||
|
||||
wxUint32 Read32();
|
||||
wxUint16 Read16();
|
||||
wxUint8 Read8();
|
||||
double ReadDouble();
|
||||
wxString ReadString();
|
||||
|
||||
wxDataInputStream& operator>>(wxString& s);
|
||||
wxDataInputStream& operator>>(wxInt8& c);
|
||||
wxDataInputStream& operator>>(wxInt16& i);
|
||||
wxDataInputStream& operator>>(wxInt32& i);
|
||||
wxDataInputStream& operator>>(wxUint8& c);
|
||||
wxDataInputStream& operator>>(wxUint16& i);
|
||||
wxDataInputStream& operator>>(wxUint32& i);
|
||||
wxDataInputStream& operator>>(double& i);
|
||||
wxDataInputStream& operator>>(float& f);
|
||||
|
||||
void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
|
||||
protected:
|
||||
wxInputStream *m_input;
|
||||
bool m_be_order;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxDataOutputStream {
|
||||
public:
|
||||
wxDataOutputStream(wxOutputStream& s);
|
||||
~wxDataOutputStream();
|
||||
|
||||
void Write32(wxUint32 i);
|
||||
void Write16(wxUint16 i);
|
||||
void Write8(wxUint8 i);
|
||||
void WriteDouble(double d);
|
||||
void WriteString(const wxString& string);
|
||||
|
||||
wxDataOutputStream& operator<<(const wxChar *string);
|
||||
wxDataOutputStream& operator<<(wxString& string);
|
||||
wxDataOutputStream& operator<<(wxInt8 c);
|
||||
wxDataOutputStream& operator<<(wxInt16 i);
|
||||
wxDataOutputStream& operator<<(wxInt32 i);
|
||||
wxDataOutputStream& operator<<(wxUint8 c);
|
||||
wxDataOutputStream& operator<<(wxUint16 i);
|
||||
wxDataOutputStream& operator<<(wxUint32 i);
|
||||
wxDataOutputStream& operator<<(double f);
|
||||
wxDataOutputStream& operator<<(float f);
|
||||
|
||||
void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
|
||||
protected:
|
||||
wxOutputStream *m_output;
|
||||
bool m_be_order;
|
||||
};
|
||||
|
||||
#endif
|
||||
// wxUSE_STREAMS
|
||||
|
||||
#endif
|
||||
// _WX_DATSTREAM_H_
|
461
include/wx/db.h
Normal file
461
include/wx/db.h
Normal file
@@ -0,0 +1,461 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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
|
||||
// source such as opening and closing the data source.
|
||||
// Author: Doug Card
|
||||
// Modified by:
|
||||
// Mods: Dec, 1998:
|
||||
// -Added support for SQL statement logging and database cataloging
|
||||
// April, 1999
|
||||
// -Added QUERY_ONLY mode support to reduce default number of cursors
|
||||
// -Added additional SQL logging code
|
||||
// -Added DEBUG-ONLY tracking of Ctable objects to detect orphaned DB connections
|
||||
// -Set ODBC option to only read committed writes to the DB so all
|
||||
// databases operate the same in that respect
|
||||
//
|
||||
// Created: 9.96
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1996 Remstar International, Inc.
|
||||
// Licence: wxWindows licence, plus:
|
||||
// Notice: This class library and its intellectual design are free of charge for use,
|
||||
// modification, enhancement, debugging under the following conditions:
|
||||
// 1) These classes may only be used as part of the implementation of a
|
||||
// wxWindows-based application
|
||||
// 2) All enhancements and bug fixes are to be submitted back to the wxWindows
|
||||
// user groups free of all charges for use with the wxWindows library.
|
||||
// 3) These classes may not be distributed as part of any other class library,
|
||||
// DLL, text (written or electronic), other than a complete distribution of
|
||||
// the wxWindows GUI development toolkit.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
// SYNOPSIS START
|
||||
// SYNOPSIS STOP
|
||||
*/
|
||||
|
||||
#ifndef DB_DOT_H
|
||||
#define DB_DOT_H
|
||||
|
||||
// Use this line for wxWindows v1.x
|
||||
//#include "wx_ver.h"
|
||||
// Use this line for wxWindows v2.x
|
||||
#include "wx/version.h"
|
||||
|
||||
#if wxMAJOR_VERSION == 2
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "db.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(wx_msw) || defined(__WXMSW__) || defined(WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef __UNIX__
|
||||
#if wxMAJOR_VERSION == 2
|
||||
extern "C" {
|
||||
#include "../../src/iodbc/isql.h"
|
||||
#include "../../src/iodbc/isqlext.h"
|
||||
}
|
||||
#else // version == 1
|
||||
extern "C" {
|
||||
#include "iodbc.h"
|
||||
#include "isqlext.h"
|
||||
}
|
||||
#endif
|
||||
typedef float SFLOAT;
|
||||
typedef double SDOUBLE;
|
||||
typedef unsigned int UINT;
|
||||
#define ULONG UDWORD
|
||||
#else // msw
|
||||
#define ODBCVER 0x0250
|
||||
#include <sql.h>
|
||||
#include <sqlext.h>
|
||||
#endif
|
||||
|
||||
#ifdef __UNIX__
|
||||
# ifndef strnicmp
|
||||
# define strnicmp strncasecmp
|
||||
# endif
|
||||
# ifndef stricmp
|
||||
# define stricmp strcasecmp
|
||||
# endif
|
||||
#else
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
enum enumDummy {enumDum1};
|
||||
|
||||
#define SQL_C_BOOLEAN(datatype) (sizeof(datatype) == 1 ? SQL_C_UTINYINT : (sizeof(datatype) == 2 ? SQL_C_USHORT : SQL_C_ULONG))
|
||||
// #define SQL_C_BOOLEAN (sizeof(Bool) == 2 ? SQL_C_USHORT : SQL_C_ULONG)
|
||||
|
||||
#define SQL_C_ENUM (sizeof(enumDummy) == 2 ? SQL_C_USHORT : SQL_C_ULONG)
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
const int DB_PATH_MAX = 254;
|
||||
|
||||
// Database Globals
|
||||
const int DB_TYPE_NAME_LEN = 40;
|
||||
const int DB_MAX_STATEMENT_LEN = 2048;
|
||||
const int DB_MAX_WHERE_CLAUSE_LEN = 1024;
|
||||
const int DB_MAX_ERROR_MSG_LEN = 512;
|
||||
const int DB_MAX_ERROR_HISTORY = 5;
|
||||
const int DB_MAX_TABLE_NAME_LEN = 128;
|
||||
const int DB_MAX_COLUMN_NAME_LEN = 128;
|
||||
|
||||
const int DB_DATA_TYPE_VARCHAR = 1;
|
||||
const int DB_DATA_TYPE_INTEGER = 2;
|
||||
const int DB_DATA_TYPE_FLOAT = 3;
|
||||
const int DB_DATA_TYPE_DATE = 4;
|
||||
|
||||
const int DB_SELECT_KEYFIELDS = 1;
|
||||
const int DB_SELECT_WHERE = 2;
|
||||
const int DB_SELECT_MATCHING = 3;
|
||||
const int DB_SELECT_STATEMENT = 4;
|
||||
|
||||
const int DB_UPD_KEYFIELDS = 1;
|
||||
const int DB_UPD_WHERE = 2;
|
||||
|
||||
const int DB_DEL_KEYFIELDS = 1;
|
||||
const int DB_DEL_WHERE = 2;
|
||||
const int DB_DEL_MATCHING = 3;
|
||||
|
||||
const int DB_WHERE_KEYFIELDS = 1;
|
||||
const int DB_WHERE_MATCHING = 2;
|
||||
|
||||
const int DB_GRANT_SELECT = 1;
|
||||
const int DB_GRANT_INSERT = 2;
|
||||
const int DB_GRANT_UPDATE = 4;
|
||||
const int DB_GRANT_DELETE = 8;
|
||||
const int DB_GRANT_ALL = DB_GRANT_SELECT | DB_GRANT_INSERT | DB_GRANT_UPDATE | DB_GRANT_DELETE;
|
||||
|
||||
// ODBC Error codes (derived from ODBC SqlState codes)
|
||||
enum ODBC_ERRORS
|
||||
{
|
||||
DB_FAILURE = 0,
|
||||
DB_SUCCESS = 1,
|
||||
DB_ERR_NOT_IN_USE,
|
||||
DB_ERR_GENERAL_WARNING, // SqlState = '01000'
|
||||
DB_ERR_DISCONNECT_ERROR, // SqlState = '01002'
|
||||
DB_ERR_DATA_TRUNCATED, // SqlState = '01004'
|
||||
DB_ERR_PRIV_NOT_REVOKED, // SqlState = '01006'
|
||||
DB_ERR_INVALID_CONN_STR_ATTR, // SqlState = '01S00'
|
||||
DB_ERR_ERROR_IN_ROW, // SqlState = '01S01'
|
||||
DB_ERR_OPTION_VALUE_CHANGED, // SqlState = '01S02'
|
||||
DB_ERR_NO_ROWS_UPD_OR_DEL, // SqlState = '01S03'
|
||||
DB_ERR_MULTI_ROWS_UPD_OR_DEL, // SqlState = '01S04'
|
||||
DB_ERR_WRONG_NO_OF_PARAMS, // SqlState = '07001'
|
||||
DB_ERR_DATA_TYPE_ATTR_VIOL, // SqlState = '07006'
|
||||
DB_ERR_UNABLE_TO_CONNECT, // SqlState = '08001'
|
||||
DB_ERR_CONNECTION_IN_USE, // SqlState = '08002'
|
||||
DB_ERR_CONNECTION_NOT_OPEN, // SqlState = '08003'
|
||||
DB_ERR_REJECTED_CONNECTION, // SqlState = '08004'
|
||||
DB_ERR_CONN_FAIL_IN_TRANS, // SqlState = '08007'
|
||||
DB_ERR_COMM_LINK_FAILURE, // SqlState = '08S01'
|
||||
DB_ERR_INSERT_VALUE_LIST_MISMATCH, // SqlState = '21S01'
|
||||
DB_ERR_DERIVED_TABLE_MISMATCH, // SqlState = '21S02'
|
||||
DB_ERR_STRING_RIGHT_TRUNC, // SqlState = '22001'
|
||||
DB_ERR_NUMERIC_VALUE_OUT_OF_RNG, // SqlState = '22003'
|
||||
DB_ERR_ERROR_IN_ASSIGNMENT, // SqlState = '22005'
|
||||
DB_ERR_DATETIME_FLD_OVERFLOW, // SqlState = '22008'
|
||||
DB_ERR_DIVIDE_BY_ZERO, // SqlState = '22012'
|
||||
DB_ERR_STR_DATA_LENGTH_MISMATCH, // SqlState = '22026'
|
||||
DB_ERR_INTEGRITY_CONSTRAINT_VIOL, // SqlState = '23000'
|
||||
DB_ERR_INVALID_CURSOR_STATE, // SqlState = '24000'
|
||||
DB_ERR_INVALID_TRANS_STATE, // SqlState = '25000'
|
||||
DB_ERR_INVALID_AUTH_SPEC, // SqlState = '28000'
|
||||
DB_ERR_INVALID_CURSOR_NAME, // SqlState = '34000'
|
||||
DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL, // SqlState = '37000'
|
||||
DB_ERR_DUPLICATE_CURSOR_NAME, // SqlState = '3C000'
|
||||
DB_ERR_SERIALIZATION_FAILURE, // SqlState = '40001'
|
||||
DB_ERR_SYNTAX_ERROR_OR_ACCESS_VIOL2, // SqlState = '42000'
|
||||
DB_ERR_OPERATION_ABORTED, // SqlState = '70100'
|
||||
DB_ERR_UNSUPPORTED_FUNCTION, // SqlState = 'IM001'
|
||||
DB_ERR_NO_DATA_SOURCE, // SqlState = 'IM002'
|
||||
DB_ERR_DRIVER_LOAD_ERROR, // SqlState = 'IM003'
|
||||
DB_ERR_SQLALLOCENV_FAILED, // SqlState = 'IM004'
|
||||
DB_ERR_SQLALLOCCONNECT_FAILED, // SqlState = 'IM005'
|
||||
DB_ERR_SQLSETCONNECTOPTION_FAILED, // SqlState = 'IM006'
|
||||
DB_ERR_NO_DATA_SOURCE_DLG_PROHIB, // SqlState = 'IM007'
|
||||
DB_ERR_DIALOG_FAILED, // SqlState = 'IM008'
|
||||
DB_ERR_UNABLE_TO_LOAD_TRANSLATION_DLL, // SqlState = 'IM009'
|
||||
DB_ERR_DATA_SOURCE_NAME_TOO_LONG, // SqlState = 'IM010'
|
||||
DB_ERR_DRIVER_NAME_TOO_LONG, // SqlState = 'IM011'
|
||||
DB_ERR_DRIVER_KEYWORD_SYNTAX_ERROR, // SqlState = 'IM012'
|
||||
DB_ERR_TRACE_FILE_ERROR, // SqlState = 'IM013'
|
||||
DB_ERR_TABLE_OR_VIEW_ALREADY_EXISTS, // SqlState = 'S0001'
|
||||
DB_ERR_TABLE_NOT_FOUND, // SqlState = 'S0002'
|
||||
DB_ERR_INDEX_ALREADY_EXISTS, // SqlState = 'S0011'
|
||||
DB_ERR_INDEX_NOT_FOUND, // SqlState = 'S0012'
|
||||
DB_ERR_COLUMN_ALREADY_EXISTS, // SqlState = 'S0021'
|
||||
DB_ERR_COLUMN_NOT_FOUND, // SqlState = 'S0022'
|
||||
DB_ERR_NO_DEFAULT_FOR_COLUMN, // SqlState = 'S0023'
|
||||
DB_ERR_GENERAL_ERROR, // SqlState = 'S1000'
|
||||
DB_ERR_MEMORY_ALLOCATION_FAILURE, // SqlState = 'S1001'
|
||||
DB_ERR_INVALID_COLUMN_NUMBER, // SqlState = 'S1002'
|
||||
DB_ERR_PROGRAM_TYPE_OUT_OF_RANGE, // SqlState = 'S1003'
|
||||
DB_ERR_SQL_DATA_TYPE_OUT_OF_RANGE, // SqlState = 'S1004'
|
||||
DB_ERR_OPERATION_CANCELLED, // SqlState = 'S1008'
|
||||
DB_ERR_INVALID_ARGUMENT_VALUE, // SqlState = 'S1009'
|
||||
DB_ERR_FUNCTION_SEQUENCE_ERROR, // SqlState = 'S1010'
|
||||
DB_ERR_OPERATION_INVALID_AT_THIS_TIME, // SqlState = 'S1011'
|
||||
DB_ERR_INVALID_TRANS_OPERATION_CODE, // SqlState = 'S1012'
|
||||
DB_ERR_NO_CURSOR_NAME_AVAIL, // SqlState = 'S1015'
|
||||
DB_ERR_INVALID_STR_OR_BUF_LEN, // SqlState = 'S1090'
|
||||
DB_ERR_DESCRIPTOR_TYPE_OUT_OF_RANGE, // SqlState = 'S1091'
|
||||
DB_ERR_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1092'
|
||||
DB_ERR_INVALID_PARAM_NO, // SqlState = 'S1093'
|
||||
DB_ERR_INVALID_SCALE_VALUE, // SqlState = 'S1094'
|
||||
DB_ERR_FUNCTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1095'
|
||||
DB_ERR_INF_TYPE_OUT_OF_RANGE, // SqlState = 'S1096'
|
||||
DB_ERR_COLUMN_TYPE_OUT_OF_RANGE, // SqlState = 'S1097'
|
||||
DB_ERR_SCOPE_TYPE_OUT_OF_RANGE, // SqlState = 'S1098'
|
||||
DB_ERR_NULLABLE_TYPE_OUT_OF_RANGE, // SqlState = 'S1099'
|
||||
DB_ERR_UNIQUENESS_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1100'
|
||||
DB_ERR_ACCURACY_OPTION_TYPE_OUT_OF_RANGE, // SqlState = 'S1101'
|
||||
DB_ERR_DIRECTION_OPTION_OUT_OF_RANGE, // SqlState = 'S1103'
|
||||
DB_ERR_INVALID_PRECISION_VALUE, // SqlState = 'S1104'
|
||||
DB_ERR_INVALID_PARAM_TYPE, // SqlState = 'S1105'
|
||||
DB_ERR_FETCH_TYPE_OUT_OF_RANGE, // SqlState = 'S1106'
|
||||
DB_ERR_ROW_VALUE_OUT_OF_RANGE, // SqlState = 'S1107'
|
||||
DB_ERR_CONCURRENCY_OPTION_OUT_OF_RANGE, // SqlState = 'S1108'
|
||||
DB_ERR_INVALID_CURSOR_POSITION, // SqlState = 'S1109'
|
||||
DB_ERR_INVALID_DRIVER_COMPLETION, // SqlState = 'S1110'
|
||||
DB_ERR_INVALID_BOOKMARK_VALUE, // SqlState = 'S1111'
|
||||
DB_ERR_DRIVER_NOT_CAPABLE, // SqlState = 'S1C00'
|
||||
DB_ERR_TIMEOUT_EXPIRED // SqlState = 'S1T00'
|
||||
};
|
||||
|
||||
struct DbStuff
|
||||
{
|
||||
HENV Henv;
|
||||
char Dsn[SQL_MAX_DSN_LENGTH+1]; // Data Source Name
|
||||
char Uid[20+1]; // User ID
|
||||
char AuthStr[20+1]; // Authorization string (password)
|
||||
|
||||
char description[SQL_MAX_DSN_LENGTH+1]; // Not sure what the max length is
|
||||
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
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char TypeName[DB_TYPE_NAME_LEN];
|
||||
int FsqlType;
|
||||
long Precision;
|
||||
short CaseSensitive;
|
||||
// short MinimumScale;
|
||||
short MaximumScale;
|
||||
} SqlTypeInfo;
|
||||
|
||||
class WXDLLEXPORT CcolInf
|
||||
{
|
||||
public:
|
||||
char tableName[DB_MAX_TABLE_NAME_LEN+1];
|
||||
char colName[DB_MAX_COLUMN_NAME_LEN+1];
|
||||
int sqlDataType;
|
||||
};
|
||||
|
||||
enum sqlLog
|
||||
{
|
||||
sqlLogOFF,
|
||||
sqlLogON
|
||||
};
|
||||
|
||||
enum dbms
|
||||
{
|
||||
dbmsUNIDENTIFIED,
|
||||
dbmsORACLE,
|
||||
dbmsSYBASE_ASA, // Adaptive Server Anywhere
|
||||
dbmsSYBASE_ASE, // Adaptive Server Enterprise
|
||||
dbmsMS_SQL_SERVER,
|
||||
dbmsMY_SQL,
|
||||
dbmsPOSTGRES,
|
||||
dbmsACCESS,
|
||||
dbmsDBASE
|
||||
};
|
||||
|
||||
typedef enum dbms DBMS;
|
||||
|
||||
// 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
|
||||
// this variable.
|
||||
extern char DBerrorList[DB_MAX_ERROR_HISTORY][DB_MAX_ERROR_MSG_LEN];
|
||||
|
||||
class WXDLLEXPORT wxDB
|
||||
{
|
||||
private:
|
||||
|
||||
// Private data
|
||||
bool dbIsOpen;
|
||||
char *dsn; // Data source name
|
||||
char *uid; // User ID
|
||||
char *authStr; // Authorization string (password)
|
||||
FILE *fpSqlLog; // Sql Log file pointer
|
||||
enum sqlLog sqlLogState; // On or Off
|
||||
|
||||
// Private member functions
|
||||
bool getDbInfo(void);
|
||||
bool getDataTypeInfo(SWORD fSqlType, SqlTypeInfo &structSQLTypeInfo);
|
||||
bool setConnectionOptions(void);
|
||||
void logError(char *errMsg, char *SQLState);
|
||||
|
||||
public:
|
||||
|
||||
// The following structure contains database information gathered from the
|
||||
// datasource when the datasource is first opened.
|
||||
struct
|
||||
{
|
||||
char dbmsName[40]; // Name of the dbms product
|
||||
char dbmsVer[64]; // Version # of the dbms product
|
||||
char driverName[40]; // Driver name
|
||||
char odbcVer[60]; // ODBC version of the driver
|
||||
char drvMgrOdbcVer[60]; // ODBC version of the driver manager
|
||||
char driverVer[60]; // Driver version
|
||||
char serverName[80]; // Server Name, typically a connect string
|
||||
char databaseName[128]; // Database filename
|
||||
char outerJoins[2]; // Indicates whether the data source supports outer joins
|
||||
char procedureSupport[2]; // Indicates whether the data source supports stored procedures
|
||||
UWORD maxConnections; // Maximum # of connections the data source supports
|
||||
UWORD maxStmts; // Maximum # of HSTMTs per HDBC
|
||||
UWORD apiConfLvl; // ODBC API conformance level
|
||||
UWORD cliConfLvl; // Indicates whether the data source is SAG compliant
|
||||
UWORD sqlConfLvl; // SQL conformance level
|
||||
UWORD cursorCommitBehavior; // Indicates how cursors are affected by a db commit
|
||||
UWORD cursorRollbackBehavior; // Indicates how cursors are affected by a db rollback
|
||||
UWORD supportNotNullClause; // Indicates if data source supports NOT NULL clause
|
||||
char supportIEF[2]; // Integrity Enhancement Facility (Referential Integrity)
|
||||
UDWORD txnIsolation; // Default transaction isolation level supported by the driver
|
||||
UDWORD txnIsolationOptions; // Transaction isolation level options available
|
||||
UDWORD fetchDirections; // Fetch directions supported
|
||||
UDWORD lockTypes; // Lock types supported in SQLSetPos
|
||||
UDWORD posOperations; // Position operations supported in SQLSetPos
|
||||
UDWORD posStmts; // Position statements supported
|
||||
UDWORD scrollConcurrency; // Concurrency control options supported for scrollable cursors
|
||||
UDWORD scrollOptions; // Scroll Options supported for scrollable cursors
|
||||
UDWORD staticSensitivity; // Indicates if additions, deletions and updates can be detected
|
||||
UWORD txnCapable; // Indicates if the data source supports transactions
|
||||
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;
|
||||
|
||||
//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
|
||||
// type name the data source uses for each logical data type.
|
||||
// e.g. VARCHAR; Oracle calls it VARCHAR2.
|
||||
SqlTypeInfo typeInfVarchar, typeInfInteger, typeInfFloat, typeInfDate;
|
||||
|
||||
// Public member functions
|
||||
wxDB(HENV &aHenv);
|
||||
bool Open(char *Dsn, char *Uid, char *AuthStr); // Data Source Name, User ID, Password
|
||||
void Close(void);
|
||||
bool CommitTrans(void);
|
||||
bool RollbackTrans(void);
|
||||
bool DispAllErrors(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT);
|
||||
bool GetNextError(HENV aHenv, HDBC aHdbc = SQL_NULL_HDBC, HSTMT aHstmt = SQL_NULL_HSTMT);
|
||||
void DispNextError(void);
|
||||
bool CreateView(char *viewName, char *colList, char *pSqlStmt, bool attemptDrop=TRUE);
|
||||
bool DropView(char *viewName);
|
||||
bool ExecSql(char *pSqlStmt);
|
||||
bool GetNext(void);
|
||||
bool GetData(UWORD colNo, SWORD cType, PTR pData, SDWORD maxLen, SDWORD FAR *cbReturned);
|
||||
bool Grant(int privileges, char *tableName, char *userList = "PUBLIC");
|
||||
int TranslateSqlState(char *SQLState);
|
||||
bool Catalog(char *userID, char *fileName = "Catalog.txt");
|
||||
CcolInf *GetColumns(char *tableName[], char *userID=NULL);
|
||||
char *GetDatabaseName(void) {return dbInf.dbmsName;}
|
||||
char *GetDataSource(void) {return dsn;}
|
||||
char *GetUsername(void) {return uid;}
|
||||
char *GetPassword(void) {return authStr;}
|
||||
bool IsOpen(void) {return dbIsOpen;}
|
||||
HENV GetHENV(void) {return henv;}
|
||||
HDBC GetHDBC(void) {return hdbc;}
|
||||
HSTMT GetHSTMT(void) {return hstmt;}
|
||||
bool TableExists(char *tableName, char *userID=NULL, char *path=NULL); // Table name can refer to a table, view, alias or synonym
|
||||
void LogError(char *errMsg, char *SQLState = 0) {logError(errMsg, SQLState);}
|
||||
bool SqlLog(enum sqlLog state, char *filename = "sqllog.txt", bool append = FALSE);
|
||||
bool WriteSqlLog(char *logMsg);
|
||||
DBMS Dbms(void);
|
||||
|
||||
}; // wxDB
|
||||
|
||||
// This structure forms a node in a linked list. The linked list of "DbList" objects
|
||||
// keeps track of allocated database connections. This allows the application to
|
||||
// open more than one database connection through ODBC for multiple transaction support
|
||||
// or for multiple database support.
|
||||
|
||||
struct DbList
|
||||
{
|
||||
DbList *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
|
||||
bool Free; // Is item free or in use?
|
||||
DbList *PtrNext; // Pointer to next item in the list
|
||||
};
|
||||
|
||||
|
||||
#if __WXDEBUG__ > 0
|
||||
#include "wx/object.h"
|
||||
class CstructTablesInUse : public wxObject
|
||||
{
|
||||
public:
|
||||
const char *tableName;
|
||||
ULONG tableID;
|
||||
class wxDB *pDb;
|
||||
}; // CstructTablesInUse
|
||||
#endif
|
||||
|
||||
// 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 *GetDbConnection(DbStuff *pDbStuff);
|
||||
bool WXDLLEXPORT FreeDbConnection(wxDB *pDb);
|
||||
void WXDLLEXPORT CloseDbConnections(void);
|
||||
int WXDLLEXPORT NumberDbConnectionsInUse(void);
|
||||
|
||||
// This function sets the sql log state for all open wxDB objects
|
||||
bool SqlLog(enum sqlLog state, char *filename = "sqllog.txt");
|
||||
|
||||
// This routine allows you to query a driver manager
|
||||
// for a list of available datasources. Call this routine
|
||||
// the first time using SQL_FETCH_FIRST. Continue to call it
|
||||
// using SQL_FETCH_NEXT until you've exhausted the list.
|
||||
bool WXDLLEXPORT GetDataSource(HENV henv, char *Dsn, SWORD DsnMax, char *DsDesc, SWORD DsDescMax,
|
||||
UWORD direction = SQL_FETCH_NEXT);
|
||||
|
||||
#endif
|
196
include/wx/dbtable.h
Normal file
196
include/wx/dbtable.h
Normal file
@@ -0,0 +1,196 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dbtable.h
|
||||
// Purpose: Declaration of the wxTable class.
|
||||
// Author: Doug Card
|
||||
// Modified by:
|
||||
// Created: 9.96
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1996 Remstar International, Inc.
|
||||
// Licence: wxWindows licence, plus:
|
||||
// Notice: This class library and its intellectual design are free of charge for use,
|
||||
// modification, enhancement, debugging under the following conditions:
|
||||
// 1) These classes may only be used as part of the implementation of a
|
||||
// wxWindows-based application
|
||||
// 2) All enhancements and bug fixes are to be submitted back to the wxWindows
|
||||
// user groups free of all charges for use with the wxWindows library.
|
||||
// 3) These classes may not be distributed as part of any other class library,
|
||||
// DLL, text (written or electronic), other than a complete distribution of
|
||||
// the wxWindows GUI development toolkit.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
// SYNOPSIS START
|
||||
// SYNOPSIS STOP
|
||||
*/
|
||||
|
||||
#ifndef DBTABLE_DOT_H
|
||||
#define DBTABLE_DOT_H
|
||||
|
||||
// Use this line for wxWindows v1.x
|
||||
//#include "wx_ver.h"
|
||||
// Use this line for wxWindows v2.x
|
||||
#include "wx/version.h"
|
||||
|
||||
#if wxMAJOR_VERSION == 2
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dbtable.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if wxMAJOR_VERSION == 2
|
||||
#include "wx/db.h"
|
||||
#else
|
||||
#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;
|
||||
|
||||
// The following class is used to define a column of a table.
|
||||
// The wxTable 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
|
||||
// constructor. These column definitions provide inf. to the
|
||||
// wxTable 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 CcolDef
|
||||
{
|
||||
public:
|
||||
char ColName[DB_MAX_COLUMN_NAME_LEN+1]; // Column Name
|
||||
int DbDataType; // Logical Data Type; e.g. DB_DATA_TYPE_INTEGER
|
||||
int SqlCtype; // C data type; e.g. SQL_C_LONG
|
||||
void *PtrDataObj; // Address of the data object
|
||||
int SzDataObj; // Size, in bytes, of the data object
|
||||
bool KeyField; // TRUE if this column is part of the PRIMARY KEY to the table; Date fields should NOT be KeyFields.
|
||||
bool Updateable; // Specifies whether this column is updateable
|
||||
bool InsertAllowed; // Specifies whether this column should be included in an INSERT statement
|
||||
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
|
||||
}; // CcolDef
|
||||
|
||||
// This structure is used when creating secondary indexes.
|
||||
class WXDLLEXPORT CidxDef
|
||||
{
|
||||
public:
|
||||
char ColName[DB_MAX_COLUMN_NAME_LEN+1];
|
||||
bool Ascending;
|
||||
}; // CidxDef
|
||||
|
||||
class WXDLLEXPORT wxTable
|
||||
{
|
||||
private:
|
||||
|
||||
ULONG tableID; // Used for debugging. This can help to match up mismatched constructors/destructors
|
||||
|
||||
// Private member variables
|
||||
UDWORD cursorType;
|
||||
|
||||
// Private member functions
|
||||
bool bindInsertParams(void);
|
||||
bool bindUpdateParams(void);
|
||||
bool bindCols(HSTMT cursor);
|
||||
bool getRec(UWORD fetchType);
|
||||
bool execDelete(char *pSqlStmt);
|
||||
bool execUpdate(char *pSqlStmt);
|
||||
bool query(int queryType, bool forUpdate, bool distinct, char *pSqlStmt = 0);
|
||||
|
||||
public:
|
||||
|
||||
// Pointer to the database object this table belongs to
|
||||
wxDB *pDb;
|
||||
|
||||
// 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
|
||||
CcolDef *colDefs; // Array of CcolDef 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..."
|
||||
|
||||
// Flags
|
||||
bool selectForUpdate;
|
||||
|
||||
// Public member functions
|
||||
wxTable(wxDB *pwxDB, const char *tblName, const int nCols,
|
||||
const char *qryTblName = 0, bool qryOnly = !QUERY_ONLY, char *tblPath=NULL);
|
||||
virtual ~wxTable();
|
||||
bool Open(void);
|
||||
bool CreateTable(bool attemptDrop=TRUE);
|
||||
bool DropTable(void);
|
||||
bool CreateIndex(char * idxName, bool unique, int noIdxCols, CidxDef *pIdxDefs, bool attemptDrop=TRUE);
|
||||
bool DropIndex(char * idxName);
|
||||
bool CloseCursor(HSTMT cursor);
|
||||
int Insert(void);
|
||||
bool Update(void);
|
||||
bool Update(char *pSqlStmt);
|
||||
bool UpdateWhere(char *pWhereClause);
|
||||
bool Delete(void);
|
||||
bool DeleteWhere(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)); }
|
||||
#ifndef FWD_ONLY_CURSORS
|
||||
bool GetPrev(void) { return(getRec(SQL_FETCH_PRIOR)); }
|
||||
bool operator--(int) { return(getRec(SQL_FETCH_PRIOR)); }
|
||||
bool GetFirst(void) { return(getRec(SQL_FETCH_FIRST)); }
|
||||
bool GetLast(void) { return(getRec(SQL_FETCH_LAST)); }
|
||||
#endif
|
||||
bool IsCursorClosedOnCommit(void);
|
||||
bool IsColNull(int colNo);
|
||||
UWORD GetRowNum(void);
|
||||
void GetSelectStmt(char *pSqlStmt, int typeOfSelect, bool distinct);
|
||||
void GetDeleteStmt(char *pSqlStmt, int typeOfDel, char *pWhereClause = 0);
|
||||
void GetUpdateStmt(char *pSqlStmt, int typeOfUpd, char *pWhereClause = 0);
|
||||
void GetWhereClause(char *pWhereClause, int typeOfWhere, char *qualTableName = 0);
|
||||
bool CanSelectForUpdate(void);
|
||||
bool CanUpdByROWID(void);
|
||||
void ClearMemberVars(void);
|
||||
bool SetQueryTimeout(UDWORD nSeconds);
|
||||
void SetColDefs (int index, char *fieldName, int dataType, void *pData, int cType,
|
||||
int size, bool keyField = FALSE, bool upd = TRUE,
|
||||
bool insAllow = TRUE, bool derivedCol = FALSE);
|
||||
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(void);
|
||||
int DB_STATUS(void) { return(pDb->DB_STATUS); }
|
||||
bool Refresh(void);
|
||||
bool SetNull(int colNo);
|
||||
bool SetNull(char *colName);
|
||||
|
||||
#if __WXDEBUG__ > 0
|
||||
ULONG GetTableID() { return tableID; };
|
||||
#endif
|
||||
|
||||
}; // wxTable
|
||||
|
||||
#endif
|
558
include/wx/dc.h
Normal file
558
include/wx/dc.h
Normal file
@@ -0,0 +1,558 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dc.h
|
||||
// Purpose: wxDC class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 05/25/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DC_H_BASE_
|
||||
#define _WX_DC_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dcbase.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers which we must include here
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/object.h" // the base class
|
||||
|
||||
#include "wx/cursor.h" // we have member variables of these classes
|
||||
#include "wx/font.h" // so we can't do without them
|
||||
#include "wx/colour.h"
|
||||
#include "wx/brush.h"
|
||||
#include "wx/pen.h"
|
||||
#include "wx/palette.h"
|
||||
|
||||
#include "wx/list.h" // we use wxList in inline functions
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// types
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// type which should be used (whenever possible, i.e. as long as it doesn't
|
||||
// break compatibility) for screen coordinates
|
||||
typedef int wxCoord;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// global variables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern int) wxPageNumber;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxDC is the device context - object on which any drawing is done
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDCBase : public wxObject
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxDCBase)
|
||||
|
||||
public:
|
||||
wxDCBase()
|
||||
{
|
||||
m_clipping = FALSE;
|
||||
m_ok = TRUE;
|
||||
|
||||
m_minX = m_minY = m_maxX = m_maxY = 0;
|
||||
|
||||
m_signX = m_signY = 1;
|
||||
|
||||
m_logicalOriginX = m_logicalOriginY =
|
||||
m_deviceOriginX = m_deviceOriginY = 0;
|
||||
|
||||
m_logicalScaleX = m_logicalScaleY =
|
||||
m_userScaleX = m_userScaleY =
|
||||
m_scaleX = m_scaleY = 1.0;
|
||||
|
||||
m_logicalFunction = -1;
|
||||
|
||||
m_backgroundMode = wxTRANSPARENT;
|
||||
|
||||
m_mappingMode = wxMM_TEXT;
|
||||
|
||||
m_backgroundBrush = *wxTRANSPARENT_BRUSH;
|
||||
|
||||
m_textForegroundColour = *wxBLACK;
|
||||
m_textBackgroundColour = *wxWHITE;
|
||||
|
||||
m_colour = wxColourDisplay();
|
||||
}
|
||||
|
||||
~wxDCBase() { }
|
||||
|
||||
virtual void BeginDrawing() { }
|
||||
virtual void EndDrawing() { }
|
||||
|
||||
// graphic primitives
|
||||
// ------------------
|
||||
|
||||
void FloodFill(long x, long y, const wxColour& col,
|
||||
int style = wxFLOOD_SURFACE)
|
||||
{ DoFloodFill(x, y, col, style); }
|
||||
void FloodFill(const wxPoint& pt, const wxColour& col,
|
||||
int style = wxFLOOD_SURFACE)
|
||||
{ DoFloodFill(pt.x, pt.y, col, style); }
|
||||
|
||||
bool GetPixel(long x, long y, wxColour *col) const
|
||||
{ return DoGetPixel(x, y, col); }
|
||||
bool GetPixel(const wxPoint& pt, wxColour *col) const
|
||||
{ return DoGetPixel(pt.x, pt.y, col); }
|
||||
|
||||
void DrawLine(long x1, long y1, long x2, long y2)
|
||||
{ DoDrawLine(x1, y1, x2, y2); }
|
||||
void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
|
||||
{ DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); }
|
||||
|
||||
void CrossHair(long x, long y)
|
||||
{ DoCrossHair(x, y); }
|
||||
void CrossHair(const wxPoint& pt)
|
||||
{ DoCrossHair(pt.x, pt.y); }
|
||||
|
||||
void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc)
|
||||
{ DoDrawArc(x1, y1, x2, y2, xc, yc); }
|
||||
void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
|
||||
{ DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); }
|
||||
|
||||
void DrawEllipticArc(long x, long y, long w, long h, double sa, double ea)
|
||||
{ DoDrawEllipticArc(x, y, w, h, sa, ea); }
|
||||
void DrawEllipticArc(const wxPoint& pt, const wxSize& sz,
|
||||
double sa, double ea)
|
||||
{ DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); }
|
||||
|
||||
void DrawPoint(long x, long y)
|
||||
{ DoDrawPoint(x, y); }
|
||||
void DrawPoint(const wxPoint& pt)
|
||||
{ DoDrawPoint(pt.x, pt.y); }
|
||||
|
||||
void DrawLines(int n, wxPoint points[], long xoffset = 0, long yoffset = 0)
|
||||
{ DoDrawLines(n, points, xoffset, yoffset); }
|
||||
void DrawLines(const wxList *list, long xoffset = 0, long yoffset = 0);
|
||||
|
||||
void DrawPolygon(int n, wxPoint points[],
|
||||
long xoffset = 0, long yoffset = 0,
|
||||
int fillStyle = wxODDEVEN_RULE)
|
||||
{ DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
|
||||
|
||||
void DrawPolygon(const wxList *list,
|
||||
long xoffset = 0, long yoffset = 0,
|
||||
int fillStyle = wxODDEVEN_RULE);
|
||||
|
||||
void DrawRectangle(long x, long y, long width, long height)
|
||||
{ DoDrawRectangle(x, y, width, height); }
|
||||
void DrawRectangle(const wxPoint& pt, const wxSize& sz)
|
||||
{ DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); }
|
||||
void DrawRectangle(const wxRect& rect)
|
||||
{ DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); }
|
||||
|
||||
void DrawRoundedRectangle(long x, long y, long width, long height,
|
||||
double radius)
|
||||
{ DoDrawRoundedRectangle(x, y, width, height, radius); }
|
||||
void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz,
|
||||
double radius)
|
||||
{ DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); }
|
||||
void DrawRoundedRectangle(const wxRect& r, double radius)
|
||||
{ DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); }
|
||||
|
||||
void DrawCircle(long x, long y, long radius)
|
||||
{ DoDrawEllipse(x - radius, y - radius, 2*radius, 2*radius); }
|
||||
void DrawEllipse(long x, long y, long width, long height)
|
||||
{ DoDrawEllipse(x, y, width, height); }
|
||||
void DrawEllipse(const wxPoint& pt, const wxSize& sz)
|
||||
{ DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); }
|
||||
void DrawEllipse(const wxRect& rect)
|
||||
{ DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); }
|
||||
|
||||
void DrawIcon(const wxIcon& icon, long x, long y)
|
||||
{ DoDrawIcon(icon, x, y); }
|
||||
void DrawIcon(const wxIcon& icon, const wxPoint& pt)
|
||||
{ DoDrawIcon(icon, pt.x, pt.y); }
|
||||
|
||||
void DrawBitmap(const wxBitmap &bmp, long x, long y, bool useMask = FALSE)
|
||||
{ DoDrawBitmap(bmp, x, y, useMask); }
|
||||
void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt,
|
||||
bool useMask = FALSE)
|
||||
{ DoDrawBitmap(bmp, pt.x, pt.y, useMask); }
|
||||
|
||||
void DrawText(const wxString& text, long x, long y)
|
||||
{ DoDrawText(text, x, y); }
|
||||
void DrawText(const wxString& text, const wxPoint& pt)
|
||||
{ DoDrawText(text, pt.x, pt.y); }
|
||||
|
||||
bool Blit(long xdest, long ydest, long width, long height,
|
||||
wxDC *source, long xsrc, long ysrc,
|
||||
int rop = wxCOPY, bool useMask = FALSE)
|
||||
{
|
||||
return DoBlit(xdest, ydest, width, height,
|
||||
source, xsrc, ysrc, rop, useMask);
|
||||
}
|
||||
bool Blit(const wxPoint& destPt, const wxSize& sz,
|
||||
wxDC *source, const wxPoint& srcPt,
|
||||
int rop = wxCOPY, bool useMask = FALSE)
|
||||
{
|
||||
return DoBlit(destPt.x, destPt.y, sz.x, sz.y,
|
||||
source, srcPt.x, srcPt.y, rop, useMask);
|
||||
}
|
||||
|
||||
#if wxUSE_SPLINES
|
||||
// TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
|
||||
void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3);
|
||||
void DrawSpline(int n, wxPoint points[]);
|
||||
|
||||
void DrawSpline(wxList *points) { DoDrawSpline(points); }
|
||||
#endif // wxUSE_SPLINES
|
||||
|
||||
// global DC operations
|
||||
// --------------------
|
||||
|
||||
virtual void Clear() = 0;
|
||||
|
||||
virtual bool StartDoc(const wxString& WXUNUSED(message)) { return TRUE; }
|
||||
virtual void EndDoc() { }
|
||||
|
||||
virtual void StartPage() { }
|
||||
virtual void EndPage() { }
|
||||
|
||||
// set objects to use for drawing
|
||||
// ------------------------------
|
||||
|
||||
virtual void SetFont(const wxFont& font) = 0;
|
||||
virtual void SetPen(const wxPen& pen) = 0;
|
||||
virtual void SetBrush(const wxBrush& brush) = 0;
|
||||
virtual void SetBackground(const wxBrush& brush) = 0;
|
||||
virtual void SetBackgroundMode(int mode) = 0;
|
||||
virtual void SetPalette(const wxPalette& palette) = 0;
|
||||
|
||||
// clipping region
|
||||
// ---------------
|
||||
|
||||
void SetClippingRegion(long x, long y, long width, long height)
|
||||
{ DoSetClippingRegion(x, y, width, height); }
|
||||
void SetClippingRegion(const wxPoint& pt, const wxSize& sz)
|
||||
{ DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); }
|
||||
void SetClippingRegion(const wxRect& rect)
|
||||
{ DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); }
|
||||
void SetClippingRegion(const wxRegion& region)
|
||||
{ DoSetClippingRegionAsRegion(region); }
|
||||
|
||||
virtual void DestroyClippingRegion() = 0;
|
||||
|
||||
void GetClippingBox(long *x, long *y, long *w, long *h) const
|
||||
{ DoGetClippingBox(x, y, w, h); }
|
||||
void GetClippingBox(wxRect& rect) const
|
||||
{ DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height); }
|
||||
|
||||
// text extent
|
||||
// -----------
|
||||
|
||||
virtual long GetCharHeight() const = 0;
|
||||
virtual long GetCharWidth() const = 0;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
long *x, long *y,
|
||||
long *descent = NULL,
|
||||
long *externalLeading = NULL,
|
||||
wxFont *theFont = NULL) const = 0;
|
||||
|
||||
// size and resolution
|
||||
// -------------------
|
||||
|
||||
// in device units
|
||||
void GetSize(int *width, int *height) const
|
||||
{ DoGetSize(width, height); }
|
||||
wxSize GetSize() const
|
||||
{
|
||||
int w, h;
|
||||
DoGetSize(&w, &h);
|
||||
|
||||
return wxSize(w, h);
|
||||
}
|
||||
|
||||
// in mm
|
||||
void GetSizeMM(int* width, int* height) const
|
||||
{ DoGetSizeMM(width, height); }
|
||||
wxSize GetSizeMM() const
|
||||
{
|
||||
int w, h;
|
||||
DoGetSizeMM(&w, &h);
|
||||
|
||||
return wxSize(w, h);
|
||||
}
|
||||
|
||||
// coordinates conversions
|
||||
// -----------------------
|
||||
|
||||
// This group of functions does actual conversion of the input, as you'd
|
||||
// expect.
|
||||
long DeviceToLogicalX(long x) const;
|
||||
long DeviceToLogicalY(long y) const;
|
||||
long DeviceToLogicalXRel(long x) const;
|
||||
long DeviceToLogicalYRel(long y) const;
|
||||
long LogicalToDeviceX(long x) const;
|
||||
long LogicalToDeviceY(long y) const;
|
||||
long LogicalToDeviceXRel(long x) const;
|
||||
long LogicalToDeviceYRel(long y) const;
|
||||
|
||||
// query DC capabilities
|
||||
// ---------------------
|
||||
|
||||
virtual bool CanDrawBitmap() const = 0;
|
||||
virtual bool CanGetTextExtent() const = 0;
|
||||
|
||||
// colour depth
|
||||
virtual int GetDepth() const = 0;
|
||||
|
||||
// Resolution in Pixels per inch
|
||||
virtual wxSize GetPPI() const = 0;
|
||||
|
||||
virtual bool Ok() const { return m_ok; }
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
// const...
|
||||
const wxBrush& GetBackground() const { return m_backgroundBrush; }
|
||||
const wxBrush& GetBrush() const { return m_brush; }
|
||||
const wxFont& GetFont() const { return m_font; }
|
||||
const wxPen& GetPen() const { return m_pen; }
|
||||
const wxColour& GetTextBackground() const { return m_textBackgroundColour; }
|
||||
const wxColour& GetTextForeground() const { return m_textForegroundColour; }
|
||||
|
||||
// ... and non const
|
||||
wxBrush& GetBackground() { return m_backgroundBrush; }
|
||||
wxBrush& GetBrush() { return m_brush; }
|
||||
wxFont& GetFont() { return m_font; }
|
||||
wxPen& GetPen() { return m_pen; }
|
||||
wxColour& GetTextBackground() { return m_textBackgroundColour; }
|
||||
wxColour& GetTextForeground() { return m_textForegroundColour; }
|
||||
|
||||
virtual void SetTextForeground(const wxColour& colour)
|
||||
{ m_textForegroundColour = colour; }
|
||||
virtual void SetTextBackground(const wxColour& colour)
|
||||
{ m_textBackgroundColour = colour; }
|
||||
|
||||
int GetMapMode() const { return m_mappingMode; }
|
||||
virtual void SetMapMode(int mode) = 0;
|
||||
|
||||
virtual void GetUserScale(double *x, double *y) const
|
||||
{
|
||||
if ( x ) *x = m_userScaleX;
|
||||
if ( y ) *y = m_userScaleY;
|
||||
}
|
||||
virtual void SetUserScale(double x, double y) = 0;
|
||||
|
||||
virtual void GetLogicalScale(double *x, double *y)
|
||||
{
|
||||
if ( x ) *x = m_logicalScaleX;
|
||||
if ( y ) *y = m_logicalScaleY;
|
||||
}
|
||||
virtual void SetLogicalScale(double x, double y)
|
||||
{
|
||||
m_logicalScaleX = x;
|
||||
m_logicalScaleY = y;
|
||||
}
|
||||
|
||||
void GetLogicalOrigin(long *x, long *y) const
|
||||
{ DoGetLogicalOrigin(x, y); }
|
||||
wxPoint GetLogicalOrigin() const
|
||||
{ long x, y; DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); }
|
||||
virtual void SetLogicalOrigin(long x, long y) = 0;
|
||||
|
||||
void GetDeviceOrigin(long *x, long *y) const
|
||||
{ DoGetDeviceOrigin(x, y); }
|
||||
wxPoint GetDeviceOrigin() const
|
||||
{ long x, y; DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); }
|
||||
virtual void SetDeviceOrigin(long x, long y) = 0;
|
||||
|
||||
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) = 0;
|
||||
|
||||
int GetLogicalFunction() const { return m_logicalFunction; }
|
||||
virtual void SetLogicalFunction(int function) = 0;
|
||||
|
||||
// Sometimes we need to override optimization, e.g. if other software is
|
||||
// drawing onto our surface and we can't be sure of who's done what.
|
||||
//
|
||||
// FIXME: is this (still) used?
|
||||
virtual void SetOptimization(bool WXUNUSED(opt)) { }
|
||||
virtual bool GetOptimization() { return FALSE; }
|
||||
|
||||
// bounding box
|
||||
// ------------
|
||||
|
||||
virtual void CalcBoundingBox(long x, long 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;
|
||||
}
|
||||
|
||||
// Get the final bounding box of the PostScript or Metafile picture.
|
||||
long MinX() const { return m_minX; }
|
||||
long MaxX() const { return m_maxX; }
|
||||
long MinY() const { return m_minY; }
|
||||
long MaxY() const { return m_maxY; }
|
||||
|
||||
// misc old functions
|
||||
// ------------------
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
virtual void SetColourMap(const wxPalette& palette) { SetPalette(palette); }
|
||||
void GetTextExtent(const wxString& string, float *x, float *y,
|
||||
float *descent = NULL, float *externalLeading = NULL,
|
||||
wxFont *theFont = NULL, bool use16bit = FALSE) const ;
|
||||
void GetSize(float* width, float* height) const { int w, h; GetSize(& w, & h); *width = w; *height = h; }
|
||||
void GetSizeMM(float *width, float *height) const { long w, h; GetSizeMM(& w, & h); *width = (float) w; *height = (float) h; }
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
protected:
|
||||
// the pure virtual functions which should be implemented by wxDC
|
||||
virtual void DoFloodFill(long x, long y, const wxColour& col,
|
||||
int style = wxFLOOD_SURFACE) = 0;
|
||||
|
||||
virtual bool DoGetPixel(long x, long y, wxColour *col) const = 0;
|
||||
|
||||
virtual void DoDrawPoint(long x, long y) = 0;
|
||||
virtual void DoDrawLine(long x1, long y1, long x2, long y2) = 0;
|
||||
|
||||
virtual void DoDrawArc(long x1, long y1,
|
||||
long x2, long y2,
|
||||
long xc, long yc) = 0;
|
||||
virtual void DoDrawEllipticArc(long x, long y, long w, long h,
|
||||
double sa, double ea) = 0;
|
||||
|
||||
virtual void DoDrawRectangle(long x, long y, long width, long height) = 0;
|
||||
virtual void DoDrawRoundedRectangle(long x, long y,
|
||||
long width, long height,
|
||||
double radius) = 0;
|
||||
virtual void DoDrawEllipse(long x, long y, long width, long height) = 0;
|
||||
|
||||
virtual void DoCrossHair(long x, long y) = 0;
|
||||
|
||||
virtual void DoDrawIcon(const wxIcon& icon, long x, long y) = 0;
|
||||
virtual void DoDrawBitmap(const wxBitmap &bmp, long x, long y,
|
||||
bool useMask = FALSE) = 0;
|
||||
|
||||
virtual void DoDrawText(const wxString& text, long x, long y) = 0;
|
||||
|
||||
virtual bool DoBlit(long xdest, long ydest, long width, long height,
|
||||
wxDC *source, long xsrc, long ysrc,
|
||||
int rop = wxCOPY, bool useMask = FALSE) = 0;
|
||||
|
||||
virtual void DoGetSize(int *width, int *height) const = 0;
|
||||
virtual void DoGetSizeMM(int* width, int* height) const = 0;
|
||||
|
||||
virtual void DoDrawLines(int n, wxPoint points[],
|
||||
long xoffset, long yoffset) = 0;
|
||||
virtual void DoDrawPolygon(int n, wxPoint points[],
|
||||
long xoffset, long yoffset,
|
||||
int fillStyle = wxODDEVEN_RULE) = 0;
|
||||
|
||||
virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0;
|
||||
virtual void DoSetClippingRegion(long x, long y,
|
||||
long width, long height) = 0;
|
||||
|
||||
// FIXME are these functions really different?
|
||||
virtual void DoGetClippingRegion(long *x, long *y,
|
||||
long *w, long *h)
|
||||
{ DoGetClippingBox(x, y, w, h); }
|
||||
virtual void DoGetClippingBox(long *x, long *y,
|
||||
long *w, long *h) const
|
||||
{
|
||||
if ( m_clipping )
|
||||
{
|
||||
if ( x ) *x = m_clipX1;
|
||||
if ( y ) *y = m_clipY1;
|
||||
if ( w ) *w = m_clipX2 - m_clipX1;
|
||||
if ( h ) *h = m_clipY2 - m_clipY1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*x = *y = *w = *h = 0;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void DoGetLogicalOrigin(long *x, long *y) const
|
||||
{
|
||||
if ( x ) *x = m_logicalOriginX;
|
||||
if ( y ) *y = m_logicalOriginY;
|
||||
}
|
||||
|
||||
virtual void DoGetDeviceOrigin(long *x, long *y) const
|
||||
{
|
||||
if ( x ) *x = m_deviceOriginX;
|
||||
if ( y ) *y = m_deviceOriginY;
|
||||
}
|
||||
|
||||
#if wxUSE_SPLINES
|
||||
virtual void DoDrawSpline(wxList *points) = 0;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// flags
|
||||
bool m_colour:1;
|
||||
bool m_ok:1;
|
||||
bool m_clipping:1;
|
||||
bool m_isInteractive:1;
|
||||
|
||||
// coordinate system variables
|
||||
|
||||
// TODO short descriptions of what exactly they are would be nice...
|
||||
|
||||
long m_logicalOriginX, m_logicalOriginY;
|
||||
long m_deviceOriginX, m_deviceOriginY;
|
||||
|
||||
double m_logicalScaleX, m_logicalScaleY;
|
||||
double m_userScaleX, m_userScaleY;
|
||||
double m_scaleX, m_scaleY;
|
||||
|
||||
// Used by SetAxisOrientation() to invert the axes
|
||||
int m_signX, m_signY;
|
||||
|
||||
// bounding and clipping boxes
|
||||
long m_minX, m_minY, m_maxX, m_maxY;
|
||||
long m_clipX1, m_clipY1, m_clipX2, m_clipY2;
|
||||
|
||||
int m_logicalFunction;
|
||||
int m_backgroundMode;
|
||||
int m_mappingMode;
|
||||
|
||||
// GDI objects
|
||||
wxPen m_pen;
|
||||
wxBrush m_brush;
|
||||
wxBrush m_backgroundBrush;
|
||||
wxColour m_textForegroundColour;
|
||||
wxColour m_textBackgroundColour;
|
||||
wxFont m_font;
|
||||
wxPalette m_palette;
|
||||
|
||||
private:
|
||||
DECLARE_NO_COPY_CLASS(wxDCBase);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// now include the declaration of wxDC class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dc.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dc.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dc.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dc.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dc.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dc.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dc.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DC_H_BASE_
|
21
include/wx/dcclient.h
Normal file
21
include/wx/dcclient.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_DCCLIENT_H_BASE_
|
||||
#define _WX_DCCLIENT_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dcclient.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dcclient.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dcclient.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dcclient.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dcclient.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dcclient.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dcclient.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DCCLIENT_H_BASE_
|
21
include/wx/dcmemory.h
Normal file
21
include/wx/dcmemory.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_DCMEMORY_H_BASE_
|
||||
#define _WX_DCMEMORY_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dcmemory.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dcmemory.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dcmemory.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dcmemory.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dcmemory.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dcmemory.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dcmemory.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DCMEMORY_H_BASE_
|
12
include/wx/dcprint.h
Normal file
12
include/wx/dcprint.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef _WX_DCPRINT_H_BASE_
|
||||
#define _WX_DCPRINT_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dcprint.h"
|
||||
#endif
|
||||
#if defined(__WXPM__)
|
||||
#include "wx/os2/dcprint.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DCPRINT_H_BASE_
|
7
include/wx/dcps.h
Normal file
7
include/wx/dcps.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef _WX_DCPS_H_BASE_
|
||||
#define _WX_DCPS_H_BASE_
|
||||
|
||||
#include "wx/generic/dcpsg.h"
|
||||
|
||||
#endif
|
||||
|
21
include/wx/dcscreen.h
Normal file
21
include/wx/dcscreen.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_DCSCREEN_H_BASE_
|
||||
#define _WX_DCSCREEN_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dcscreen.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dcscreen.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dcscreen.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dcscreen.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dcscreen.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dcscreen.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dcscreen.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DCSCREEN_H_BASE_
|
21
include/wx/dde.h
Normal file
21
include/wx/dde.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_DDE_H_BASE_
|
||||
#define _WX_DDE_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dde.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dde.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dde.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dde.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dde.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dde.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dde.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DDE_H_BASE_
|
119
include/wx/debug.h
Normal file
119
include/wx/debug.h
Normal file
@@ -0,0 +1,119 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/debug.h
|
||||
// Purpose: Misc debug functions and macros
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 29/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DEBUG_H_
|
||||
#define _WX_DEBUG_H_
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "wx/wxchar.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/**
|
||||
@name Debugging macros
|
||||
|
||||
All debugging macros rely on ASSERT() which in turn calls user-defined
|
||||
OnAssert() function. To keep things simple, it's called even when the
|
||||
expression is TRUE (i.e. everything is ok) and by default does nothing: just
|
||||
returns the same value back. But if you redefine it to do something more sexy
|
||||
(popping up a message box in your favourite GUI, sending you e-mail or
|
||||
whatever) it will affect all ASSERTs, FAILs and CHECKs in your code.
|
||||
<BR>
|
||||
<BR>
|
||||
<b>Warning</b>: if you don't like advices on programming style, don't read
|
||||
further! ;-)
|
||||
<BR>
|
||||
<BR>
|
||||
Extensive use of these macros is recommended! Remember that ASSERTs are
|
||||
disabled in final (without __WXDEBUG__ defined) build, so they add strictly
|
||||
nothing to your program's code. On the other hand, CHECK macros do stay
|
||||
even in release builds, but in general are not much of a burden, while
|
||||
a judicious use of them might increase your program's stability.
|
||||
|
||||
@memo Debugging macros (replacement for standard assert()) and more.
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
//@{
|
||||
|
||||
/** @name Macros which are completely disabled in 'release' mode */
|
||||
//@{
|
||||
#ifdef __WXDEBUG__
|
||||
/**
|
||||
this function may be redefined to do something non trivial and is called
|
||||
whenever one of debugging macros fails (i.e. condition is false in an
|
||||
assertion)
|
||||
@param szFile and nLine - file name and line number of the ASSERT
|
||||
szMsg - optional message explaining the reason
|
||||
*/
|
||||
void WXDLLEXPORT wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg = (const wxChar *) NULL);
|
||||
|
||||
/// 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 ;-)
|
||||
#define wxASSERT(cond)
|
||||
#define wxASSERT_MSG(x, m)
|
||||
#endif //__WXDEBUG__
|
||||
|
||||
/// 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
|
||||
#define wxFAIL_MSG(msg) wxASSERT_MSG(wxFalse, msg)
|
||||
#endif
|
||||
//@}
|
||||
|
||||
// NB: these macros work also in release mode!
|
||||
|
||||
/**
|
||||
These macros must be used only in invalid situation: for example, an
|
||||
invalid parameter (NULL pointer) is passed to a function. Instead of
|
||||
dereferencing it and causing core dump the function might try using
|
||||
CHECK( p != NULL ) or CHECK( p != NULL, return LogError("p is NULL!!") )
|
||||
|
||||
@name Macros which remain even in 'release' mode
|
||||
*/
|
||||
//@{
|
||||
/// check that expression is true, "return" if not (also FAILs in debug mode)
|
||||
#define wxCHECK(x, rc) if (!(x)) {wxFAIL; return rc; }
|
||||
/// as wxCHECK but with a message explaining why we fail
|
||||
#define wxCHECK_MSG(x, rc, msg) if (!(x)) {wxFAIL_MSG(msg); return rc; }
|
||||
/// check that expression is true, perform op if not
|
||||
#define wxCHECK2(x, op) if (!(x)) {wxFAIL; op; }
|
||||
/// as wxCHECK2 but with a message explaining why we fail
|
||||
#define wxCHECK2_MSG(x, op, msg) if (!(x)) {wxFAIL_MSG(msg); op; }
|
||||
/// special form of wxCHECK2: as wxCHECK, but for use in void functions
|
||||
// NB: there is only one form (with msg parameter) and it's intentional:
|
||||
// there is no other way to tell the caller what exactly went wrong
|
||||
// from the void function (of course, the function shouldn't be void
|
||||
// to begin with...)
|
||||
#define wxCHECK_RET(x, msg) if (!(x)) {wxFAIL_MSG(msg); return; }
|
||||
//@}
|
||||
|
||||
//@}
|
||||
|
||||
#endif // _WX_DEBUG_H_
|
1669
include/wx/defs.h
Normal file
1669
include/wx/defs.h
Normal file
File diff suppressed because it is too large
Load Diff
59
include/wx/dialog.h
Normal file
59
include/wx/dialog.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dialog.h
|
||||
// Purpose: wxDialogBase class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 29.06.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DIALOG_H_BASE_
|
||||
#define _WX_DIALOG_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dialogbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
class WXDLLEXPORT wxDialogBase : public wxPanel
|
||||
{
|
||||
public:
|
||||
// the modal dialogs have a return code - usually the id of the last
|
||||
// pressed button
|
||||
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 );
|
||||
|
||||
// places buttons into a horizontal wxBoxSizer
|
||||
wxSizer *CreateButtonSizer( long flags );
|
||||
|
||||
// the return code from modal dialog
|
||||
int m_returnCode;
|
||||
};
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dialog.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dialog.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dialog.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dialog.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dialog.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dialog.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dialog.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DIALOG_H_BASE_
|
189
include/wx/dialup.h
Normal file
189
include/wx/dialup.h
Normal file
@@ -0,0 +1,189 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dialup.h
|
||||
// Purpose: Network related wxWindows classes and functions
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 07.07.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_NET_H
|
||||
#define _WX_NET_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dialup.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_DIALUP_MANAGER
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// misc
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxArrayString;
|
||||
|
||||
extern const wxChar *wxEmptyString;
|
||||
|
||||
#define WXDIALUP_MANAGER_DEFAULT_BEACONHOST wxT("www.yahoo.com")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// A class which groups functions dealing with connecting to the network from a
|
||||
// workstation using dial-up access to the net. There is at most one instance
|
||||
// of this class in the program accessed via GetDialUpManager().
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/* TODO
|
||||
*
|
||||
* 1. more configurability for Unix: i.e. how to initiate the connection, how
|
||||
* to check for online status, &c.
|
||||
* 2. a function to enumerate all connections (ISPs) and show a dialog in
|
||||
* Dial() allowing to choose between them if no ISP given
|
||||
* 3. add an async version of dialing functions which notify the caller about
|
||||
* the progress (or may be even start another thread to monitor it)
|
||||
* 4. the static creation/accessor functions are not MT-safe - but is this
|
||||
* really crucial? I think we may suppose they're always called from the
|
||||
* main thread?
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxDialUpManager
|
||||
{
|
||||
public:
|
||||
// this function should create and return the object of the
|
||||
// platform-specific class derived from wxDialUpManager. It's implemented
|
||||
// in the platform-specific source files.
|
||||
static wxDialUpManager *Create();
|
||||
|
||||
// could the dialup manager be initialized correctly? If this function
|
||||
// returns FALSE, no other functions will work neither, so it's a good idea
|
||||
// to call this function and check its result before calling any other
|
||||
// wxDialUpManager methods
|
||||
virtual bool IsOk() const = 0;
|
||||
|
||||
// virtual dtor for any base class
|
||||
virtual ~wxDialUpManager() { }
|
||||
|
||||
// operations
|
||||
// ----------
|
||||
|
||||
// fills the array with the names of all possible values for the first
|
||||
// parameter to Dial() on this machine and returns their number (may be 0)
|
||||
virtual size_t GetISPNames(wxArrayString& names) const = 0;
|
||||
|
||||
// dial the given ISP, use username and password to authentificate
|
||||
//
|
||||
// if no nameOfISP is given, the function will select the default one
|
||||
//
|
||||
// if no username/password are given, the function will try to do without
|
||||
// them, but will ask the user if really needed
|
||||
//
|
||||
// if async parameter is FALSE, the function waits until the end of dialing
|
||||
// and returns TRUE upon successful completion.
|
||||
// if async is TRUE, the function only initiates the connection and returns
|
||||
// immediately - the result is reported via events (an event is sent
|
||||
// anyhow, but if dialing failed it will be a DISCONNECTED one)
|
||||
virtual bool Dial(const wxString& nameOfISP = wxEmptyString,
|
||||
const wxString& username = wxEmptyString,
|
||||
const wxString& password = wxEmptyString,
|
||||
bool async = TRUE) = 0;
|
||||
|
||||
// returns TRUE if (async) dialing is in progress
|
||||
virtual bool IsDialing() const = 0;
|
||||
|
||||
// cancel dialing the number initiated with Dial(async = TRUE)
|
||||
// NB: this won't result in DISCONNECTED event being sent
|
||||
virtual bool CancelDialing() = 0;
|
||||
|
||||
// hang up the currently active dial up connection
|
||||
virtual bool HangUp() = 0;
|
||||
|
||||
// online status
|
||||
// -------------
|
||||
|
||||
// returns TRUE if the computer has a permanent network connection (i.e. is
|
||||
// on a LAN) and so there is no need to use Dial() function to go online
|
||||
//
|
||||
// NB: this functions tries to guess the result and it is not always
|
||||
// guaranteed to be correct, so it's better to ask user for
|
||||
// confirmation or give him a possibility to override it
|
||||
virtual bool IsAlwaysOnline() const = 0;
|
||||
|
||||
// returns TRUE if the computer is connected to the network: under Windows,
|
||||
// this just means that a RAS connection exists, under Unix we check that
|
||||
// the "well-known host" (as specified by SetWellKnownHost) is reachable
|
||||
virtual bool IsOnline() const = 0;
|
||||
|
||||
// sometimes the built-in logic for determining the online status may fail,
|
||||
// so, in general, the user should be allowed to override it. This function
|
||||
// allows to forcefully set the online status - whatever our internal
|
||||
// algorithm may think about it.
|
||||
virtual void SetOnlineStatus(bool isOnline = TRUE) = 0;
|
||||
|
||||
// set misc wxDialUpManager options
|
||||
// --------------------------------
|
||||
|
||||
// enable automatical checks for the connection status and sending of
|
||||
// wxEVT_DIALUP_CONNECTED/wxEVT_DIALUP_DISCONNECTED events. The interval
|
||||
// parameter is only for Unix where we do the check manually: under
|
||||
// Windows, the notification about the change of connection status is
|
||||
// instantenous.
|
||||
//
|
||||
// Returns FALSE if couldn't set up automatic check for online status.
|
||||
virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds = 60) = 0;
|
||||
|
||||
// disable automatic check for connection status change - notice that the
|
||||
// wxEVT_DIALUP_XXX events won't be sent any more neither.
|
||||
virtual void DisableAutoCheckOnlineStatus() = 0;
|
||||
|
||||
// additional Unix-only configuration
|
||||
// ----------------------------------
|
||||
|
||||
// under Unix, the value of well-known host is used to check whether we're
|
||||
// connected to the internet. It's unused under Windows, but this function
|
||||
// is always safe to call. The default value is www.yahoo.com.
|
||||
virtual void SetWellKnownHost(const wxString& hostname,
|
||||
int portno = 80) = 0;
|
||||
|
||||
// Sets the commands to start up the network and to hang up again. Used by
|
||||
// the Unix implementations only.
|
||||
virtual void
|
||||
SetConnectCommand(const wxString& commandDial = wxT("/usr/bin/pon"),
|
||||
const wxString& commandHangup = wxT("/usr/bin/poff")) = 0;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// DIALUP events processing
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// the event class for the dialup events
|
||||
class WXDLLEXPORT wxDialUpEvent : public wxEvent
|
||||
{
|
||||
public:
|
||||
wxDialUpEvent(bool isConnected, bool isOwnEvent) : wxEvent(isOwnEvent)
|
||||
{
|
||||
SetEventType(isConnected ? wxEVT_DIALUP_CONNECTED
|
||||
: wxEVT_DIALUP_DISCONNECTED);
|
||||
}
|
||||
|
||||
// is this a CONNECTED or DISCONNECTED event?
|
||||
bool IsConnectedEvent() const
|
||||
{ return GetEventType() == wxEVT_DIALUP_CONNECTED; }
|
||||
|
||||
// does this event come from wxDialUpManager::Dial() or from some extrenal
|
||||
// process (i.e. does it result from our own attempt to establish the
|
||||
// connection)?
|
||||
bool IsOwnEvent() const { return m_id != 0; }
|
||||
};
|
||||
|
||||
// the type of dialup event handler function
|
||||
typedef void (wxObject::*wxDialUpEventFunction)(wxDialUpEvent&);
|
||||
|
||||
// macros to catch dialup events
|
||||
#define EVT_DIALUP_CONNECTED(func) { wxEVT_DIALUP_CONNECTED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxDialUpEventFunction) & func, NULL},
|
||||
#define EVT_DIALUP_DISCONNECTED(func) { wxEVT_DIALUP_DISCONNECTED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxDialUpEventFunction) & func, NULL},
|
||||
|
||||
|
||||
#endif // wxUSE_DIALUP_MANAGER
|
||||
|
||||
#endif // _WX_NET_H
|
33
include/wx/dirdlg.h
Normal file
33
include/wx/dirdlg.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef _WX_DIRDLG_H_BASE_
|
||||
#define _WX_DIRDLG_H_BASE_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxDirDialogNameStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxDirDialogDefaultFolderStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#if defined(__WIN16__) || (defined(__GNUWIN32__)&&!defined(wxUSE_NORLANDER_HEADERS)) || defined(__SALFORDC__)
|
||||
#include "wx/generic/dirdlgg.h"
|
||||
#else
|
||||
#include "wx/msw/dirdlg.h"
|
||||
#endif
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/generic/dirdlgg.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/dirdlgg.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dirdlg.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dirdlg.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dirdlg.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dirdlg.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DIRDLG_H_BASE_
|
23
include/wx/dnd.h
Normal file
23
include/wx/dnd.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _WX_DND_H_BASE_
|
||||
#define _WX_DND_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/dataobj.h"
|
||||
#include "wx/msw/ole/dropsrc.h"
|
||||
#include "wx/msw/ole/droptgt.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dnd.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dnd.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dnd.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dnd.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/dnd.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dnd.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DND_H_BASE_
|
90
include/wx/docmdi.h
Normal file
90
include/wx/docmdi.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: docmdi.h
|
||||
// Purpose: Frame classes for MDI document/view applications
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DOCMDI_H_
|
||||
#define _WX_DOCMDI_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "docmdi.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_MDI_ARCHITECTURE && wxUSE_DOC_VIEW_ARCHITECTURE
|
||||
|
||||
#include "wx/docview.h"
|
||||
#include "wx/mdi.h"
|
||||
|
||||
/*
|
||||
* Use this instead of wxMDIParentFrame
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxDocMDIParentFrame: public wxMDIParentFrame
|
||||
{
|
||||
DECLARE_CLASS(wxDocMDIParentFrame)
|
||||
public:
|
||||
wxDocMDIParentFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id,
|
||||
const wxString& title, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
|
||||
|
||||
// Extend event processing to search the document manager's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
wxDocManager *GetDocumentManager(void) const { return m_docManager; }
|
||||
|
||||
void OnExit(wxCommandEvent& event);
|
||||
void OnMRUFile(wxCommandEvent& event);
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
protected:
|
||||
wxDocManager *m_docManager;
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/*
|
||||
* Use this instead of wxMDIChildFrame
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxDocMDIChildFrame: public wxMDIChildFrame
|
||||
{
|
||||
DECLARE_CLASS(wxDocMDIChildFrame)
|
||||
|
||||
public:
|
||||
wxDocMDIChildFrame(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id,
|
||||
const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long type = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
|
||||
~wxDocMDIChildFrame(void);
|
||||
|
||||
// Extend event processing to search the view's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
inline wxDocument *GetDocument(void) const { return m_childDocument; }
|
||||
inline wxView *GetView(void) const { return m_childView; }
|
||||
inline void SetDocument(wxDocument *doc) { m_childDocument = doc; }
|
||||
inline void SetView(wxView *view) { m_childView = view; }
|
||||
protected:
|
||||
wxDocument* m_childDocument;
|
||||
wxView* m_childView;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
// wxUSE_MDI_ARCHITECTURE
|
||||
|
||||
#endif
|
||||
// _WX_DOCMDI_H_
|
599
include/wx/docview.h
Normal file
599
include/wx/docview.h
Normal file
@@ -0,0 +1,599 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: docview.h
|
||||
// Purpose: Doc/View classes
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DOCH__
|
||||
#define _WX_DOCH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "docview.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/cmndata.h"
|
||||
#include "wx/string.h"
|
||||
|
||||
#if wxUSE_PRINTING_ARCHITECTURE
|
||||
#include "wx/print.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxWindow;
|
||||
class WXDLLEXPORT wxDocument;
|
||||
class WXDLLEXPORT wxView;
|
||||
class WXDLLEXPORT wxDocTemplate;
|
||||
class WXDLLEXPORT wxDocManager;
|
||||
class WXDLLEXPORT wxPrintInfo;
|
||||
class WXDLLEXPORT wxCommand;
|
||||
class WXDLLEXPORT wxCommandProcessor;
|
||||
class WXDLLEXPORT wxFileHistory;
|
||||
class WXDLLEXPORT wxConfigBase;
|
||||
|
||||
#if wxUSE_STD_IOSTREAM
|
||||
#include "wx/ioswrap.h"
|
||||
#else
|
||||
#include "wx/stream.h"
|
||||
#endif
|
||||
|
||||
// Document manager flags
|
||||
enum
|
||||
{
|
||||
wxDOC_SDI = 1,
|
||||
wxDOC_MDI,
|
||||
wxDOC_NEW,
|
||||
wxDOC_SILENT,
|
||||
wxDEFAULT_DOCMAN_FLAGS = wxDOC_SDI
|
||||
};
|
||||
|
||||
// Document template flags
|
||||
enum
|
||||
{
|
||||
wxTEMPLATE_VISIBLE = 1,
|
||||
wxTEMPLATE_INVISIBLE,
|
||||
wxDEFAULT_TEMPLATE_FLAGS = wxTEMPLATE_VISIBLE
|
||||
};
|
||||
|
||||
#define wxMAX_FILE_HISTORY 9
|
||||
|
||||
class WXDLLEXPORT wxDocument : public wxEvtHandler
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxDocument)
|
||||
|
||||
public:
|
||||
wxDocument(wxDocument *parent = (wxDocument *) NULL);
|
||||
~wxDocument();
|
||||
|
||||
// accessors
|
||||
void SetFilename(const wxString& filename, bool notifyViews = FALSE);
|
||||
wxString GetFilename() const { return m_documentFile; }
|
||||
|
||||
void SetTitle(const wxString& title) { m_documentTitle = title; };
|
||||
wxString GetTitle() const { return m_documentTitle; }
|
||||
|
||||
void SetDocumentName(const wxString& name) { m_documentTypeName = name; };
|
||||
wxString GetDocumentName() const { return m_documentTypeName; }
|
||||
|
||||
bool GetDocumentSaved() const { return m_savedYet; }
|
||||
void SetDocumentSaved(bool saved = TRUE) { m_savedYet = saved; }
|
||||
|
||||
virtual bool Close();
|
||||
virtual bool Save();
|
||||
virtual bool SaveAs();
|
||||
virtual bool Revert();
|
||||
|
||||
#if wxUSE_STD_IOSTREAM
|
||||
virtual ostream& SaveObject(ostream& stream);
|
||||
virtual istream& LoadObject(istream& stream);
|
||||
#else
|
||||
virtual wxOutputStream& SaveObject(wxOutputStream& stream);
|
||||
virtual wxInputStream& LoadObject(wxInputStream& stream);
|
||||
#endif
|
||||
|
||||
#if wxUSE_SERIAL
|
||||
// need this to keep from hiding the virtual from wxObject
|
||||
virtual void LoadObject(wxObjectInputStream& stream) { wxObject::LoadObject(stream); };
|
||||
#endif
|
||||
|
||||
// Called by wxWindows
|
||||
virtual bool OnSaveDocument(const wxString& filename);
|
||||
virtual bool OnOpenDocument(const wxString& filename);
|
||||
virtual bool OnNewDocument();
|
||||
virtual bool OnCloseDocument();
|
||||
|
||||
// Prompts for saving if about to close a modified document. Returns TRUE
|
||||
// if ok to close the document (may have saved in the meantime, or set
|
||||
// modified to FALSE)
|
||||
virtual bool OnSaveModified();
|
||||
|
||||
// Called by framework if created automatically by the default document
|
||||
// manager: gives document a chance to initialise and (usually) create a
|
||||
// view
|
||||
virtual bool OnCreate(const wxString& path, long flags);
|
||||
|
||||
// By default, creates a base wxCommandProcessor.
|
||||
virtual wxCommandProcessor *OnCreateCommandProcessor();
|
||||
virtual wxCommandProcessor *GetCommandProcessor() const { return m_commandProcessor; }
|
||||
virtual void SetCommandProcessor(wxCommandProcessor *proc) { m_commandProcessor = proc; }
|
||||
|
||||
// Called after a view is added or removed. The default implementation
|
||||
// deletes the document if this is there are no more views.
|
||||
virtual void OnChangedViewList();
|
||||
|
||||
virtual bool DeleteContents();
|
||||
|
||||
virtual bool Draw(wxDC&);
|
||||
virtual bool IsModified() const { return m_documentModified; }
|
||||
virtual void Modify(bool mod) { m_documentModified = mod; }
|
||||
|
||||
virtual bool AddView(wxView *view);
|
||||
virtual bool RemoveView(wxView *view);
|
||||
wxList& GetViews() const { return (wxList&) m_documentViews; }
|
||||
wxView *GetFirstView() const;
|
||||
|
||||
virtual void UpdateAllViews(wxView *sender = (wxView *) NULL, wxObject *hint = (wxObject *) NULL);
|
||||
|
||||
// Remove all views (because we're closing the document)
|
||||
virtual bool DeleteAllViews();
|
||||
|
||||
// Other stuff
|
||||
virtual wxDocManager *GetDocumentManager() const;
|
||||
virtual wxDocTemplate *GetDocumentTemplate() const { return m_documentTemplate; }
|
||||
virtual void SetDocumentTemplate(wxDocTemplate *temp) { m_documentTemplate = temp; }
|
||||
|
||||
// Get title, or filename if no title, else [unnamed]
|
||||
virtual bool GetPrintableName(wxString& buf) const;
|
||||
|
||||
// Returns a window that can be used as a parent for document-related
|
||||
// dialogs. Override if necessary.
|
||||
virtual wxWindow *GetDocumentWindow() const;
|
||||
|
||||
protected:
|
||||
wxList m_documentViews;
|
||||
wxString m_documentFile;
|
||||
wxString m_documentTitle;
|
||||
wxString m_documentTypeName;
|
||||
wxDocTemplate* m_documentTemplate;
|
||||
bool m_documentModified;
|
||||
wxDocument* m_documentParent;
|
||||
wxCommandProcessor* m_commandProcessor;
|
||||
bool m_savedYet;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxView: public wxEvtHandler
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxView)
|
||||
|
||||
public:
|
||||
// wxView(wxDocument *doc = (wxDocument *) NULL);
|
||||
wxView();
|
||||
~wxView();
|
||||
|
||||
wxDocument *GetDocument() const { return m_viewDocument; }
|
||||
void SetDocument(wxDocument *doc);
|
||||
|
||||
wxString GetViewName() const { return m_viewTypeName; }
|
||||
void SetViewName(const wxString& name) { m_viewTypeName = name; };
|
||||
|
||||
wxFrame *GetFrame() const { return m_viewFrame ; }
|
||||
void SetFrame(wxFrame *frame) { m_viewFrame = frame; }
|
||||
|
||||
virtual void OnActivateView(bool activate, wxView *activeView, wxView *deactiveView);
|
||||
virtual void OnDraw(wxDC *dc) = 0;
|
||||
virtual void OnPrint(wxDC *dc, wxObject *info);
|
||||
virtual void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
|
||||
virtual void OnChangeFilename();
|
||||
|
||||
// Called by framework if created automatically by the default document
|
||||
// manager class: gives view a chance to initialise
|
||||
virtual bool OnCreate(wxDocument *WXUNUSED(doc), long WXUNUSED(flags)) { return TRUE; };
|
||||
|
||||
// Checks if the view is the last one for the document; if so, asks user
|
||||
// to confirm save data (if modified). If ok, deletes itself and returns
|
||||
// TRUE.
|
||||
virtual bool Close(bool deleteWindow = TRUE);
|
||||
|
||||
// Override to do cleanup/veto close
|
||||
virtual bool OnClose(bool deleteWindow);
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
// Defeat compiler warning
|
||||
bool OnClose() { return wxEvtHandler::OnClose(); }
|
||||
#endif
|
||||
|
||||
// Extend event processing to search the document's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
// A view's window can call this to notify the view it is (in)active.
|
||||
// The function then notifies the document manager.
|
||||
virtual void Activate(bool activate);
|
||||
|
||||
wxDocManager *GetDocumentManager() const
|
||||
{ return m_viewDocument->GetDocumentManager(); }
|
||||
|
||||
#if wxUSE_PRINTING_ARCHITECTURE
|
||||
virtual wxPrintout *OnCreatePrintout();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
wxDocument* m_viewDocument;
|
||||
wxString m_viewTypeName;
|
||||
wxFrame* m_viewFrame;
|
||||
};
|
||||
|
||||
// Represents user interface (and other) properties of documents and views
|
||||
class WXDLLEXPORT wxDocTemplate: public wxObject
|
||||
{
|
||||
DECLARE_CLASS(wxDocTemplate)
|
||||
|
||||
friend class WXDLLEXPORT wxDocManager;
|
||||
|
||||
public:
|
||||
// Associate document and view types. They're for identifying what view is
|
||||
// associated with what template/document type
|
||||
wxDocTemplate(wxDocManager *manager,
|
||||
const wxString& descr,
|
||||
const wxString& filter,
|
||||
const wxString& dir,
|
||||
const wxString& ext,
|
||||
const wxString& docTypeName,
|
||||
const wxString& viewTypeName,
|
||||
wxClassInfo *docClassInfo = (wxClassInfo *) NULL,
|
||||
wxClassInfo *viewClassInfo = (wxClassInfo *)NULL,
|
||||
long flags = wxDEFAULT_TEMPLATE_FLAGS);
|
||||
|
||||
~wxDocTemplate();
|
||||
|
||||
// By default, these two member functions dynamically creates document and
|
||||
// view using dynamic instance construction. Override these if you need a
|
||||
// different method of construction.
|
||||
virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
|
||||
virtual wxView *CreateView(wxDocument *doc, long flags = 0);
|
||||
|
||||
wxString GetDefaultExtension() const { return m_defaultExt; };
|
||||
wxString GetDescription() const { return m_description; }
|
||||
wxString GetDirectory() const { return m_directory; };
|
||||
wxDocManager *GetDocumentManager() const { return m_documentManager; }
|
||||
void SetDocumentManager(wxDocManager *manager) { m_documentManager = manager; }
|
||||
wxString GetFileFilter() const { return m_fileFilter; };
|
||||
long GetFlags() const { return m_flags; };
|
||||
virtual wxString GetViewName() const { return m_viewTypeName; }
|
||||
virtual wxString GetDocumentName() const { return m_docTypeName; }
|
||||
|
||||
void SetFileFilter(const wxString& filter) { m_fileFilter = filter; };
|
||||
void SetDirectory(const wxString& dir) { m_directory = dir; };
|
||||
void SetDescription(const wxString& descr) { m_description = descr; };
|
||||
void SetDefaultExtension(const wxString& ext) { m_defaultExt = ext; };
|
||||
void SetFlags(long flags) { m_flags = flags; };
|
||||
|
||||
bool IsVisible() const { return ((m_flags & wxTEMPLATE_VISIBLE) == wxTEMPLATE_VISIBLE); }
|
||||
|
||||
virtual bool FileMatchesTemplate(const wxString& path);
|
||||
|
||||
protected:
|
||||
long m_flags;
|
||||
wxString m_fileFilter;
|
||||
wxString m_directory;
|
||||
wxString m_description;
|
||||
wxString m_defaultExt;
|
||||
wxString m_docTypeName;
|
||||
wxString m_viewTypeName;
|
||||
wxDocManager* m_documentManager;
|
||||
|
||||
// For dynamic creation of appropriate instances.
|
||||
wxClassInfo* m_docClassInfo;
|
||||
wxClassInfo* m_viewClassInfo;
|
||||
};
|
||||
|
||||
// One object of this class may be created in an application, to manage all
|
||||
// the templates and documents.
|
||||
class WXDLLEXPORT wxDocManager: public wxEvtHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxDocManager)
|
||||
|
||||
public:
|
||||
wxDocManager(long flags = wxDEFAULT_DOCMAN_FLAGS, bool initialize = TRUE);
|
||||
~wxDocManager();
|
||||
|
||||
virtual bool Initialize();
|
||||
|
||||
// Handlers for common user commands
|
||||
void OnFileClose(wxCommandEvent& event);
|
||||
void OnFileNew(wxCommandEvent& event);
|
||||
void OnFileOpen(wxCommandEvent& event);
|
||||
void OnFileRevert(wxCommandEvent& event);
|
||||
void OnFileSave(wxCommandEvent& event);
|
||||
void OnFileSaveAs(wxCommandEvent& event);
|
||||
void OnPrint(wxCommandEvent& event);
|
||||
void OnPrintSetup(wxCommandEvent& event);
|
||||
void OnPreview(wxCommandEvent& event);
|
||||
void OnUndo(wxCommandEvent& event);
|
||||
void OnRedo(wxCommandEvent& event);
|
||||
|
||||
// Extend event processing to search the view's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
|
||||
virtual wxView *CreateView(wxDocument *doc, long flags = 0);
|
||||
virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0);
|
||||
virtual bool FlushDoc(wxDocument *doc);
|
||||
virtual wxDocTemplate *MatchTemplate(const wxString& path);
|
||||
virtual wxDocTemplate *SelectDocumentPath(wxDocTemplate **templates,
|
||||
int noTemplates, wxString& path, long flags, bool save = FALSE);
|
||||
virtual wxDocTemplate *SelectDocumentType(wxDocTemplate **templates,
|
||||
int noTemplates);
|
||||
virtual wxDocTemplate *SelectViewType(wxDocTemplate **templates,
|
||||
int noTemplates);
|
||||
virtual wxDocTemplate *FindTemplateForPath(const wxString& path);
|
||||
|
||||
void AssociateTemplate(wxDocTemplate *temp);
|
||||
void DisassociateTemplate(wxDocTemplate *temp);
|
||||
|
||||
wxDocument *GetCurrentDocument() const;
|
||||
|
||||
void SetMaxDocsOpen(int n) { m_maxDocsOpen = n; }
|
||||
int GetMaxDocsOpen() const { return m_maxDocsOpen; }
|
||||
|
||||
// Add and remove a document from the manager's list
|
||||
void AddDocument(wxDocument *doc);
|
||||
void RemoveDocument(wxDocument *doc);
|
||||
|
||||
// Clear remaining documents and templates
|
||||
bool Clear(bool force = TRUE);
|
||||
|
||||
// Views or windows should inform the document manager
|
||||
// when a view is going in or out of focus
|
||||
virtual void ActivateView(wxView *view, bool activate = TRUE, bool deleting = FALSE);
|
||||
virtual wxView *GetCurrentView() const;
|
||||
|
||||
virtual wxList& GetDocuments() const { return (wxList&) m_docs; }
|
||||
|
||||
// Make a default document name
|
||||
virtual bool MakeDefaultName(wxString& buf);
|
||||
|
||||
virtual wxFileHistory *OnCreateFileHistory();
|
||||
virtual wxFileHistory *GetFileHistory() const { return m_fileHistory; }
|
||||
|
||||
// File history management
|
||||
virtual void AddFileToHistory(const wxString& file);
|
||||
virtual void RemoveFileFromHistory(int i);
|
||||
virtual int GetNoHistoryFiles() const;
|
||||
virtual wxString GetHistoryFile(int i) const;
|
||||
virtual void FileHistoryUseMenu(wxMenu *menu);
|
||||
virtual void FileHistoryRemoveMenu(wxMenu *menu);
|
||||
#if wxUSE_CONFIG
|
||||
virtual void FileHistoryLoad(wxConfigBase& config);
|
||||
virtual void FileHistorySave(wxConfigBase& config);
|
||||
#endif // wxUSE_CONFIG
|
||||
|
||||
virtual void FileHistoryAddFilesToMenu();
|
||||
virtual void FileHistoryAddFilesToMenu(wxMenu* menu);
|
||||
|
||||
protected:
|
||||
long m_flags;
|
||||
int m_defaultDocumentNameCounter;
|
||||
int m_maxDocsOpen;
|
||||
wxList m_docs;
|
||||
wxList m_templates;
|
||||
wxView* m_currentView;
|
||||
wxFileHistory* m_fileHistory;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// A default child frame
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDocChildFrame : public wxFrame
|
||||
{
|
||||
DECLARE_CLASS(wxDocChildFrame)
|
||||
|
||||
public:
|
||||
wxDocChildFrame(wxDocument *doc,
|
||||
wxView *view,
|
||||
wxFrame *frame,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long type = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = "frame");
|
||||
~wxDocChildFrame();
|
||||
|
||||
// Extend event processing to search the view's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
wxDocument *GetDocument() const { return m_childDocument; }
|
||||
wxView *GetView() const { return m_childView; }
|
||||
void SetDocument(wxDocument *doc) { m_childDocument = doc; }
|
||||
void SetView(wxView *view) { m_childView = view; }
|
||||
|
||||
protected:
|
||||
wxDocument* m_childDocument;
|
||||
wxView* m_childView;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// A default parent frame
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDocParentFrame : public wxFrame
|
||||
{
|
||||
DECLARE_CLASS(wxDocParentFrame)
|
||||
|
||||
public:
|
||||
wxDocParentFrame(wxDocManager *manager,
|
||||
wxFrame *frame,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long type = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = "frame");
|
||||
|
||||
// Extend event processing to search the document manager's event table
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
|
||||
wxDocManager *GetDocumentManager() const { return m_docManager; }
|
||||
|
||||
void OnExit(wxCommandEvent& event);
|
||||
void OnMRUFile(wxCommandEvent& event);
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
protected:
|
||||
wxDocManager *m_docManager;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Provide simple default printing facilities
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_PRINTING_ARCHITECTURE
|
||||
class WXDLLEXPORT wxDocPrintout : public wxPrintout
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxDocPrintout)
|
||||
|
||||
public:
|
||||
wxDocPrintout(wxView *view = (wxView *) NULL, const wxString& title = "Printout");
|
||||
bool OnPrintPage(int page);
|
||||
bool HasPage(int page);
|
||||
bool OnBeginDocument(int startPage, int endPage);
|
||||
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo);
|
||||
|
||||
virtual wxView *GetView() { return m_printoutView; }
|
||||
|
||||
protected:
|
||||
wxView* m_printoutView;
|
||||
};
|
||||
#endif // wxUSE_PRINTING_ARCHITECTURE
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Command processing framework
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxCommand : public wxObject
|
||||
{
|
||||
DECLARE_CLASS(wxCommand)
|
||||
|
||||
public:
|
||||
wxCommand(bool canUndoIt = FALSE, const wxString& name = "");
|
||||
~wxCommand();
|
||||
|
||||
// Override this to perform a command
|
||||
virtual bool Do() = 0;
|
||||
|
||||
// Override this to undo a command
|
||||
virtual bool Undo() = 0;
|
||||
|
||||
virtual bool CanUndo() const { return m_canUndo; }
|
||||
virtual wxString GetName() const { return m_commandName; }
|
||||
|
||||
protected:
|
||||
bool m_canUndo;
|
||||
wxString m_commandName;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxCommandProcessor : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxCommandProcessor)
|
||||
|
||||
public:
|
||||
wxCommandProcessor(int maxCommands = 100);
|
||||
~wxCommandProcessor();
|
||||
|
||||
// Pass a command to the processor. The processor calls Do(); if
|
||||
// successful, is appended to the command history unless storeIt is FALSE.
|
||||
virtual bool Submit(wxCommand *command, bool storeIt = TRUE);
|
||||
virtual bool Undo();
|
||||
virtual bool Redo();
|
||||
virtual bool CanUndo() const;
|
||||
virtual bool CanRedo() const;
|
||||
|
||||
// Call this to manage an edit menu.
|
||||
void SetEditMenu(wxMenu *menu) { m_commandEditMenu = menu; }
|
||||
wxMenu *GetEditMenu() const { return m_commandEditMenu; }
|
||||
virtual void SetMenuStrings();
|
||||
virtual void Initialize();
|
||||
|
||||
wxList& GetCommands() const { return (wxList&) m_commands; }
|
||||
int GetMaxCommands() const { return m_maxNoCommands; }
|
||||
virtual void ClearCommands();
|
||||
|
||||
protected:
|
||||
int m_maxNoCommands;
|
||||
wxList m_commands;
|
||||
wxNode* m_currentCommand;
|
||||
wxMenu* m_commandEditMenu;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// File history management
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFileHistory : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFileHistory)
|
||||
|
||||
public:
|
||||
wxFileHistory(int maxFiles = 9);
|
||||
~wxFileHistory();
|
||||
|
||||
// Operations
|
||||
virtual void AddFileToHistory(const wxString& file);
|
||||
virtual void RemoveFileFromHistory(int i);
|
||||
virtual int GetMaxFiles() const { return m_fileMaxFiles; }
|
||||
virtual void UseMenu(wxMenu *menu);
|
||||
|
||||
// Remove menu from the list (MDI child may be closing)
|
||||
virtual void RemoveMenu(wxMenu *menu);
|
||||
|
||||
#if wxUSE_CONFIG
|
||||
virtual void Load(wxConfigBase& config);
|
||||
virtual void Save(wxConfigBase& config);
|
||||
#endif // wxUSE_CONFIG
|
||||
|
||||
virtual void AddFilesToMenu();
|
||||
virtual void AddFilesToMenu(wxMenu* menu); // Single menu
|
||||
|
||||
// Accessors
|
||||
virtual wxString GetHistoryFile(int i) const;
|
||||
|
||||
// A synonym for GetNoHistoryFiles
|
||||
virtual int GetCount() const { return m_fileHistoryN; }
|
||||
int GetNoHistoryFiles() const { return m_fileHistoryN; }
|
||||
|
||||
wxList& GetMenus() const { return (wxList&) m_fileMenus; }
|
||||
|
||||
protected:
|
||||
// Last n files
|
||||
wxChar** m_fileHistory;
|
||||
// Number of files saved
|
||||
int m_fileHistoryN;
|
||||
// Menus to maintain (may need several for an MDI app)
|
||||
wxList m_fileMenus;
|
||||
// Max files to maintain
|
||||
int m_fileMaxFiles;
|
||||
};
|
||||
|
||||
#if wxUSE_STD_IOSTREAM
|
||||
// For compatibility with existing file formats:
|
||||
// converts from/to a stream to/from a temporary file.
|
||||
bool WXDLLEXPORT wxTransferFileToStream(const wxString& filename, ostream& stream);
|
||||
bool WXDLLEXPORT wxTransferStreamToFile(istream& stream, const wxString& filename);
|
||||
#endif
|
||||
|
||||
#endif // _WX_DOCH__
|
25
include/wx/dragimag.h
Normal file
25
include/wx/dragimag.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef _WX_DRAGIMAG_H_BASE_
|
||||
#define _WX_DRAGIMAG_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#ifdef __WIN16__
|
||||
#include "wx/generic/dragimag.h"
|
||||
#else
|
||||
#include "wx/msw/dragimag.h"
|
||||
#endif
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/generic/dragimag.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/dragimag.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/generic/dragimag.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/generic/dragimag.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/generic/dragimag.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/generic/dragimag.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DRAGIMAG_H_BASE_
|
466
include/wx/dynarray.h
Normal file
466
include/wx/dynarray.h
Normal file
@@ -0,0 +1,466 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dynarray.h
|
||||
// Purpose: auto-resizable (i.e. dynamic) array support
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 12.09.97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _DYNARRAY_H
|
||||
#define _DYNARRAY_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dynarray.h"
|
||||
#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)
|
||||
*/
|
||||
//@{
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
the initial size by which an array grows when an element is added
|
||||
default value avoids allocate one or two bytes when the array is created
|
||||
which is rather inefficient
|
||||
*/
|
||||
#define WX_ARRAY_DEFAULT_INITIAL_SIZE (16)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// types
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
callback compare function for quick sort
|
||||
must return negative value, 0 or positive value if pItem1 <, = or > pItem2
|
||||
*/
|
||||
typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/**
|
||||
base class managing data having size of type 'long' (not used directly)
|
||||
|
||||
NB: for efficiency this often used class has no virtual functions (hence no
|
||||
VTBL), even dtor is <B>not</B> virtual. If used as expected it won't
|
||||
create any problems because ARRAYs from DEFINE_ARRAY have no dtor at all,
|
||||
so it's not too important if it's not called (this happens when you cast
|
||||
"SomeArray *" as "BaseArray *" and then delete it)
|
||||
|
||||
@memo Base class for template array classes
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
class WXDLLEXPORT wxBaseArray
|
||||
{
|
||||
public:
|
||||
/** @name ctors and dtor */
|
||||
//@{
|
||||
/// default ctor
|
||||
wxBaseArray();
|
||||
/// copy ctor
|
||||
wxBaseArray(const wxBaseArray& array);
|
||||
/// assignment operator
|
||||
wxBaseArray& operator=(const wxBaseArray& src);
|
||||
/// not virtual, see above
|
||||
/// EXCEPT for Gnu compiler to reduce warnings...
|
||||
#ifdef __GNUG__
|
||||
virtual
|
||||
#endif
|
||||
~wxBaseArray();
|
||||
//@}
|
||||
|
||||
/** @name memory management */
|
||||
//@{
|
||||
/// empties the array, but doesn't release memory
|
||||
void Empty() { m_nCount = 0; }
|
||||
/// empties the array and releases memory
|
||||
void Clear();
|
||||
/// preallocates memory for given number of items
|
||||
void Alloc(size_t uiSize);
|
||||
/// minimizes the memory used by the array (frees unused memory)
|
||||
void Shrink();
|
||||
//@}
|
||||
|
||||
/** @name simple accessors */
|
||||
//@{
|
||||
/// number of elements in the array
|
||||
size_t Count() const { return m_nCount; }
|
||||
size_t GetCount() const { return m_nCount; }
|
||||
/// is it empty?
|
||||
bool IsEmpty() const { return m_nCount == 0; }
|
||||
//@}
|
||||
|
||||
protected:
|
||||
// these methods are protected because if they were public one could
|
||||
// mistakenly call one of them instead of DEFINE_ARRAY's or OBJARRAY's
|
||||
// type safe methods
|
||||
|
||||
/** @name items access */
|
||||
//@{
|
||||
/// get item at position uiIndex (range checking is done in debug version)
|
||||
long& Item(size_t uiIndex) const
|
||||
{ wxASSERT( uiIndex < m_nCount ); return m_pItems[uiIndex]; }
|
||||
/// same as Item()
|
||||
long& operator[](size_t uiIndex) const { return Item(uiIndex); }
|
||||
//@}
|
||||
|
||||
/** @name item management */
|
||||
//@{
|
||||
/**
|
||||
Search the element in the array, starting from the either side
|
||||
@param bFromEnd if TRUE, start from the end
|
||||
@return index of the first item matched or wxNOT_FOUND
|
||||
@see wxNOT_FOUND
|
||||
*/
|
||||
int Index(long lItem, bool bFromEnd = FALSE) const;
|
||||
/// search for an item using binary search in a sorted array
|
||||
int Index(long lItem, CMPFUNC fnCompare) const;
|
||||
/// add new element at the end
|
||||
void Add(long lItem);
|
||||
/// add item assuming the array is sorted with fnCompare function
|
||||
void Add(long lItem, CMPFUNC fnCompare);
|
||||
/// add new element at given position (it becomes Item[uiIndex])
|
||||
void Insert(long lItem, size_t uiIndex);
|
||||
/// remove first item matching this value
|
||||
void Remove(long lItem);
|
||||
/// remove item by index
|
||||
void Remove(size_t uiIndex);
|
||||
//@}
|
||||
|
||||
/// sort array elements using given compare function
|
||||
void Sort(CMPFUNC fnCompare);
|
||||
|
||||
private:
|
||||
void Grow(); // makes array bigger if needed
|
||||
|
||||
size_t m_nSize, // current size of the array
|
||||
m_nCount; // current number of elements
|
||||
|
||||
long *m_pItems; // pointer to data
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// template classes
|
||||
// ============================================================================
|
||||
|
||||
// resolves the name conflict between the wxT() macor and T typedef: we can't
|
||||
// use wxT() inside WX_DEFINE_ARRAY!
|
||||
#define _WX_ERROR_SIZEOF wxT("illegal use of DEFINE_ARRAY")
|
||||
#define _WX_ERROR_REMOVE wxT("removing inexisting element in wxArray::Remove")
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// This macro generates a new array class. It is intended for storage of simple
|
||||
// types of sizeof()<=sizeof(long) or pointers if sizeof(pointer)<=sizeof(long)
|
||||
//
|
||||
// NB: it has only inline functions => takes no space at all
|
||||
// Mod by JACS: Salford C++ doesn't like 'var->operator=' syntax, as in:
|
||||
// { ((wxBaseArray *)this)->operator=((const wxBaseArray&)src);
|
||||
// so using a temporary variable instead.
|
||||
// ----------------------------------------------------------------------------
|
||||
#define _WX_DEFINE_ARRAY(T, name, classexp) \
|
||||
typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \
|
||||
classexp name : public wxBaseArray \
|
||||
{ \
|
||||
public: \
|
||||
name() \
|
||||
{ \
|
||||
size_t type = sizeof(T); \
|
||||
size_t sizelong = sizeof(long); \
|
||||
if ( type > sizelong ) \
|
||||
{ wxFAIL_MSG( _WX_ERROR_SIZEOF ); } \
|
||||
} \
|
||||
\
|
||||
name& operator=(const name& src) \
|
||||
{ wxBaseArray* temp = (wxBaseArray*) this; \
|
||||
(*temp) = ((const wxBaseArray&)src); \
|
||||
return *this; } \
|
||||
\
|
||||
T& operator[](size_t uiIndex) const \
|
||||
{ return (T&)(wxBaseArray::Item(uiIndex)); } \
|
||||
T& Item(size_t uiIndex) const \
|
||||
{ return (T&)(wxBaseArray::Item(uiIndex)); } \
|
||||
T& Last() const \
|
||||
{ return (T&)(wxBaseArray::Item(Count() - 1)); } \
|
||||
\
|
||||
int Index(T Item, bool bFromEnd = FALSE) const \
|
||||
{ return wxBaseArray::Index((long)Item, bFromEnd); } \
|
||||
\
|
||||
void Add(T Item) \
|
||||
{ wxBaseArray::Add((long)Item); } \
|
||||
void Insert(T Item, size_t uiIndex) \
|
||||
{ wxBaseArray::Insert((long)Item, uiIndex) ; } \
|
||||
\
|
||||
void Remove(size_t uiIndex) { wxBaseArray::Remove(uiIndex); } \
|
||||
void Remove(T Item) \
|
||||
{ int iIndex = Index(Item); \
|
||||
wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \
|
||||
_WX_ERROR_REMOVE); \
|
||||
wxBaseArray::Remove((size_t)iIndex); } \
|
||||
\
|
||||
void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); } \
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// This is the same as the previous macro, but it defines a sorted array.
|
||||
// Differences:
|
||||
// 1) it must be given a COMPARE function in ctor which takes 2 items of type
|
||||
// T* and should return -1, 0 or +1 if the first one is less/greater
|
||||
// than/equal to the second one.
|
||||
// 2) the Add() method inserts the item in such was that the array is always
|
||||
// sorted (it uses the COMPARE function)
|
||||
// 3) it has no Sort() method because it's always sorted
|
||||
// 4) Index() method is much faster (the sorted arrays use binary search
|
||||
// instead of linear one), but Add() is slower.
|
||||
//
|
||||
// Summary: use this class when the speed of Index() function is important, use
|
||||
// the normal arrays otherwise.
|
||||
//
|
||||
// NB: it has only inline functions => takes no space at all
|
||||
// Mod by JACS: Salford C++ doesn't like 'var->operator=' syntax, as in:
|
||||
// { ((wxBaseArray *)this)->operator=((const wxBaseArray&)src);
|
||||
// so using a temporary variable instead.
|
||||
// ----------------------------------------------------------------------------
|
||||
#define _WX_DEFINE_SORTED_ARRAY(T, name, classexp) \
|
||||
typedef int (CMPFUNC_CONV *SCMPFUNC##T)(T pItem1, T pItem2); \
|
||||
classexp name : public wxBaseArray \
|
||||
{ \
|
||||
public: \
|
||||
name(SCMPFUNC##T fn) \
|
||||
{ size_t type = sizeof(T); \
|
||||
size_t sizelong = sizeof(long); \
|
||||
if ( type > sizelong ) \
|
||||
{ wxFAIL_MSG( _WX_ERROR_SIZEOF ); } \
|
||||
m_fnCompare = fn; \
|
||||
} \
|
||||
\
|
||||
name& operator=(const name& src) \
|
||||
{ wxBaseArray* temp = (wxBaseArray*) this; \
|
||||
(*temp) = ((const wxBaseArray&)src); \
|
||||
m_fnCompare = src.m_fnCompare; \
|
||||
return *this; } \
|
||||
\
|
||||
T& operator[](size_t uiIndex) const \
|
||||
{ return (T&)(wxBaseArray::Item(uiIndex)); } \
|
||||
T& Item(size_t uiIndex) const \
|
||||
{ return (T&)(wxBaseArray::Item(uiIndex)); } \
|
||||
T& Last() const \
|
||||
{ return (T&)(wxBaseArray::Item(Count() - 1)); } \
|
||||
\
|
||||
int Index(T Item) const \
|
||||
{ return wxBaseArray::Index((long)Item, (CMPFUNC)m_fnCompare); }\
|
||||
\
|
||||
void Add(T Item) \
|
||||
{ wxBaseArray::Add((long)Item, (CMPFUNC)m_fnCompare); } \
|
||||
\
|
||||
void Remove(size_t uiIndex) { wxBaseArray::Remove(uiIndex); } \
|
||||
void Remove(T Item) \
|
||||
{ int iIndex = Index(Item); \
|
||||
wxCHECK2_MSG( iIndex != wxNOT_FOUND, return, \
|
||||
_WX_ERROR_REMOVE ); \
|
||||
wxBaseArray::Remove((size_t)iIndex); } \
|
||||
\
|
||||
private: \
|
||||
SCMPFUNC##T m_fnCompare; \
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// see WX_DECLARE_OBJARRAY and WX_DEFINE_OBJARRAY
|
||||
// ----------------------------------------------------------------------------
|
||||
#define _WX_DECLARE_OBJARRAY(T, name, classexp) \
|
||||
typedef int (CMPFUNC_CONV *CMPFUNC##T)(T** pItem1, T** pItem2); \
|
||||
classexp name : public wxBaseArray \
|
||||
{ \
|
||||
public: \
|
||||
name() { } \
|
||||
name(const name& src); \
|
||||
name& operator=(const name& src); \
|
||||
\
|
||||
~name(); \
|
||||
\
|
||||
T& operator[](size_t uiIndex) const \
|
||||
{ return *(T*)wxBaseArray::Item(uiIndex); } \
|
||||
T& Item(size_t uiIndex) const \
|
||||
{ return *(T*)wxBaseArray::Item(uiIndex); } \
|
||||
T& Last() const \
|
||||
{ return *(T*)(wxBaseArray::Item(Count() - 1)); } \
|
||||
\
|
||||
int Index(const T& Item, bool bFromEnd = FALSE) const; \
|
||||
\
|
||||
void Add(const T& Item); \
|
||||
void Add(const T* pItem) \
|
||||
{ wxBaseArray::Add((long)pItem); } \
|
||||
\
|
||||
void Insert(const T& Item, size_t uiIndex); \
|
||||
void Insert(const T* pItem, size_t uiIndex) \
|
||||
{ wxBaseArray::Insert((long)pItem, uiIndex); } \
|
||||
\
|
||||
void Empty(); \
|
||||
\
|
||||
T* Detach(size_t uiIndex) \
|
||||
{ T* p = (T*)wxBaseArray::Item(uiIndex); \
|
||||
wxBaseArray::Remove(uiIndex); return p; } \
|
||||
void Remove(size_t uiIndex); \
|
||||
\
|
||||
void Sort(CMPFUNC##T fCmp) { wxBaseArray::Sort((CMPFUNC)fCmp); } \
|
||||
\
|
||||
private: \
|
||||
void DoCopy(const name& src); \
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** @name Macros for definition of dynamic arrays and objarrays
|
||||
|
||||
These macros are ugly (especially if you look in the sources ;-), but they
|
||||
allow us to define 'template' classes without actually using templates.
|
||||
<BR>
|
||||
<BR>
|
||||
Range checking is performed in debug build for both arrays and objarrays.
|
||||
Type checking is done at compile-time. Warning: arrays <I>never</I> shrink,
|
||||
they only grow, so loading 10 millions in an array only to delete them 2
|
||||
lines below is <I>not</I> recommended. However, it does free memory when
|
||||
it's destroyed, so if you destroy array also, it's ok.
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//@{
|
||||
/**
|
||||
This macro generates a new array class. It is intended for storage of simple
|
||||
types of sizeof()<=sizeof(long) or pointers if sizeof(pointer)<=sizeof(long)
|
||||
<BR>
|
||||
NB: it has only inline functions => takes no space at all
|
||||
<BR>
|
||||
|
||||
@memo declare and define array class 'name' containing elements of type 'T'
|
||||
*/
|
||||
#define WX_DEFINE_ARRAY(T, name) \
|
||||
typedef T _A##name; \
|
||||
_WX_DEFINE_ARRAY(_A##name, name, class)
|
||||
|
||||
/**
|
||||
This macro does the same as WX_DEFINE_ARRAY except that the array will be
|
||||
sorted with the specified compare function.
|
||||
*/
|
||||
#define WX_DEFINE_SORTED_ARRAY(T, name) \
|
||||
typedef T _A##name; \
|
||||
_WX_DEFINE_SORTED_ARRAY(_A##name, name, class)
|
||||
|
||||
/**
|
||||
This macro generates a new objarrays class which owns the objects it
|
||||
contains, i.e. it will delete them when it is destroyed. An element is of
|
||||
type T*, but arguments of type T& are taken (see below!) and T& is
|
||||
returned. <BR>
|
||||
Don't use this for simple types such as "int" or "long"!
|
||||
You _may_ use it for "double" but it's awfully inefficient.
|
||||
<BR>
|
||||
<BR>
|
||||
Note on Add/Insert functions:
|
||||
<BR>
|
||||
1) function(T*) gives the object to the array, i.e. it will delete the
|
||||
object when it's removed or in the array's dtor
|
||||
<BR>
|
||||
2) function(T&) will create a copy of the object and work with it
|
||||
<BR>
|
||||
<BR>
|
||||
Also:
|
||||
<BR>
|
||||
1) Remove() will delete the object after removing it from the array
|
||||
<BR>
|
||||
2) Detach() just removes the object from the array (returning pointer to it)
|
||||
<BR>
|
||||
<BR>
|
||||
NB1: Base type T should have an accessible copy ctor if Add(T&) is used,
|
||||
<BR>
|
||||
NB2: Never ever cast a array to it's base type: as dtor is <B>not</B> virtual
|
||||
it will provoke memory leaks
|
||||
<BR>
|
||||
<BR>
|
||||
some functions of this class are not inline, so it takes some space to
|
||||
define new class from this template.
|
||||
|
||||
@memo declare objarray class 'name' containing elements of type 'T'
|
||||
*/
|
||||
#define WX_DECLARE_OBJARRAY(T, name) \
|
||||
typedef T _L##name; \
|
||||
_WX_DECLARE_OBJARRAY(_L##name, name, class)
|
||||
|
||||
/**
|
||||
To use an objarray class you must
|
||||
<ll>
|
||||
<li>#include "dynarray.h"
|
||||
<li>WX_DECLARE_OBJARRAY(element_type, list_class_name)
|
||||
<li>#include "arrimpl.cpp"
|
||||
<li>WX_DEFINE_OBJARRAY(list_class_name) // same as above!
|
||||
</ll>
|
||||
<BR><BR>
|
||||
This is necessary because at the moment of DEFINE_OBJARRAY class
|
||||
element_type must be fully defined (i.e. forward declaration is not
|
||||
enough), while WX_DECLARE_OBJARRAY may be done anywhere. The separation of
|
||||
two allows to break cicrcular dependencies with classes which have member
|
||||
variables of objarray type.
|
||||
|
||||
@memo define (must include arrimpl.cpp!) objarray class 'name'
|
||||
*/
|
||||
#define WX_DEFINE_OBJARRAY(name) "don't forget to include arrimpl.cpp!"
|
||||
//@}
|
||||
|
||||
// these macros do the same thing as the WX_XXX ones above, but should be used
|
||||
// inside the library for user visible classes because otherwise they wouldn't
|
||||
// be visible from outside (when using wxWindows as DLL under Windows)
|
||||
#define WX_DEFINE_EXPORTED_ARRAY(T, name) \
|
||||
typedef T _A##name; \
|
||||
_WX_DEFINE_ARRAY(_A##name, name, class WXDLLEXPORT)
|
||||
|
||||
#define WX_DEFINE_SORTED_EXPORTED_ARRAY(T, name) \
|
||||
typedef T _A##name; \
|
||||
_WX_DEFINE_SORTED_ARRAY(_A##name, name, class WXDLLEXPORT)
|
||||
|
||||
#define WX_DECLARE_EXPORTED_OBJARRAY(T, name) \
|
||||
typedef T _L##name; \
|
||||
_WX_DECLARE_OBJARRAY(_L##name, name, class WXDLLEXPORT)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** @name Some commonly used predefined arrays */
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//@{
|
||||
/** @name ArrayInt */
|
||||
WX_DEFINE_EXPORTED_ARRAY(int, wxArrayInt);
|
||||
/** @name ArrayLong */
|
||||
WX_DEFINE_EXPORTED_ARRAY(long, wxArrayLong);
|
||||
/** @name ArrayPtrVoid */
|
||||
WX_DEFINE_EXPORTED_ARRAY(void *, wxArrayPtrVoid);
|
||||
//@}
|
||||
|
||||
//@}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// convinience macros
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// delete all array elements
|
||||
//
|
||||
// NB: the class declaration of the array elements must be visible from the
|
||||
// place where you use this macro, otherwise the proper destructor may not
|
||||
// be called (a decent compiler should give a warning about it, but don't
|
||||
// count on it)!
|
||||
#define WX_CLEAR_ARRAY(array) \
|
||||
{ \
|
||||
size_t count = array.Count(); \
|
||||
for ( size_t n = 0; n < count; n++ ) \
|
||||
{ \
|
||||
delete array[n]; \
|
||||
} \
|
||||
\
|
||||
array.Empty(); \
|
||||
}
|
||||
|
||||
#endif // _DYNARRAY_H
|
||||
|
162
include/wx/dynlib.h
Normal file
162
include/wx/dynlib.h
Normal file
@@ -0,0 +1,162 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dynlib.cpp
|
||||
// Purpose: Dynamic library management
|
||||
// Author: Guilhem Lavaux
|
||||
// Modified by:
|
||||
// Created: 20/07/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Guilhem Lavaux
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DYNLIB_H__
|
||||
#define _WX_DYNLIB_H__
|
||||
|
||||
#ifdef __GNUG__
|
||||
# pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
|
||||
#if wxUSE_DYNLIB_CLASS
|
||||
|
||||
#include "wx/string.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/hash.h"
|
||||
|
||||
// this is normally done by configure, but I leave it here for now...
|
||||
#if defined(__UNIX__) && !(defined(HAVE_DLOPEN) || defined(HAVE_SHL_LOAD))
|
||||
# if defined(__LINUX__) || defined(__SOLARIS__) || defined(__SUNOS__) || defined(__FREEBSD__)
|
||||
# define HAVE_DLOPEN
|
||||
# elif defined(__HPUX__)
|
||||
# define HAVE_SHL_LOAD
|
||||
# endif // Unix flavour
|
||||
#endif // !Unix or already have some HAVE_xxx defined
|
||||
|
||||
#if defined(HAVE_DLOPEN)
|
||||
# include <dlfcn.h>
|
||||
typedef void *wxDllType;
|
||||
#elif defined(HAVE_SHL_LOAD)
|
||||
# include <dl.h>
|
||||
typedef shl_t wxDllType;
|
||||
#elif defined(__WINDOWS__)
|
||||
# include <windows.h>
|
||||
typedef HMODULE wxDllType;
|
||||
#elif defined(__OS2__)
|
||||
# define INCL_DOS
|
||||
# include <os2.h>
|
||||
typedef HMODULE wxDllType;
|
||||
#elif defined(__WXMAC__)
|
||||
typedef CFragConnectionID wxDllType;
|
||||
#else
|
||||
# error "wxLibrary can't be compiled on this platform, sorry."
|
||||
#endif // OS
|
||||
|
||||
// LoadLibrary is defined in windows.h as LoadLibraryA, but wxDllLoader method
|
||||
// should be called LoadLibrary, not LoadLibraryA or LoadLibraryW!
|
||||
#if defined(__WIN32__) && defined(LoadLibrary)
|
||||
# include "wx/msw/winundef.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDllLoader
|
||||
// ----------------------------------------------------------------------------
|
||||
/** wxDllLoader is a class providing an interface similar to unix's
|
||||
dlopen(). It is used by the wxLibrary framework and manages the
|
||||
actual loading of DLLs and the resolving of symbols in them.
|
||||
There are no instances of this class, it simply serves as a
|
||||
namespace for its static member functions.
|
||||
*/
|
||||
class wxDllLoader
|
||||
{
|
||||
public:
|
||||
/** This function loads a shared library into memory, with libname
|
||||
being the basename of the library, without the filename
|
||||
extension. No initialisation of the library will be done.
|
||||
@param libname Name of the shared object to load.
|
||||
@param success Must point to a bool variable which will be set to TRUE or FALSE.
|
||||
@return A handle to the loaded DLL. Use success parameter to test if it is valid.
|
||||
*/
|
||||
static wxDllType LoadLibrary(const wxString & libname, bool *success = NULL);
|
||||
/** This function unloads the shared library. */
|
||||
static void UnloadLibrary(wxDllType dll);
|
||||
/** This function returns a valid handle for the main program
|
||||
itself. */
|
||||
static wxDllType GetProgramHandle(void);
|
||||
/** This function resolves a symbol in a loaded DLL, such as a
|
||||
variable or function name.
|
||||
@param dllHandle Handle of the DLL, as returned by LoadDll().
|
||||
@param name Name of the symbol.
|
||||
@return A pointer to the symbol.
|
||||
*/
|
||||
static void * GetSymbol(wxDllType dllHandle, const wxString &name);
|
||||
private:
|
||||
/// forbid construction of objects
|
||||
wxDllLoader();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxLibrary
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxLibrary : public wxObject
|
||||
{
|
||||
public:
|
||||
wxHashTable classTable;
|
||||
|
||||
public:
|
||||
wxLibrary(wxDllType handle);
|
||||
~wxLibrary();
|
||||
|
||||
// Get a symbol from the dynamic library
|
||||
void *GetSymbol(const wxString& symbname);
|
||||
|
||||
// Create the object whose classname is "name"
|
||||
wxObject *CreateObject(const wxString& name);
|
||||
|
||||
protected:
|
||||
void PrepareClasses(wxClassInfo *first);
|
||||
|
||||
wxDllType m_handle;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxLibraries
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxLibraries
|
||||
{
|
||||
public:
|
||||
wxLibraries();
|
||||
~wxLibraries();
|
||||
|
||||
// caller is responsible for deleting the returned pointer if !NULL
|
||||
wxLibrary *LoadLibrary(const wxString& basename);
|
||||
|
||||
wxObject *CreateObject(const wxString& name);
|
||||
|
||||
protected:
|
||||
wxList m_loaded;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Global variables
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
extern wxLibraries wxTheLibraries;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Interesting defines
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define WXDLL_ENTRY_FUNCTION() \
|
||||
extern "C" wxClassInfo *wxGetClassFirst(); \
|
||||
wxClassInfo *wxGetClassFirst() { \
|
||||
return wxClassInfo::GetFirst(); \
|
||||
}
|
||||
|
||||
#endif // wxUSE_DYNLIB_CLASS
|
||||
|
||||
#endif // _WX_DYNLIB_H__
|
1630
include/wx/event.h
Normal file
1630
include/wx/event.h
Normal file
File diff suppressed because it is too large
Load Diff
127
include/wx/expr.h
Normal file
127
include/wx/expr.h
Normal file
@@ -0,0 +1,127 @@
|
||||
/* //////////////////////////////////////////////////////////////////////////
|
||||
// Name: expr.h
|
||||
// Purpose: C helper defines and functions for wxExpr class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
////////////////////////////////////////////////////////////////////////// */
|
||||
|
||||
#ifndef _WX_EXPRH__
|
||||
#define _WX_EXPRH__
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef ____HPUX__
|
||||
#define alloca malloc
|
||||
#endif
|
||||
|
||||
/* Rename all YACC/LEX stuff or we'll conflict with other
|
||||
* applications
|
||||
*/
|
||||
|
||||
#define yyback PROIO_yyback
|
||||
#define yylook PROIO_yylook
|
||||
#define yywrap PROIO_yywrap
|
||||
#define yyoutput PROIO_yyoutput
|
||||
#define yylex PROIO_yylex
|
||||
#define yyerror PROIO_yyerror
|
||||
#define yyleng PROIO_yyleng
|
||||
#define yytext PROIO_yytext
|
||||
#define yymorfg PROIO_yymorfg
|
||||
#define yylineno PROIO_yylineno
|
||||
#define yytchar PROIO_yytchar
|
||||
#define yyin PROIO_yyin
|
||||
#define yyout PROIO_yyout
|
||||
#define yysvf PROIO_yysvf
|
||||
#define yyestate PROIO_yyestate
|
||||
#define yysvec PROIO_yysvec
|
||||
#define yybgin PROIO_yybgin
|
||||
#define yyprevious PROIO_yyprevious
|
||||
#define yylhs PROIO_yylhs
|
||||
#define yylen PROIO_yylen
|
||||
#define yydefred PROIO_yydefred
|
||||
#define yydgoto PROIO_yydgoto
|
||||
#define yysindex PROIO_yysindex
|
||||
#define yyrindex PROIO_yyrindex
|
||||
#define yygindex PROIO_yygindex
|
||||
#define yytable PROIO_yytable
|
||||
#define yycheck PROIO_yycheck
|
||||
#define yyname PROIO_yyname
|
||||
#define yyrule PROIO_yyrule
|
||||
#define yydebug PROIO_yydebug
|
||||
#define yynerrs PROIO_yynerrs
|
||||
#define yyerrflag PROIO_yyerrflag
|
||||
#define yychar PROIO_yychar
|
||||
#define yyvsp PROIO_yyvsp
|
||||
#define yyssp PROIO_yyssp
|
||||
#define yyval PROIO_yyval
|
||||
#define yylval PROIO_yylval
|
||||
#define yyss PROIO_yyss
|
||||
#define yyvs PROIO_yyvs
|
||||
#define yyparse PROIO_yyparse
|
||||
|
||||
/* +++steve162e: more defines necessary */
|
||||
#define yy_init_buffer PROIO_yy_init_buffer
|
||||
#define yy_create_buffer PROIO_yy_create_buffer
|
||||
#define yy_load_buffer_state PROIO_yy_load_buffer_state
|
||||
#define yyrestart PROIO_yyrestart
|
||||
#define yy_switch_to_buffer PROIO_yy_switch_to_buffer
|
||||
#define yy_delete_buffer PROIO_yy_delete_buffer
|
||||
/* ---steve162e */
|
||||
|
||||
/* WG 1/96: still more for flex 2.5 */
|
||||
#define yy_scan_buffer PROIO_scan_buffer
|
||||
#define yy_scan_string PROIO_scan_string
|
||||
#define yy_scan_bytes PROIO_scan_bytes
|
||||
#define yy_flex_debug PROIO_flex_debug
|
||||
#define yy_flush_buffer PROIO_flush_buffer
|
||||
#define yyleng PROIO_yyleng
|
||||
#define yytext PROIO_yytext
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
char *proio_cons(char *, char *);
|
||||
char * wxmake_integer(char *);
|
||||
char * wxmake_word(char *);
|
||||
char * wxmake_string(char *);
|
||||
char * wxmake_real(char *, char *);
|
||||
char * wxmake_exp(char *, char *);
|
||||
char * wxmake_exp2(char *, char *, char*);
|
||||
void add_expr(char *);
|
||||
void process_command(char *);
|
||||
void syntax_error(char *);
|
||||
}
|
||||
#else
|
||||
#if defined(__BORLANDC__) || defined(__VISAGECPP__)
|
||||
char *proio_cons(char *, char *);
|
||||
char * wxmake_integer(char *);
|
||||
char * wxmake_word(char *);
|
||||
char * wxmake_string(char *);
|
||||
char * wxmake_real(char *, char *);
|
||||
char * wxmake_exp(char *, char *);
|
||||
char * wxmake_exp2(char *, char *, char*);
|
||||
void add_expr(char *);
|
||||
void process_command(char *);
|
||||
void syntax_error(char *);
|
||||
int lex_input(void);
|
||||
#else
|
||||
char *proio_cons();
|
||||
char * wxmake_integer();
|
||||
char * wxmake_word();
|
||||
char * wxmake_string();
|
||||
char * wxmake_real();
|
||||
char * wxmake_exp();
|
||||
char * wxmake_exp2();
|
||||
|
||||
void add_expr();
|
||||
void process_command();
|
||||
void syntax_error();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* _WX_EXPRH__ */
|
114
include/wx/ffile.h
Normal file
114
include/wx/ffile.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: ffile.h
|
||||
// Purpose: wxFFile - encapsulates "FILE *" stream
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 14.07.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_FFILE_H_
|
||||
#define _WX_FFILE_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "ffile.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_FILE
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/string.h"
|
||||
#include "wx/filefn.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// class wxFFile: standard C stream library IO
|
||||
//
|
||||
// NB: for space efficiency this class has no virtual functions, including
|
||||
// dtor which is _not_ virtual, so it shouldn't be used as a base class.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFFile
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
// -----
|
||||
// def ctor
|
||||
wxFFile() { m_fp = NULL; }
|
||||
// open specified file (may fail, use IsOpened())
|
||||
wxFFile(const wxChar *filename, const char *mode = "r");
|
||||
// attach to (already opened) file
|
||||
wxFFile(FILE *fp) { m_fp = fp; }
|
||||
|
||||
// open/close
|
||||
// open a file (existing or not - the mode controls what happens)
|
||||
bool Open(const wxChar *filename, const char *mode = "r");
|
||||
// closes the opened file (this is a NOP if not opened)
|
||||
bool Close();
|
||||
|
||||
// assign an existing file descriptor and get it back from wxFFile object
|
||||
void Attach(FILE *fp, const wxString& name = wxT(""))
|
||||
{ Close(); m_fp = fp; m_name = name; }
|
||||
void Detach() { m_fp = NULL; }
|
||||
FILE *fp() const { return m_fp; }
|
||||
|
||||
// read/write (unbuffered)
|
||||
// read all data from the file into a string (useful for text files)
|
||||
bool ReadAll(wxString *str);
|
||||
// returns number of bytes read - use Eof() and Error() to see if an error
|
||||
// occured or not
|
||||
size_t Read(void *pBuf, size_t nCount);
|
||||
// returns the number of bytes written
|
||||
size_t Write(const void *pBuf, size_t nCount);
|
||||
// returns true on success
|
||||
bool Write(const wxString& s)
|
||||
{
|
||||
size_t size = s.Len()*sizeof(wxChar);
|
||||
return Write(s.c_str(), size) == size;
|
||||
}
|
||||
// flush data not yet written
|
||||
bool Flush();
|
||||
|
||||
// file pointer operations (return ofsInvalid on failure)
|
||||
// move ptr ofs bytes related to start/current pos/end of file
|
||||
bool Seek(long ofs, wxSeekMode mode = wxFromStart);
|
||||
// move ptr to ofs bytes before the end
|
||||
bool SeekEnd(long ofs = 0) { return Seek(ofs, wxFromEnd); }
|
||||
// get current position in the file
|
||||
size_t Tell() const;
|
||||
// get current file length
|
||||
size_t Length() const;
|
||||
|
||||
// simple accessors
|
||||
// is file opened?
|
||||
bool IsOpened() const { return m_fp != NULL; }
|
||||
// is end of file reached?
|
||||
bool Eof() const { return feof(m_fp) != 0; }
|
||||
// is an error occured?
|
||||
bool Error() const { return ferror(m_fp) != 0; }
|
||||
// get the file name
|
||||
const wxString& GetName() const { return m_name; }
|
||||
|
||||
// dtor closes the file if opened
|
||||
~wxFFile() { Close(); }
|
||||
|
||||
private:
|
||||
// copy ctor and assignment operator are private because it doesn't make
|
||||
// sense to copy files this way: attempt to do it will provoke a compile-time
|
||||
// error.
|
||||
wxFFile(const wxFFile&);
|
||||
wxFFile& operator=(const wxFFile&);
|
||||
|
||||
FILE *m_fp; // IO stream or NULL if not opened
|
||||
|
||||
wxString m_name; // the name of the file (for diagnostic messages)
|
||||
};
|
||||
|
||||
#endif // wxUSE_FILE
|
||||
|
||||
#endif // _WX_FFILE_H_
|
||||
|
189
include/wx/file.h
Normal file
189
include/wx/file.h
Normal file
@@ -0,0 +1,189 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: file.h
|
||||
// Purpose: wxFile - encapsulates low-level "file descriptor"
|
||||
// wxTempFile - safely replace the old file
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 29/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_FILEH__
|
||||
#define _WX_FILEH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "file.h"
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/string.h"
|
||||
#include "wx/filefn.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_FILE
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// we redefine these constants here because S_IREAD &c are _not_ standard
|
||||
// however, we do assume that the values correspond to the Unix umask bits
|
||||
#define wxS_IRUSR 00400
|
||||
#define wxS_IWUSR 00200
|
||||
#define wxS_IXUSR 00100
|
||||
|
||||
#define wxS_IRGRP 00040
|
||||
#define wxS_IWGRP 00020
|
||||
#define wxS_IXGRP 00010
|
||||
|
||||
#define wxS_IROTH 00004
|
||||
#define wxS_IWOTH 00002
|
||||
#define wxS_IXOTH 00001
|
||||
|
||||
// default mode for the new files: corresponds to umask 022
|
||||
#define wxS_DEFAULT (wxS_IRUSR | wxS_IWUSR | wxS_IRGRP | wxS_IWGRP |\
|
||||
wxS_IROTH | wxS_IWOTH)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// class wxFile: raw file IO
|
||||
//
|
||||
// NB: for space efficiency this class has no virtual functions, including
|
||||
// dtor which is _not_ virtual, so it shouldn't be used as a base class.
|
||||
// ----------------------------------------------------------------------------
|
||||
class WXDLLEXPORT wxFile
|
||||
{
|
||||
public:
|
||||
// more file constants
|
||||
// -------------------
|
||||
// opening mode
|
||||
enum OpenMode { read, write, read_write, write_append };
|
||||
// standard values for file descriptor
|
||||
enum { fd_invalid = -1, fd_stdin, fd_stdout, fd_stderr };
|
||||
|
||||
// static functions
|
||||
// ----------------
|
||||
// check whether a regular file by this name exists
|
||||
static bool Exists(const wxChar *name);
|
||||
// check whetther we can access the given file in given mode
|
||||
// (only read and write make sense here)
|
||||
static bool Access(const wxChar *name, OpenMode mode);
|
||||
|
||||
// ctors
|
||||
// -----
|
||||
// def ctor
|
||||
wxFile() { m_fd = fd_invalid; }
|
||||
// open specified file (may fail, use IsOpened())
|
||||
wxFile(const wxChar *szFileName, OpenMode mode = read);
|
||||
// attach to (already opened) file
|
||||
wxFile(int fd) { m_fd = fd; }
|
||||
|
||||
// open/close
|
||||
// create a new file (with the default value of bOverwrite, it will fail if
|
||||
// the file already exists, otherwise it will overwrite it and succeed)
|
||||
bool Create(const wxChar *szFileName, bool bOverwrite = FALSE,
|
||||
int access = wxS_DEFAULT);
|
||||
bool Open(const wxChar *szFileName, OpenMode mode = read,
|
||||
int access = wxS_DEFAULT);
|
||||
bool Close(); // Close is a NOP if not opened
|
||||
|
||||
// assign an existing file descriptor and get it back from wxFile object
|
||||
void Attach(int fd) { Close(); m_fd = fd; }
|
||||
void Detach() { m_fd = fd_invalid; }
|
||||
int fd() const { return m_fd; }
|
||||
|
||||
// read/write (unbuffered)
|
||||
// returns number of bytes read or ofsInvalid on error
|
||||
off_t Read(void *pBuf, off_t nCount);
|
||||
// returns the number of bytes written
|
||||
size_t Write(const void *pBuf, size_t nCount);
|
||||
// returns true on success
|
||||
bool Write(const wxString& s)
|
||||
{
|
||||
size_t size = s.Len()*sizeof(wxChar);
|
||||
return Write(s.c_str(), size) == size;
|
||||
}
|
||||
// flush data not yet written
|
||||
bool Flush();
|
||||
|
||||
// file pointer operations (return ofsInvalid on failure)
|
||||
// move ptr ofs bytes related to start/current off_t/end of file
|
||||
off_t Seek(off_t ofs, wxSeekMode mode = wxFromStart);
|
||||
// move ptr to ofs bytes before the end
|
||||
off_t SeekEnd(off_t ofs = 0) { return Seek(ofs, wxFromEnd); }
|
||||
// get current off_t
|
||||
off_t Tell() const;
|
||||
// get current file length
|
||||
off_t Length() const;
|
||||
|
||||
// simple accessors
|
||||
// is file opened?
|
||||
bool IsOpened() const { return m_fd != fd_invalid; }
|
||||
// is end of file reached?
|
||||
bool Eof() const;
|
||||
// has an error occured?
|
||||
bool Error() const { return m_error; }
|
||||
|
||||
// dtor closes the file if opened
|
||||
~wxFile() { Close(); }
|
||||
|
||||
private:
|
||||
// copy ctor and assignment operator are private because
|
||||
// it doesn't make sense to copy files this way:
|
||||
// attempt to do it will provoke a compile-time error.
|
||||
wxFile(const wxFile&);
|
||||
wxFile& operator=(const wxFile&);
|
||||
|
||||
int m_fd; // file descriptor or INVALID_FD if not opened
|
||||
bool m_error; // error memory
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// class wxTempFile: if you want to replace another file, create an instance
|
||||
// of wxTempFile passing the name of the file to be replaced to the ctor. Then
|
||||
// you can write to wxTempFile and call Commit() function to replace the old
|
||||
// file (and close this one) or call Discard() to cancel the modification. If
|
||||
// you call neither of them, dtor will call Discard().
|
||||
// ----------------------------------------------------------------------------
|
||||
class WXDLLEXPORT wxTempFile
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
// default
|
||||
wxTempFile() { }
|
||||
// associates the temp file with the file to be replaced and opens it
|
||||
wxTempFile(const wxString& strName);
|
||||
|
||||
// open the temp file (strName is the name of file to be replaced)
|
||||
bool Open(const wxString& strName);
|
||||
|
||||
// is the file opened?
|
||||
bool IsOpened() const { return m_file.IsOpened(); }
|
||||
|
||||
// I/O (both functions return true on success, false on failure)
|
||||
bool Write(const void *p, size_t n) { return m_file.Write(p, n) != 0; }
|
||||
bool Write(const wxString& str) { return m_file.Write(str); }
|
||||
|
||||
// different ways to close the file
|
||||
// validate changes and delete the old file of name m_strName
|
||||
bool Commit();
|
||||
// discard changes
|
||||
void Discard();
|
||||
|
||||
// dtor calls Discard() if file is still opened
|
||||
~wxTempFile();
|
||||
|
||||
private:
|
||||
// no copy ctor/assignment operator
|
||||
wxTempFile(const wxTempFile&);
|
||||
wxTempFile& operator=(const wxTempFile&);
|
||||
|
||||
wxString m_strName, // name of the file to replace in Commit()
|
||||
m_strTemp; // temporary file name
|
||||
wxFile m_file; // the temporary file
|
||||
};
|
||||
|
||||
#endif // wxUSE_FILE
|
||||
|
||||
#endif // _WX_FILEH__
|
351
include/wx/fileconf.h
Normal file
351
include/wx/fileconf.h
Normal file
@@ -0,0 +1,351 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: fileconf.h
|
||||
// Purpose: wxFileConfig derivation of wxConfigBase
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 07.04.98 (adapted from appconf.cpp)
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1997 Karsten Ball<6C>der & Vadim Zeitlin
|
||||
// Ballueder@usa.net <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _FILECONF_H
|
||||
#define _FILECONF_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "fileconf.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_CONFIG
|
||||
|
||||
#include "wx/textfile.h"
|
||||
#include "wx/string.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFileConfig
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
wxFileConfig derives from base Config and implements file based config class,
|
||||
i.e. it uses ASCII disk files to store the information. These files are
|
||||
alternatively called INI, .conf or .rc in the documentation. They are
|
||||
organized in groups or sections, which can nest (i.e. a group contains
|
||||
subgroups, which contain their own subgroups &c). Each group has some
|
||||
number of entries, which are "key = value" pairs. More precisely, the format
|
||||
is:
|
||||
|
||||
# comments are allowed after either ';' or '#' (Win/UNIX standard)
|
||||
|
||||
# blank lines (as above) are ignored
|
||||
|
||||
# global entries are members of special (no name) top group
|
||||
written_for = Windows
|
||||
platform = Linux
|
||||
|
||||
# the start of the group 'Foo'
|
||||
[Foo] # may put comments like this also
|
||||
# following 3 lines are entries
|
||||
key = value
|
||||
another_key = " strings with spaces in the beginning should be quoted, \
|
||||
otherwise the spaces are lost"
|
||||
last_key = but you don't have to put " normally (nor quote them, like here)
|
||||
|
||||
# subgroup of the group 'Foo'
|
||||
# (order is not important, only the name is: separator is '/', as in paths)
|
||||
[Foo/Bar]
|
||||
# entries prefixed with "!" are immutable, i.e. can't be changed if they are
|
||||
# set in the system-wide config file
|
||||
!special_key = value
|
||||
bar_entry = whatever
|
||||
|
||||
[Foo/Bar/Fubar] # depth is (theoretically :-) unlimited
|
||||
# may have the same name as key in another section
|
||||
bar_entry = whatever not
|
||||
|
||||
You have {read/write/delete}Entry functions (guess what they do) and also
|
||||
setCurrentPath to select current group. enum{Subgroups/Entries} allow you
|
||||
to get all entries in the config file (in the current group). Finally,
|
||||
flush() writes immediately all changed entries to disk (otherwise it would
|
||||
be done automatically in dtor)
|
||||
|
||||
wxFileConfig manages not less than 2 config files for each program: global
|
||||
and local (or system and user if you prefer). Entries are read from both of
|
||||
them and the local entries override the global ones unless the latter is
|
||||
immutable (prefixed with '!') in which case a warning message is generated
|
||||
and local value is ignored. Of course, the changes are always written to local
|
||||
file only.
|
||||
|
||||
The names of these files can be specified in a number of ways. First of all,
|
||||
you can use the standard convention: using the ctor which takes 'strAppName'
|
||||
parameter will probably be sufficient for 90% of cases. If, for whatever
|
||||
reason you wish to use the files with some other names, you can always use the
|
||||
second ctor.
|
||||
|
||||
wxFileConfig also may automatically expand the values of environment variables
|
||||
in the entries it reads: for example, if you have an entry
|
||||
score_file = $HOME/.score
|
||||
a call to Read(&str, "score_file") will return a complete path to .score file
|
||||
unless the expansion was previousle disabled with SetExpandEnvVars(FALSE) call
|
||||
(it's on by default, the current status can be retrieved with
|
||||
IsExpandingEnvVars function).
|
||||
*/
|
||||
class wxFileConfig;
|
||||
class ConfigGroup;
|
||||
class ConfigEntry;
|
||||
|
||||
// we store all lines of the local config file as a linked list in memory
|
||||
class LineList
|
||||
{
|
||||
public:
|
||||
void SetNext(LineList *pNext) { m_pNext = pNext; }
|
||||
void SetPrev(LineList *pPrev) { m_pPrev = pPrev; }
|
||||
|
||||
// ctor
|
||||
LineList(const wxString& str, LineList *pNext = (LineList *) NULL) : m_strLine(str)
|
||||
{ SetNext(pNext); SetPrev((LineList *) NULL); }
|
||||
|
||||
//
|
||||
LineList *Next() const { return m_pNext; }
|
||||
LineList *Prev() const { return m_pPrev; }
|
||||
|
||||
//
|
||||
void SetText(const wxString& str) { m_strLine = str; }
|
||||
const wxString& Text() const { return m_strLine; }
|
||||
|
||||
private:
|
||||
wxString m_strLine; // line contents
|
||||
LineList *m_pNext, // next node
|
||||
*m_pPrev; // previous one
|
||||
};
|
||||
|
||||
class wxFileConfig : public wxConfigBase
|
||||
{
|
||||
public:
|
||||
// construct the "standard" full name for global (system-wide) and
|
||||
// local (user-specific) config files from the base file name.
|
||||
//
|
||||
// the following are the filenames returned by this functions:
|
||||
// global local
|
||||
// Unix /etc/file.ext ~/.file
|
||||
// Win %windir%\file.ext %USERPROFILE%\file.ext
|
||||
//
|
||||
// where file is the basename of szFile, ext is it's extension
|
||||
// or .conf (Unix) or .ini (Win) if it has none
|
||||
static wxString GetGlobalFileName(const wxChar *szFile);
|
||||
static wxString GetLocalFileName(const wxChar *szFile);
|
||||
|
||||
// ctor & dtor
|
||||
// New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or
|
||||
// wxCONFIG_USE_GLOBAL_FILE to say which files should be used.
|
||||
wxFileConfig(const wxString& appName,
|
||||
const wxString& vendorName = wxT(""),
|
||||
const wxString& localFilename = wxT(""),
|
||||
const wxString& globalFilename = wxT(""),
|
||||
long style = wxCONFIG_USE_LOCAL_FILE);
|
||||
|
||||
// dtor will save unsaved data
|
||||
virtual ~wxFileConfig();
|
||||
|
||||
// implement inherited pure virtual functions
|
||||
virtual void SetPath(const wxString& strPath);
|
||||
virtual const wxString& GetPath() const { return m_strPath; }
|
||||
|
||||
virtual bool GetFirstGroup(wxString& str, long& lIndex) const;
|
||||
virtual bool GetNextGroup (wxString& str, long& lIndex) const;
|
||||
virtual bool GetFirstEntry(wxString& str, long& lIndex) const;
|
||||
virtual bool GetNextEntry (wxString& str, long& lIndex) const;
|
||||
|
||||
virtual size_t GetNumberOfEntries(bool bRecursive = FALSE) const;
|
||||
virtual size_t GetNumberOfGroups(bool bRecursive = FALSE) const;
|
||||
|
||||
virtual bool HasGroup(const wxString& strName) const;
|
||||
virtual bool HasEntry(const wxString& strName) const;
|
||||
|
||||
virtual bool Read(const wxString& key, wxString *pStr) const;
|
||||
virtual bool Read(const wxString& key, wxString *pStr, const wxString& defValue) const;
|
||||
virtual bool Read(const wxString& key, long *pl) const;
|
||||
|
||||
// The following are necessary to satisfy the compiler
|
||||
wxString Read(const wxString& key, const wxString& defVal) const
|
||||
{ return wxConfigBase::Read(key, defVal); }
|
||||
bool Read(const wxString& key, long *pl, long defVal) const
|
||||
{ return wxConfigBase::Read(key, pl, defVal); }
|
||||
long Read(const wxString& key, long defVal) const
|
||||
{ return wxConfigBase::Read(key, defVal); }
|
||||
bool Read(const wxString& key, int *pi, int defVal) const
|
||||
{ return wxConfigBase::Read(key, pi, defVal); }
|
||||
bool Read(const wxString& key, int *pi) const
|
||||
{ return wxConfigBase::Read(key, pi); }
|
||||
bool Read(const wxString& key, double* val) const
|
||||
{ return wxConfigBase::Read(key, val); }
|
||||
bool Read(const wxString& key, double* val, double defVal) const
|
||||
{ return wxConfigBase::Read(key, val, defVal); }
|
||||
bool Read(const wxString& key, bool* val) const
|
||||
{ return wxConfigBase::Read(key, val); }
|
||||
bool Read(const wxString& key, bool* val, bool defVal) const
|
||||
{ return wxConfigBase::Read(key, val, defVal); }
|
||||
|
||||
virtual bool Write(const wxString& key, const wxString& szValue);
|
||||
virtual bool Write(const wxString& key, long lValue);
|
||||
bool Write(const wxString& key, double value)
|
||||
{ return wxConfigBase::Write(key, value); }
|
||||
bool Write(const wxString& key, bool value)
|
||||
{ return wxConfigBase::Write(key, value); }
|
||||
|
||||
virtual bool Flush(bool bCurrentOnly = FALSE);
|
||||
|
||||
virtual bool RenameEntry(const wxString& oldName, const wxString& newName);
|
||||
virtual bool RenameGroup(const wxString& oldName, const wxString& newName);
|
||||
|
||||
virtual bool DeleteEntry(const wxString& key, bool bGroupIfEmptyAlso);
|
||||
virtual bool DeleteGroup(const wxString& szKey);
|
||||
virtual bool DeleteAll();
|
||||
|
||||
public:
|
||||
// functions to work with this list
|
||||
LineList *LineListAppend(const wxString& str);
|
||||
LineList *LineListInsert(const wxString& str,
|
||||
LineList *pLine); // NULL => Prepend()
|
||||
void LineListRemove(LineList *pLine);
|
||||
bool LineListIsEmpty();
|
||||
|
||||
private:
|
||||
// GetXXXFileName helpers: return ('/' terminated) directory names
|
||||
static wxString GetGlobalDir();
|
||||
static wxString GetLocalDir();
|
||||
|
||||
// common part of all ctors (assumes that m_str{Local|Global}File are already
|
||||
// initialized
|
||||
void Init();
|
||||
|
||||
// common part of from dtor and DeleteAll
|
||||
void CleanUp();
|
||||
|
||||
// parse the whole file
|
||||
void Parse(wxTextFile& file, bool bLocal);
|
||||
|
||||
// the same as SetPath("/")
|
||||
void SetRootPath();
|
||||
|
||||
// member variables
|
||||
// ----------------
|
||||
LineList *m_linesHead, // head of the linked list
|
||||
*m_linesTail; // tail
|
||||
|
||||
wxString m_strLocalFile, // local file name passed to ctor
|
||||
m_strGlobalFile; // global
|
||||
wxString m_strPath; // current path (not '/' terminated)
|
||||
|
||||
ConfigGroup *m_pRootGroup, // the top (unnamed) group
|
||||
*m_pCurrentGroup; // the current group
|
||||
|
||||
public:
|
||||
WX_DEFINE_SORTED_ARRAY(ConfigEntry *, ArrayEntries);
|
||||
WX_DEFINE_SORTED_ARRAY(ConfigGroup *, ArrayGroups);
|
||||
};
|
||||
|
||||
class ConfigEntry
|
||||
{
|
||||
private:
|
||||
ConfigGroup *m_pParent; // group that contains us
|
||||
wxString m_strName, // entry name
|
||||
m_strValue; // value
|
||||
bool m_bDirty, // changed since last read?
|
||||
m_bImmutable; // can be overriden locally?
|
||||
int m_nLine; // used if m_pLine == NULL only
|
||||
LineList *m_pLine; // pointer to our line in the linked list
|
||||
// or NULL if it was found in global file
|
||||
|
||||
public:
|
||||
ConfigEntry(ConfigGroup *pParent, const wxString& strName, int nLine);
|
||||
|
||||
// simple accessors
|
||||
const wxString& Name() const { return m_strName; }
|
||||
const wxString& Value() const { return m_strValue; }
|
||||
ConfigGroup *Group() const { return m_pParent; }
|
||||
bool IsDirty() const { return m_bDirty; }
|
||||
bool IsImmutable() const { return m_bImmutable; }
|
||||
bool IsLocal() const { return m_pLine != 0; }
|
||||
int Line() const { return m_nLine; }
|
||||
LineList *GetLine() const { return m_pLine; }
|
||||
|
||||
// modify entry attributes
|
||||
void SetValue(const wxString& strValue, bool bUser = TRUE);
|
||||
void SetDirty();
|
||||
void SetLine(LineList *pLine);
|
||||
};
|
||||
|
||||
class ConfigGroup
|
||||
{
|
||||
private:
|
||||
wxFileConfig *m_pConfig; // config object we belong to
|
||||
ConfigGroup *m_pParent; // parent group (NULL for root group)
|
||||
wxFileConfig::ArrayEntries m_aEntries; // entries in this group
|
||||
wxFileConfig::ArrayGroups m_aSubgroups; // subgroups
|
||||
wxString m_strName; // group's name
|
||||
bool m_bDirty; // if FALSE => all subgroups are not dirty
|
||||
LineList *m_pLine; // pointer to our line in the linked list
|
||||
ConfigEntry *m_pLastEntry; // last entry/subgroup of this group in the
|
||||
ConfigGroup *m_pLastGroup; // local file (we insert new ones after it)
|
||||
|
||||
// DeleteSubgroupByName helper
|
||||
bool DeleteSubgroup(ConfigGroup *pGroup);
|
||||
|
||||
public:
|
||||
// ctor
|
||||
ConfigGroup(ConfigGroup *pParent, const wxString& strName, wxFileConfig *);
|
||||
|
||||
// dtor deletes all entries and subgroups also
|
||||
~ConfigGroup();
|
||||
|
||||
// simple accessors
|
||||
const wxString& Name() const { return m_strName; }
|
||||
ConfigGroup *Parent() const { return m_pParent; }
|
||||
wxFileConfig *Config() const { return m_pConfig; }
|
||||
bool IsDirty() const { return m_bDirty; }
|
||||
|
||||
const wxFileConfig::ArrayEntries& Entries() const { return m_aEntries; }
|
||||
const wxFileConfig::ArrayGroups& Groups() const { return m_aSubgroups; }
|
||||
bool IsEmpty() const { return Entries().IsEmpty() && Groups().IsEmpty(); }
|
||||
|
||||
// find entry/subgroup (NULL if not found)
|
||||
ConfigGroup *FindSubgroup(const wxChar *szName) const;
|
||||
ConfigEntry *FindEntry (const wxChar *szName) const;
|
||||
|
||||
// delete entry/subgroup, return FALSE if doesn't exist
|
||||
bool DeleteSubgroupByName(const wxChar *szName);
|
||||
bool DeleteEntry(const wxChar *szName);
|
||||
|
||||
// create new entry/subgroup returning pointer to newly created element
|
||||
ConfigGroup *AddSubgroup(const wxString& strName);
|
||||
ConfigEntry *AddEntry (const wxString& strName, int nLine = wxNOT_FOUND);
|
||||
|
||||
// will also recursively set parent's dirty flag
|
||||
void SetDirty();
|
||||
void SetLine(LineList *pLine);
|
||||
|
||||
// rename: no checks are done to ensure that the name is unique!
|
||||
void Rename(const wxString& newName);
|
||||
|
||||
//
|
||||
wxString GetFullName() const;
|
||||
|
||||
// get the last line belonging to an entry/subgroup of this group
|
||||
LineList *GetGroupLine(); // line which contains [group]
|
||||
LineList *GetLastEntryLine(); // after which our subgroups start
|
||||
LineList *GetLastGroupLine(); // after which the next group starts
|
||||
|
||||
// called by entries/subgroups when they're created/deleted
|
||||
void SetLastEntry(ConfigEntry *pEntry) { m_pLastEntry = pEntry; }
|
||||
void SetLastGroup(ConfigGroup *pGroup) { m_pLastGroup = pGroup; }
|
||||
};
|
||||
|
||||
#endif
|
||||
// wxUSE_CONFIG
|
||||
|
||||
#endif
|
||||
//_FILECONF_H
|
||||
|
22
include/wx/filedlg.h
Normal file
22
include/wx/filedlg.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef _WX_FILEDLG_H_BASE_
|
||||
#define _WX_FILEDLG_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/filedlg.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/filedlg.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/generic/filedlgg.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/filedlg.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/filedlg.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/filedlg.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/filedlg.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
// _WX_FILEDLG_H_BASE_
|
239
include/wx/filefn.h
Normal file
239
include/wx/filefn.h
Normal file
@@ -0,0 +1,239 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: filefn.h
|
||||
// Purpose: File- and directory-related functions
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 29/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Julian Smart
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _FILEFN_H_
|
||||
#define _FILEFN_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "filefn.h"
|
||||
#endif
|
||||
|
||||
#include "wx/list.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// define off_t
|
||||
#ifndef __WXMAC__
|
||||
#include <sys/types.h>
|
||||
#else
|
||||
typedef long off_t;
|
||||
#endif
|
||||
|
||||
#if defined(__VISUALC__) || ( defined(__MWERKS__) && defined( __INTEL__) )
|
||||
typedef _off_t off_t;
|
||||
#elif defined(__BORLANDC__) && defined(__WIN16__)
|
||||
typedef long off_t;
|
||||
#elif defined(__SC__)
|
||||
typedef long off_t;
|
||||
#elif defined(__MWERKS__) && !defined(__INTEL__)
|
||||
typedef long off_t;
|
||||
#endif
|
||||
|
||||
const off_t wxInvalidOffset = (off_t)-1;
|
||||
|
||||
enum wxSeekMode
|
||||
{
|
||||
wxFromStart,
|
||||
wxFromCurrent,
|
||||
wxFromEnd
|
||||
};
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// functions
|
||||
// ----------------------------------------------------------------------------
|
||||
WXDLLEXPORT bool wxFileExists(const wxString& filename);
|
||||
#define FileExists wxFileExists
|
||||
|
||||
// does the path exist? (may have or not '/' or '\\' at the end)
|
||||
WXDLLEXPORT bool wxPathExists(const wxChar *pszPathName);
|
||||
|
||||
#define wxDirExists wxPathExists
|
||||
#define DirExists wxDirExists
|
||||
|
||||
WXDLLEXPORT bool wxIsAbsolutePath(const wxString& filename);
|
||||
#define IsAbsolutePath wxIsAbsolutePath
|
||||
|
||||
// Get filename
|
||||
WXDLLEXPORT wxChar* wxFileNameFromPath(wxChar *path);
|
||||
WXDLLEXPORT wxString wxFileNameFromPath(const wxString& path);
|
||||
#define FileNameFromPath wxFileNameFromPath
|
||||
|
||||
// Get directory
|
||||
WXDLLEXPORT wxString wxPathOnly(const wxString& path);
|
||||
#define PathOnly wxPathOnly
|
||||
|
||||
// wxString version
|
||||
WXDLLEXPORT wxString wxRealPath(const wxString& path);
|
||||
|
||||
WXDLLEXPORT void wxDos2UnixFilename(wxChar *s);
|
||||
#define Dos2UnixFilename wxDos2UnixFilename
|
||||
|
||||
WXDLLEXPORT void wxUnix2DosFilename(wxChar *s);
|
||||
#define Unix2DosFilename wxUnix2DosFilename
|
||||
|
||||
#ifdef __WXMAC__
|
||||
WXDLLEXPORT void wxMacPathToFSSpec( const wxChar *path , FSSpec *spec ) ;
|
||||
WXDLLEXPORT void wxMac2UnixFilename(wxChar *s);
|
||||
WXDLLEXPORT void wxUnix2MacFilename(wxChar *s);
|
||||
#endif
|
||||
|
||||
// Strip the extension, in situ
|
||||
WXDLLEXPORT void wxStripExtension(wxChar *buffer);
|
||||
WXDLLEXPORT void wxStripExtension(wxString& buffer);
|
||||
|
||||
// Get a temporary filename, opening and closing the file.
|
||||
WXDLLEXPORT wxChar* wxGetTempFileName(const wxString& prefix, wxChar *buf = (wxChar *) NULL);
|
||||
|
||||
// Expand file name (~/ and ${OPENWINHOME}/ stuff)
|
||||
WXDLLEXPORT wxChar* wxExpandPath(wxChar *dest, const wxChar *path);
|
||||
|
||||
// Contract w.r.t environment (</usr/openwin/lib, OPENWHOME> -> ${OPENWINHOME}/lib)
|
||||
// and make (if under the home tree) relative to home
|
||||
// [caller must copy-- volatile]
|
||||
WXDLLEXPORT wxChar* wxContractPath(const wxString& filename,
|
||||
const wxString& envname = wxEmptyString,
|
||||
const wxString& user = wxEmptyString);
|
||||
|
||||
// Destructive removal of /./ and /../ stuff
|
||||
WXDLLEXPORT wxChar* wxRealPath(wxChar *path);
|
||||
|
||||
// Allocate a copy of the full absolute path
|
||||
WXDLLEXPORT wxChar* wxCopyAbsolutePath(const wxString& path);
|
||||
|
||||
// Get first file name matching given wild card.
|
||||
// Flags are reserved for future use.
|
||||
#define wxFILE 1
|
||||
#define wxDIR 2
|
||||
WXDLLEXPORT wxString wxFindFirstFile(const wxChar *spec, int flags = wxFILE);
|
||||
WXDLLEXPORT wxString wxFindNextFile();
|
||||
|
||||
// Does the pattern contain wildcards?
|
||||
WXDLLEXPORT bool wxIsWild(const wxString& pattern);
|
||||
|
||||
// Does the pattern match the text (usually a filename)?
|
||||
// If dot_special is TRUE, doesn't match * against . (eliminating
|
||||
// `hidden' dot files)
|
||||
WXDLLEXPORT bool wxMatchWild(const wxString& pattern, const wxString& text, bool dot_special = TRUE);
|
||||
|
||||
// Concatenate two files to form third
|
||||
WXDLLEXPORT bool wxConcatFiles(const wxString& file1, const wxString& file2, const wxString& file3);
|
||||
|
||||
// Copy file1 to file2
|
||||
WXDLLEXPORT bool wxCopyFile(const wxString& file1, const wxString& file2);
|
||||
|
||||
// Remove file
|
||||
WXDLLEXPORT bool wxRemoveFile(const wxString& file);
|
||||
|
||||
// Rename file
|
||||
WXDLLEXPORT bool wxRenameFile(const wxString& file1, const wxString& file2);
|
||||
|
||||
// Get current working directory.
|
||||
// If buf is NULL, allocates space using new, else
|
||||
// copies into buf.
|
||||
// IMPORTANT NOTE getcwd is know not to work under some releases
|
||||
// of Win32s 1.3, according to MS release notes!
|
||||
WXDLLEXPORT wxChar* wxGetWorkingDirectory(wxChar *buf = (wxChar *) NULL, int sz = 1000);
|
||||
// new and preferred version of wxGetWorkingDirectory
|
||||
// NB: can't have the same name because of overloading ambiguity
|
||||
WXDLLEXPORT wxString wxGetCwd();
|
||||
|
||||
// Set working directory
|
||||
WXDLLEXPORT bool wxSetWorkingDirectory(const wxString& d);
|
||||
|
||||
// Make directory
|
||||
WXDLLEXPORT bool wxMkdir(const wxString& dir, int perm = 0777);
|
||||
|
||||
// Remove directory. Flags reserved for future use.
|
||||
WXDLLEXPORT bool wxRmdir(const wxString& dir, int flags = 0);
|
||||
|
||||
// separators in file names
|
||||
#define wxFILE_SEP_EXT wxT('.')
|
||||
#define wxFILE_SEP_DSK wxT(':')
|
||||
#define wxFILE_SEP_PATH_DOS wxT('\\')
|
||||
#define wxFILE_SEP_PATH_UNIX wxT('/')
|
||||
|
||||
// separator in the path list (as in PATH environment variable)
|
||||
// NB: these are strings and not characters on purpose!
|
||||
#define wxPATH_SEP_DOS wxT(";")
|
||||
#define wxPATH_SEP_UNIX wxT(":")
|
||||
|
||||
// platform independent versions
|
||||
#ifdef __UNIX__
|
||||
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX
|
||||
#define wxPATH_SEP wxPATH_SEP_UNIX
|
||||
#else // Windows and OS/2
|
||||
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS
|
||||
#define wxPATH_SEP wxPATH_SEP_DOS
|
||||
#endif // Unix/Windows
|
||||
|
||||
// this is useful for wxString::IsSameAs(): to compare two file names use
|
||||
// filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE)
|
||||
#ifdef __UNIX__
|
||||
#define wxARE_FILENAMES_CASE_SENSITIVE TRUE
|
||||
#else // Windows and OS/2
|
||||
#define wxARE_FILENAMES_CASE_SENSITIVE FALSE
|
||||
#endif // Unix/Windows
|
||||
|
||||
// is the char a path separator?
|
||||
inline bool wxIsPathSeparator(wxChar c)
|
||||
{ return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX; }
|
||||
|
||||
// does the string ends with path separator?
|
||||
WXDLLEXPORT bool wxEndsWithPathSeparator(const wxChar *pszFileName);
|
||||
|
||||
// split the full path into path (including drive for DOS), name and extension
|
||||
// (understands both '/' and '\\')
|
||||
WXDLLEXPORT void wxSplitPath(const wxChar *pszFileName,
|
||||
wxString *pstrPath,
|
||||
wxString *pstrName,
|
||||
wxString *pstrExt);
|
||||
|
||||
// find a file in a list of directories, returns false if not found
|
||||
WXDLLEXPORT bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFile);
|
||||
|
||||
// Get the OS directory if appropriate (such as the Windows directory).
|
||||
// On non-Windows platform, probably just return the empty string.
|
||||
WXDLLEXPORT wxString wxGetOSDirectory();
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// classes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Path searching
|
||||
class WXDLLEXPORT wxPathList : public wxStringList
|
||||
{
|
||||
public:
|
||||
// Adds all paths in environment variable
|
||||
void AddEnvList(const wxString& envVariable);
|
||||
|
||||
void Add(const wxString& path);
|
||||
// Avoid compiler warning
|
||||
wxNode *Add(const wxChar *s) { return wxStringList::Add(s); }
|
||||
// Find the first full path for which the file exists
|
||||
wxString FindValidPath(const wxString& filename);
|
||||
// Find the first full path for which the file exists; ensure it's an
|
||||
// absolute path that gets returned.
|
||||
wxString FindAbsoluteValidPath(const wxString& filename);
|
||||
// Given full path and filename, add path to list
|
||||
void EnsureFileAccessible(const wxString& path);
|
||||
// Returns TRUE if the path is in the list
|
||||
bool Member(const wxString& path);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxPathList)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_FILEFN_H_
|
211
include/wx/filesys.h
Normal file
211
include/wx/filesys.h
Normal file
@@ -0,0 +1,211 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: filesys.h
|
||||
// Purpose: class for opening files - virtual file system
|
||||
// Author: Vaclav Slavik
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __FILESYS_H__
|
||||
#define __FILESYS_H__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
|
||||
#if (wxUSE_FS_INET || wxUSE_FS_ZIP) && wxUSE_STREAMS
|
||||
|
||||
#include "wx/stream.h"
|
||||
#include "wx/mimetype.h"
|
||||
#include "wx/url.h"
|
||||
|
||||
|
||||
class wxFSFile;
|
||||
class wxFileSystemHandler;
|
||||
class wxFileSystem;
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxFSFile
|
||||
// This class is a file opened using wxFileSystem. It consists of
|
||||
// input stream, location, mime type & optional anchor
|
||||
// (in 'index.htm#chapter2', 'chapter2' is anchor)
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFSFile : public wxObject
|
||||
{
|
||||
private:
|
||||
wxInputStream *m_Stream;
|
||||
wxString m_Location;
|
||||
wxString m_MimeType;
|
||||
wxString m_Anchor;
|
||||
|
||||
public:
|
||||
wxFSFile(wxInputStream *stream, const wxString& loc, const wxString& mimetype, const wxString& anchor)
|
||||
{
|
||||
m_Stream = stream;
|
||||
m_Location = loc;
|
||||
m_MimeType = mimetype; m_MimeType.MakeLower();
|
||||
m_Anchor = anchor;
|
||||
}
|
||||
virtual ~wxFSFile()
|
||||
{
|
||||
if (m_Stream) delete m_Stream;
|
||||
}
|
||||
|
||||
wxInputStream *GetStream() const {return m_Stream;}
|
||||
// returns stream. This doesn't _create_ stream, it only returns
|
||||
// pointer to it!!
|
||||
|
||||
const wxString& GetMimeType() const {return m_MimeType;}
|
||||
// returns file's mime type
|
||||
|
||||
const wxString& GetLocation() const {return m_Location;}
|
||||
// returns the original location (aka filename) of the file
|
||||
|
||||
const wxString& GetAnchor() const {return m_Anchor;}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxFileSystemHandler
|
||||
// This class is FS handler for wxFileSystem. It provides
|
||||
// interface to access certain
|
||||
// kinds of files (HTPP, FTP, local, tar.gz etc..)
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFileSystemHandler : public wxObject
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxFileSystemHandler)
|
||||
|
||||
public:
|
||||
wxFileSystemHandler() : wxObject() {}
|
||||
|
||||
virtual bool CanOpen(const wxString& location) = 0;
|
||||
// returns TRUE if this handler is able to open given location
|
||||
|
||||
virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location) = 0;
|
||||
// opens given file and returns pointer to input stream.
|
||||
// Returns NULL if opening failed.
|
||||
// The location is always absolute path.
|
||||
|
||||
protected:
|
||||
wxString GetProtocol(const wxString& location) const;
|
||||
// returns protocol ("file", "http", "tar" etc.) The last (most right)
|
||||
// protocol is used:
|
||||
// {it returns "tar" for "file:subdir/archive.tar.gz#tar:/README.txt"}
|
||||
|
||||
wxString GetLeftLocation(const wxString& location) const;
|
||||
// returns left part of address:
|
||||
// {it returns "file:subdir/archive.tar.gz" for "file:subdir/archive.tar.gz#tar:/README.txt"}
|
||||
|
||||
wxString GetAnchor(const wxString& location) const;
|
||||
// returns anchor part of address:
|
||||
// {it returns "anchor" for "file:subdir/archive.tar.gz#tar:/README.txt#anchor"}
|
||||
// NOTE: anchor is NOT a part of GetLeftLocation()'s return value
|
||||
|
||||
wxString GetRightLocation(const wxString& location) const;
|
||||
// returns right part of address:
|
||||
// {it returns "/README.txt" for "file:subdir/archive.tar.gz#tar:/README.txt"}
|
||||
|
||||
wxString GetMimeTypeFromExt(const wxString& location);
|
||||
// Returns MIME type of the file - w/o need to open it
|
||||
// (default behaviour is that it returns type based on extension)
|
||||
|
||||
public:
|
||||
static void CleanUpStatics();
|
||||
// deletes static members (m_MimeMng). It can be called
|
||||
// as many times as you wish because m_MimeMng is created
|
||||
// on demand
|
||||
|
||||
private:
|
||||
static wxMimeTypesManager *m_MimeMng;
|
||||
// MIME manager
|
||||
// (it's static and thus shared by all instances and derived classes)
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxFileSystem
|
||||
// This class provides simple interface for opening various
|
||||
// kinds of files (HTPP, FTP, local, tar.gz etc..)
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFileSystem : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFileSystem)
|
||||
|
||||
private:
|
||||
wxString m_Path;
|
||||
// the path (location) we are currently in
|
||||
// this is path, not file!
|
||||
// (so if you opened test/demo.htm, it is
|
||||
// "test/", not "test/demo.htm")
|
||||
wxString m_LastName;
|
||||
// name of last opened file (full path)
|
||||
static wxList m_Handlers;
|
||||
// list of FS handlers
|
||||
|
||||
public:
|
||||
wxFileSystem() : wxObject() {m_Path = m_LastName = wxEmptyString; m_Handlers.DeleteContents(TRUE);}
|
||||
|
||||
void ChangePathTo(const wxString& location, bool is_dir = FALSE);
|
||||
// sets the current location. Every call to OpenFile is
|
||||
// relative to this location.
|
||||
// NOTE !!
|
||||
// unless is_dir = TRUE 'location' is *not* the directory but
|
||||
// file contained in this directory
|
||||
// (so ChangePathTo("dir/subdir/xh.htm") sets m_Path to "dir/subdir/")
|
||||
|
||||
wxString GetPath() const {return m_Path;}
|
||||
|
||||
wxFSFile* OpenFile(const wxString& location);
|
||||
// opens given file and returns pointer to input stream.
|
||||
// Returns NULL if opening failed.
|
||||
// It first tries to open the file in relative scope
|
||||
// (based on ChangePathTo()'s value) and then as an absolute
|
||||
// path.
|
||||
|
||||
static void AddHandler(wxFileSystemHandler *handler);
|
||||
// Adds FS handler.
|
||||
// In fact, this class is only front-end to the FS hanlers :-)
|
||||
|
||||
static void CleanUpHandlers();
|
||||
// remove all items from the m_Handlers list
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
|
||||
'location' syntax:
|
||||
|
||||
To determine FS type, we're using standard KDE notation:
|
||||
file:/absolute/path/file.htm
|
||||
file:relative_path/xxxxx.html
|
||||
/some/path/x.file ('file:' is default)
|
||||
http://www.gnome.org
|
||||
file:subdir/archive.tar.gz#tar:/README.txt
|
||||
|
||||
special characters :
|
||||
':' - FS identificator is before this char
|
||||
'#' - separator. It can be either HTML anchor ("index.html#news")
|
||||
(in case there is no ':' in the string to the right from it)
|
||||
or FS separator
|
||||
(example : http://www.wxhtml.org/wxhtml-0.1.tar.gz#tar:/include/wxhtml/filesys.h"
|
||||
this would access tgz archive stored on web)
|
||||
'/' - directory (path) separator. It is used to determine upper-level path.
|
||||
HEY! Don't use \ even if you're on Windows!
|
||||
|
||||
*/
|
||||
|
||||
#endif
|
||||
// (wxUSE_FS_INET || wxUSE_FS_ZIP) && wxUSE_STREAMS
|
||||
|
||||
#endif
|
||||
// __FILESYS_H__
|
205
include/wx/font.h
Normal file
205
include/wx/font.h
Normal file
@@ -0,0 +1,205 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/font.h
|
||||
// Purpose: wxFontBase class: the interface of wxFont
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 20.09.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_FONT_H_BASE_
|
||||
#define _WX_FONT_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "fontbase.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/defs.h" // for wxDEFAULT &c
|
||||
#include "wx/gdiobj.h" // the base class
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFontBase;
|
||||
class WXDLLEXPORT wxFont;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// font constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// standard font families
|
||||
enum wxFontFamily
|
||||
{
|
||||
wxFONTFAMILY_DEFAULT = wxDEFAULT,
|
||||
wxFONTFAMILY_DECORATIVE = wxDECORATIVE,
|
||||
wxFONTFAMILY_ROMAN = wxROMAN,
|
||||
wxFONTFAMILY_SCRIPT = wxSCRIPT,
|
||||
wxFONTFAMILY_SWISS = wxSWISS,
|
||||
wxFONTFAMILY_MODERN = wxMODERN,
|
||||
wxFONTFAMILY_TELETYPE = wxTELETYPE,
|
||||
wxFONTFAMILY_MAX
|
||||
};
|
||||
|
||||
// font styles
|
||||
enum wxFontStyle
|
||||
{
|
||||
wxFONTSTYLE_NORMAL = wxNORMAL,
|
||||
wxFONTSTYLE_ITALIC = wxITALIC,
|
||||
wxFONTSTYLE_SLANT = wxSLANT,
|
||||
wxFONTSTYLE_MAX
|
||||
};
|
||||
|
||||
// font weights
|
||||
enum wxFontWeight
|
||||
{
|
||||
wxFONTWEIGHT_NORMAL = wxNORMAL,
|
||||
wxFONTWEIGHT_LIGHT = wxLIGHT,
|
||||
wxFONTWEIGHT_BOLD = wxBOLD,
|
||||
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)
|
||||
|
||||
// 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_CP1250, // WinLatin2
|
||||
wxFONTENCODING_CP1251, // WinCyrillic
|
||||
wxFONTENCODING_CP1252, // WinLatin1
|
||||
|
||||
wxFONTENCODING_MAX
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFontBase represents a font object
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxFontBase : public wxGDIObject
|
||||
{
|
||||
public:
|
||||
// creator function
|
||||
static wxFont *New(
|
||||
int pointSize, // size of the font in points
|
||||
int family, // see wxFontFamily enum
|
||||
int style, // see wxFontStyle enum
|
||||
int weight, // see wxFontWeight enum
|
||||
bool underlined = FALSE, // not underlined by default
|
||||
const wxString& face = wxEmptyString, // facename
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ...
|
||||
|
||||
// was the font successfully created?
|
||||
bool Ok() const { return m_refData != NULL; }
|
||||
|
||||
// comparison
|
||||
bool operator == (const wxFont& font) const;
|
||||
bool operator != (const wxFont& font) const;
|
||||
|
||||
// accessors: get the font characteristics
|
||||
virtual int GetPointSize() const = 0;
|
||||
virtual int GetFamily() const = 0;
|
||||
virtual int GetStyle() const = 0;
|
||||
virtual int GetWeight() const = 0;
|
||||
virtual bool GetUnderlined() const = 0;
|
||||
virtual wxString GetFaceName() const = 0;
|
||||
virtual wxFontEncoding GetEncoding() const = 0;
|
||||
|
||||
// change the font characteristics
|
||||
virtual void SetPointSize( int pointSize ) = 0;
|
||||
virtual void SetFamily( int family ) = 0;
|
||||
virtual void SetStyle( int style ) = 0;
|
||||
virtual void SetWeight( int weight ) = 0;
|
||||
virtual void SetFaceName( const wxString& faceName ) = 0;
|
||||
virtual void SetUnderlined( bool underlined ) = 0;
|
||||
virtual void SetEncoding(wxFontEncoding encoding) = 0;
|
||||
|
||||
// translate the fonts into human-readable string (i.e. GetStyleString()
|
||||
// will return "wxITALIC" for an italic font, ...)
|
||||
wxString GetFamilyString() const;
|
||||
wxString GetStyleString() const;
|
||||
wxString GetWeightString() const;
|
||||
|
||||
// the default encoding is used for creating all fonts with default
|
||||
// encoding parameter
|
||||
static wxFontEncoding GetDefaultEncoding()
|
||||
{ return ms_encodingDefault; }
|
||||
static void SetDefaultEncoding(wxFontEncoding encoding)
|
||||
{ ms_encodingDefault = encoding; }
|
||||
|
||||
protected:
|
||||
// get the internal data
|
||||
class WXDLLEXPORT wxFontRefData *GetFontData() const
|
||||
{ return (wxFontRefData *)m_refData; }
|
||||
|
||||
private:
|
||||
// the currently default encoding: by default, it's the default system
|
||||
// encoding, but may be changed by the application using
|
||||
// SetDefaultEncoding() to make all subsequent fonts created without
|
||||
// specifing encoding parameter using this encoding
|
||||
static wxFontEncoding ms_encodingDefault;
|
||||
};
|
||||
|
||||
// include the real class declaration
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/font.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/font.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/font.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/font.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/font.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/font.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/font.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define M_FONTDATA GetFontData()
|
||||
|
||||
#endif
|
||||
// _WX_FONT_H_BASE_
|
29
include/wx/fontdlg.h
Normal file
29
include/wx/fontdlg.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef _WX_FONTDLG_H_BASE_
|
||||
#define _WX_FONTDLG_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/fontdlg.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/generic/fontdlgg.h"
|
||||
# define wxFontDialog wxGenericFontDialog
|
||||
# define sm_classwxFontDialog sm_classwxGenericFontDialog
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/fontdlg.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/generic/fontdlgg.h"
|
||||
# define wxFontDialog wxGenericFontDialog
|
||||
# define sm_classwxFontDialog sm_classwxGenericFontDialog
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/generic/fontdlgg.h"
|
||||
# define wxFontDialog wxGenericFontDialog
|
||||
# define sm_classwxFontDialog sm_classwxGenericFontDialog
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/fontdlg.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/generic/fontdlgg.h"
|
||||
# define wxFontDialog wxGenericFontDialog
|
||||
# define sm_classwxFontDialog sm_classwxGenericFontDialog
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_FONTDLG_H_BASE_
|
51
include/wx/fontenum.h
Normal file
51
include/wx/fontenum.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: fontenum.h
|
||||
// Purpose: wxFontEnumerator class for getting available fonts
|
||||
// Author: Julian Smart, Vadim Zeitlin
|
||||
// Modified by: extended to enumerate more than just font families and work ot
|
||||
// only on Windows (VZ)
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart, Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_FONTENUM_H_
|
||||
#define _WX_FONTENUM_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "fontenum.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFontEnumerator enumerates all available fonts on the system or only the
|
||||
// fonts with given attributes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxFontEnumerator
|
||||
{
|
||||
public:
|
||||
// start enumerating font families - will result in OnFontFamily() being
|
||||
// called for each available font family (unless it returns FALSE)
|
||||
virtual bool EnumerateFamilies(bool fixedWidthOnly = FALSE);
|
||||
|
||||
// enumerate the different encodings either for given font family or for
|
||||
// all font families - will result in OnFontEncoding() being called for
|
||||
// each available (family, encoding) couple
|
||||
virtual bool EnumerateEncodings(const wxString& family = wxT(""));
|
||||
|
||||
// callbacks which are called after one of EnumerateXXX() functions from
|
||||
// above is invoked - all of them may return FALSE to stop enumeration or
|
||||
// TRUE to continue with it
|
||||
|
||||
// called by EnumerateFamilies
|
||||
virtual bool OnFontFamily(const wxString& WXUNUSED(family))
|
||||
{ return FALSE; }
|
||||
|
||||
// called by EnumerateEncodings
|
||||
virtual bool OnFontEncoding(const wxString& WXUNUSED(family),
|
||||
const wxString& WXUNUSED(encoding))
|
||||
{ return FALSE; }
|
||||
};
|
||||
|
||||
#endif // _WX_FONTENUM_H_
|
21
include/wx/frame.h
Normal file
21
include/wx/frame.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_FRAME_H_BASE_
|
||||
#define _WX_FRAME_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/frame.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/frame.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/frame.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/frame.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/frame.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/frame.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/frame.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_FRAME_H_BASE_
|
58
include/wx/fs_inet.h
Normal file
58
include/wx/fs_inet.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: fs_inet.h
|
||||
// Purpose: HTTP and FTP file system
|
||||
// Author: Vaclav Slavik
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
|
||||
REMARKS :
|
||||
|
||||
This FS creates local cache (in /tmp directory). The cache is freed
|
||||
on program exit.
|
||||
|
||||
Size of cache is limited to cca 1000 items (due to GetTempFileName
|
||||
limitation)
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORDLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/filesys.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxInternetFSHandler
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxInternetFSHandler : public wxFileSystemHandler
|
||||
{
|
||||
private:
|
||||
wxHashTable m_Cache;
|
||||
|
||||
public:
|
||||
virtual bool CanOpen(const wxString& location);
|
||||
virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
|
||||
~wxInternetFSHandler();
|
||||
};
|
||||
|
||||
#endif
|
||||
// wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS
|
||||
|
44
include/wx/fs_zip.h
Normal file
44
include/wx/fs_zip.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: fs_zip.h
|
||||
// Purpose: ZIP file system
|
||||
// Author: Vaclav Slavik
|
||||
// Copyright: (c) 1999 Vaclav Slavik
|
||||
// Licence: wxWindows Licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORDLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_FS_ZIP && wxUSE_STREAMS
|
||||
|
||||
|
||||
#ifndef WXPRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "wx/filesys.h"
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// wxZipFSHandler
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxZipFSHandler : public wxFileSystemHandler
|
||||
{
|
||||
public:
|
||||
virtual bool CanOpen(const wxString& location);
|
||||
virtual wxFSFile* OpenFile(wxFileSystem& fs, const wxString& location);
|
||||
~wxZipFSHandler();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
// wxUSE_FS_ZIP && wxUSE_STREAMS
|
||||
|
21
include/wx/gauge.h
Normal file
21
include/wx/gauge.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_GAUGE_H_BASE_
|
||||
#define _WX_GAUGE_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/gauge.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/gauge.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/gauge.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/gauge.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/gauge.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/gauge.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/gauge.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_GAUGE_H_BASE_
|
487
include/wx/gdicmn.h
Normal file
487
include/wx/gdicmn.h
Normal file
@@ -0,0 +1,487 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: gdicmn.h
|
||||
// Purpose: Common GDI classes, types and declarations
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GDICMNH__
|
||||
#define _WX_GDICMNH__
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// headers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "gdicmn.h"
|
||||
#endif
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/hash.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/setup.h"
|
||||
#include "wx/colour.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxBitmap;
|
||||
class WXDLLEXPORT wxBrush;
|
||||
class WXDLLEXPORT wxColour;
|
||||
class WXDLLEXPORT wxCursor;
|
||||
class WXDLLEXPORT wxFont;
|
||||
class WXDLLEXPORT wxIcon;
|
||||
class WXDLLEXPORT wxPalette;
|
||||
class WXDLLEXPORT wxPen;
|
||||
class WXDLLEXPORT wxRegion;
|
||||
class WXDLLEXPORT wxString;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// constants
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Bitmap flags
|
||||
enum
|
||||
{
|
||||
wxBITMAP_TYPE_BMP = 1,
|
||||
wxBITMAP_TYPE_BMP_RESOURCE,
|
||||
wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE,
|
||||
wxBITMAP_TYPE_ICO,
|
||||
wxBITMAP_TYPE_ICO_RESOURCE,
|
||||
wxBITMAP_TYPE_CUR,
|
||||
wxBITMAP_TYPE_CUR_RESOURCE,
|
||||
wxBITMAP_TYPE_XBM,
|
||||
wxBITMAP_TYPE_XBM_DATA,
|
||||
wxBITMAP_TYPE_XPM,
|
||||
wxBITMAP_TYPE_XPM_DATA,
|
||||
wxBITMAP_TYPE_TIF,
|
||||
wxBITMAP_TYPE_TIF_RESOURCE,
|
||||
wxBITMAP_TYPE_GIF,
|
||||
wxBITMAP_TYPE_GIF_RESOURCE,
|
||||
wxBITMAP_TYPE_PNG,
|
||||
wxBITMAP_TYPE_PNG_RESOURCE,
|
||||
wxBITMAP_TYPE_JPEG,
|
||||
wxBITMAP_TYPE_JPEG_RESOURCE,
|
||||
wxBITMAP_TYPE_PNM,
|
||||
wxBITMAP_TYPE_PNM_RESOURCE,
|
||||
wxBITMAP_TYPE_PCX,
|
||||
wxBITMAP_TYPE_PCX_RESOURCE,
|
||||
wxBITMAP_TYPE_ANY = 50
|
||||
};
|
||||
|
||||
// Standard cursors
|
||||
enum wxStockCursor
|
||||
{
|
||||
wxCURSOR_NONE, // should be 0
|
||||
wxCURSOR_ARROW,
|
||||
wxCURSOR_BULLSEYE,
|
||||
wxCURSOR_CHAR,
|
||||
wxCURSOR_CROSS,
|
||||
wxCURSOR_HAND,
|
||||
wxCURSOR_IBEAM,
|
||||
wxCURSOR_LEFT_BUTTON,
|
||||
wxCURSOR_MAGNIFIER,
|
||||
wxCURSOR_MIDDLE_BUTTON,
|
||||
wxCURSOR_NO_ENTRY,
|
||||
wxCURSOR_PAINT_BRUSH,
|
||||
wxCURSOR_PENCIL,
|
||||
wxCURSOR_POINT_LEFT,
|
||||
wxCURSOR_POINT_RIGHT,
|
||||
wxCURSOR_QUESTION_ARROW,
|
||||
wxCURSOR_RIGHT_BUTTON,
|
||||
wxCURSOR_SIZENESW,
|
||||
wxCURSOR_SIZENS,
|
||||
wxCURSOR_SIZENWSE,
|
||||
wxCURSOR_SIZEWE,
|
||||
wxCURSOR_SIZING,
|
||||
wxCURSOR_SPRAYCAN,
|
||||
wxCURSOR_WAIT,
|
||||
wxCURSOR_WATCH,
|
||||
wxCURSOR_BLANK,
|
||||
#ifdef __WXGTK__
|
||||
wxCURSOR_DEFAULT, // standard X11 cursor
|
||||
#endif
|
||||
#ifdef __X__
|
||||
// Not yet implemented for Windows
|
||||
wxCURSOR_CROSS_REVERSE,
|
||||
wxCURSOR_DOUBLE_ARROW,
|
||||
wxCURSOR_BASED_ARROW_UP,
|
||||
wxCURSOR_BASED_ARROW_DOWN,
|
||||
#endif // X11
|
||||
|
||||
wxCURSOR_MAX
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// macros
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Useful macro for creating icons portably, for example:
|
||||
|
||||
wxIcon *icon = new wxICON(mondrian);
|
||||
|
||||
expands into:
|
||||
|
||||
wxIcon *icon = new wxIcon("mondrian"); // On wxMSW
|
||||
wxIcon *icon = new wxIcon(mondrian_xpm); // On wxGTK
|
||||
*/
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Load from a resource
|
||||
#define wxICON(X) wxIcon("" #X "")
|
||||
#elif defined(__WXPM__)
|
||||
// Load from a resource
|
||||
#define wxICON(X) wxIcon("" #X "")
|
||||
#elif defined(__WXGTK__)
|
||||
// Initialize from an included XPM
|
||||
#define wxICON(X) wxIcon( (const char**) X##_xpm )
|
||||
#elif defined(__WXMOTIF__)
|
||||
// Initialize from an included XPM
|
||||
#define wxICON(X) wxIcon( X##_xpm )
|
||||
#else
|
||||
// This will usually mean something on any platform
|
||||
#define wxICON(X) wxIcon("" #X "")
|
||||
#endif // platform
|
||||
|
||||
/* Another macro: this one is for portable creation of bitmaps. We assume that
|
||||
under Unix bitmaps live in XPMs and under Windows they're in ressources.
|
||||
*/
|
||||
|
||||
#if defined(__WXMSW__) || defined(__WXPM__)
|
||||
#define wxBITMAP(name) wxBitmap(#name, wxBITMAP_TYPE_RESOURCE)
|
||||
#else // !(Windows || OS2)
|
||||
#define wxBITMAP(name) wxBitmap(name##_xpm, wxBITMAP_TYPE_XPM)
|
||||
#endif // platform
|
||||
|
||||
// ===========================================================================
|
||||
// classes
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxSize
|
||||
// ---------------------------------------------------------------------------
|
||||
class WXDLLEXPORT wxSize
|
||||
{
|
||||
public:
|
||||
// members are public for compatibility (don't use them directly,
|
||||
// especially that there names were chosen very unfortunately - they should
|
||||
// have been called width and height)
|
||||
long x;
|
||||
long y;
|
||||
|
||||
// constructors
|
||||
wxSize() { x = y = 0; }
|
||||
wxSize(long xx, long yy) { Set(xx, yy); }
|
||||
|
||||
// no copy ctor or assignment operator - the defaults are ok
|
||||
bool operator==(const wxSize& sz) const { return x == sz.x && y == sz.y; }
|
||||
|
||||
// FIXME are these really useful? If they're, we should have += &c as well
|
||||
wxSize operator+(const wxSize& sz) { return wxSize(x + sz.x, y + sz.y); }
|
||||
wxSize operator-(const wxSize& sz) { return wxSize(x - sz.x, y - sz.y); }
|
||||
|
||||
// accessors
|
||||
void Set(long xx, long yy) { x = xx; y = yy; }
|
||||
void SetWidth(long w) { x = w; }
|
||||
void SetHeight(long h) { y = h; }
|
||||
|
||||
long GetWidth() const { return x; }
|
||||
long GetHeight() const { return y; }
|
||||
|
||||
// compatibility
|
||||
long GetX() const { return x; }
|
||||
long GetY() const { return y; }
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Point classes: with real or integer coordinates
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxRealPoint
|
||||
{
|
||||
public:
|
||||
double x;
|
||||
double y;
|
||||
|
||||
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); }
|
||||
|
||||
bool operator==(const wxRealPoint& pt) const { return x == pt.x && y == pt.y; }
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxPoint
|
||||
{
|
||||
public:
|
||||
#if defined(__WXMSW__) && !defined(__WIN32__)
|
||||
int x;
|
||||
int y;
|
||||
#else
|
||||
long x;
|
||||
long y;
|
||||
#endif
|
||||
|
||||
wxPoint() { x = y = 0; };
|
||||
wxPoint(long xx, long yy) { x = xx; y = yy; };
|
||||
|
||||
// no copy ctor or assignment operator - the defaults are ok
|
||||
|
||||
// comparison
|
||||
bool operator==(const wxPoint& p) const { return x == p.x && y == p.y; }
|
||||
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) { x += p.x; y += p.y; return *this; }
|
||||
wxPoint& operator-=(const wxPoint& p) { x -= p.x; y -= p.y; return *this; }
|
||||
};
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
#define wxIntPoint wxPoint
|
||||
#define wxRectangle wxRect
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxRect
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxRect
|
||||
{
|
||||
public:
|
||||
wxRect() { x = y = width = height = 0; }
|
||||
wxRect(long xx, long yy, long ww, long hh)
|
||||
{ x = xx; y = yy; width = ww; height = hh; }
|
||||
wxRect(const wxPoint& topLeft, const wxPoint& bottomRight);
|
||||
wxRect(const wxPoint& pos, const wxSize& size);
|
||||
|
||||
// default copy ctor and assignment operators ok
|
||||
|
||||
long GetX() const { return x; }
|
||||
void SetX(long xx) { x = xx; }
|
||||
|
||||
long GetY() const { return y; }
|
||||
void SetY(long yy) { y = yy; }
|
||||
|
||||
long GetWidth() const { return width; }
|
||||
void SetWidth(long w) { width = w; }
|
||||
|
||||
long GetHeight() const { return height; }
|
||||
void SetHeight(long h) { height = h; }
|
||||
|
||||
wxPoint GetPosition() const { return wxPoint(x, y); }
|
||||
wxSize GetSize() const { return wxSize(width, height); }
|
||||
|
||||
// MFC-like functions
|
||||
|
||||
long GetLeft() const { return x; }
|
||||
long GetTop() const { return y; }
|
||||
long GetBottom() const { return y + height - 1; }
|
||||
long GetRight() const { return x + width - 1; }
|
||||
|
||||
void SetLeft(long left) { x = left; }
|
||||
void SetRight(long right) { width = right - x + 1; }
|
||||
void SetTop(long top) { y = top; }
|
||||
void SetBottom(long bottom) { height = bottom - y + 1; }
|
||||
|
||||
bool operator==(const wxRect& rect) const;
|
||||
bool operator!=(const wxRect& rect) const { return !(*this == rect); }
|
||||
|
||||
bool Inside(int cx, int cy) const;
|
||||
wxRect operator + (const wxRect& rect) const;
|
||||
const wxRect& operator += (const wxRect& rect);
|
||||
|
||||
public:
|
||||
long x, y, width, height;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Management of pens, brushes and fonts
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPenList : public wxList
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPenList)
|
||||
|
||||
public:
|
||||
wxPenList() { }
|
||||
~wxPenList();
|
||||
|
||||
void AddPen(wxPen *pen);
|
||||
void RemovePen(wxPen *pen);
|
||||
wxPen *FindOrCreatePen(const wxColour& colour, int width, int style);
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxBrushList : public wxList
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBrushList)
|
||||
|
||||
public:
|
||||
wxBrushList() { }
|
||||
~wxBrushList();
|
||||
|
||||
void AddBrush(wxBrush *brush);
|
||||
void RemoveBrush(wxBrush *brush);
|
||||
wxBrush *FindOrCreateBrush(const wxColour& colour, int style);
|
||||
};
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
|
||||
|
||||
class WXDLLEXPORT wxFontList : public wxList
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxFontList)
|
||||
|
||||
public:
|
||||
wxFontList() { }
|
||||
~wxFontList();
|
||||
|
||||
void AddFont(wxFont *font);
|
||||
void RemoveFont(wxFont *font);
|
||||
wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight,
|
||||
bool underline = FALSE,
|
||||
const wxString& face = wxEmptyString);
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxColourDatabase : public wxList
|
||||
{
|
||||
DECLARE_CLASS(wxColourDatabase)
|
||||
|
||||
public:
|
||||
wxColourDatabase(int type);
|
||||
~wxColourDatabase() ;
|
||||
|
||||
// Not const because it may add a name to the database
|
||||
wxColour *FindColour(const wxString& colour) ;
|
||||
wxString FindName(const wxColour& colour) const;
|
||||
void Initialize();
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxBitmapList : public wxList
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapList)
|
||||
|
||||
public:
|
||||
wxBitmapList();
|
||||
~wxBitmapList();
|
||||
|
||||
void AddBitmap(wxBitmap *bitmap);
|
||||
void RemoveBitmap(wxBitmap *bitmap);
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxResourceCache: public wxList
|
||||
{
|
||||
public:
|
||||
wxResourceCache() { }
|
||||
wxResourceCache(const unsigned int keyType) : wxList(keyType) { }
|
||||
~wxResourceCache();
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxResourceCache)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// global variables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Lists of GDI objects
|
||||
WXDLLEXPORT_DATA(extern wxPenList*) wxThePenList;
|
||||
WXDLLEXPORT_DATA(extern wxBrushList*) wxTheBrushList;
|
||||
WXDLLEXPORT_DATA(extern wxFontList*) wxTheFontList;
|
||||
WXDLLEXPORT_DATA(extern wxBitmapList*) wxTheBitmapList;
|
||||
|
||||
// Stock objects
|
||||
WXDLLEXPORT_DATA(extern wxFont*) wxNORMAL_FONT;
|
||||
WXDLLEXPORT_DATA(extern wxFont*) wxSMALL_FONT;
|
||||
WXDLLEXPORT_DATA(extern wxFont*) wxITALIC_FONT;
|
||||
WXDLLEXPORT_DATA(extern wxFont*) wxSWISS_FONT;
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxRED_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxCYAN_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxGREEN_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxWHITE_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxTRANSPARENT_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxBLACK_DASHED_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxGREY_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxMEDIUM_GREY_PEN;
|
||||
WXDLLEXPORT_DATA(extern wxPen*) wxLIGHT_GREY_PEN;
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxBLUE_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxGREEN_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxWHITE_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxBLACK_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxGREY_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxMEDIUM_GREY_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxLIGHT_GREY_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxTRANSPARENT_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxCYAN_BRUSH;
|
||||
WXDLLEXPORT_DATA(extern wxBrush*) wxRED_BRUSH;
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxBLACK;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxWHITE;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxRED;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxBLUE;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxGREEN;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxCYAN;
|
||||
WXDLLEXPORT_DATA(extern wxColour*) wxLIGHT_GREY;
|
||||
|
||||
// 'Null' objects
|
||||
WXDLLEXPORT_DATA(extern wxBitmap) wxNullBitmap;
|
||||
WXDLLEXPORT_DATA(extern wxIcon) wxNullIcon;
|
||||
WXDLLEXPORT_DATA(extern wxCursor) wxNullCursor;
|
||||
WXDLLEXPORT_DATA(extern wxPen) wxNullPen;
|
||||
WXDLLEXPORT_DATA(extern wxBrush) wxNullBrush;
|
||||
WXDLLEXPORT_DATA(extern wxPalette) wxNullPalette;
|
||||
WXDLLEXPORT_DATA(extern wxFont) wxNullFont;
|
||||
WXDLLEXPORT_DATA(extern wxColour) wxNullColour;
|
||||
|
||||
// Stock cursors types
|
||||
WXDLLEXPORT_DATA(extern wxCursor*) wxSTANDARD_CURSOR;
|
||||
WXDLLEXPORT_DATA(extern wxCursor*) wxHOURGLASS_CURSOR;
|
||||
WXDLLEXPORT_DATA(extern wxCursor*) wxCROSS_CURSOR;
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxColourDatabase*) wxTheColourDatabase;
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxSize) wxDefaultSize;
|
||||
WXDLLEXPORT_DATA(extern const wxPoint) wxDefaultPosition;
|
||||
|
||||
// The list of objects which should be deleted
|
||||
WXDLLEXPORT_DATA(extern wxList) wxPendingDelete;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// global functions
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// resource management
|
||||
extern void WXDLLEXPORT wxInitializeStockObjects();
|
||||
extern void WXDLLEXPORT wxInitializeStockLists();
|
||||
extern void WXDLLEXPORT wxDeleteStockObjects();
|
||||
extern void WXDLLEXPORT wxDeleteStockLists();
|
||||
|
||||
// is the display colour (or monochrome)?
|
||||
extern bool WXDLLEXPORT wxColourDisplay();
|
||||
|
||||
// Returns depth of screen
|
||||
extern int WXDLLEXPORT wxDisplayDepth();
|
||||
#define wxGetDisplayDepth wxDisplayDepth
|
||||
|
||||
// get the diaplay size
|
||||
extern void WXDLLEXPORT wxDisplaySize(int *width, int *height);
|
||||
extern wxSize WXDLLEXPORT wxGetDisplaySize();
|
||||
|
||||
// set global cursor
|
||||
extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor);
|
||||
|
||||
#endif
|
||||
// _WX_GDICMNH__
|
21
include/wx/gdiobj.h
Normal file
21
include/wx/gdiobj.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _WX_GDIOBJ_H_BASE_
|
||||
#define _WX_GDIOBJ_H_BASE_
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/gdiobj.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/gdiobj.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/gdiobj.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/gdiobj.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/gdiobj.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/gdiobj.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/gdiobj.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_GDIOBJ_H_BASE_
|
2
include/wx/generic/.cvsignore
Normal file
2
include/wx/generic/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile.in
|
||||
|
70
include/wx/generic/caret.h
Normal file
70
include/wx/generic/caret.h
Normal file
@@ -0,0 +1,70 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: generic/caret.h
|
||||
// Purpose: generic wxCaret class
|
||||
// Author: Vadim Zeitlin (original code by Robert Roebling)
|
||||
// Modified by:
|
||||
// Created: 25.05.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CARET_H_
|
||||
#define _WX_CARET_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "caret.h"
|
||||
#endif
|
||||
|
||||
#include "wx/timer.h"
|
||||
|
||||
class wxCaret;
|
||||
|
||||
class wxCaretTimer : public wxTimer
|
||||
{
|
||||
public:
|
||||
wxCaretTimer(wxCaret *caret);
|
||||
virtual void Notify();
|
||||
|
||||
private:
|
||||
wxCaret *m_caret;
|
||||
};
|
||||
|
||||
class wxCaret : public wxCaretBase
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
// -----
|
||||
// default - use Create()
|
||||
wxCaret() : m_timer(this) { InitGeneric(); }
|
||||
// creates a block caret associated with the given window
|
||||
wxCaret(wxWindowBase *window, int width, int height)
|
||||
: wxCaretBase(window, width, height), m_timer(this) { InitGeneric(); }
|
||||
wxCaret(wxWindowBase *window, const wxSize& size)
|
||||
: wxCaretBase(window, size), m_timer(this) { InitGeneric(); }
|
||||
|
||||
virtual ~wxCaret();
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
// blink the caret once
|
||||
void Blink();
|
||||
|
||||
protected:
|
||||
virtual void DoShow();
|
||||
virtual void DoHide();
|
||||
virtual void DoMove();
|
||||
|
||||
// draw the caret on the given DC
|
||||
void DoDraw(wxDC *dc);
|
||||
|
||||
private:
|
||||
// GTK specific initialization
|
||||
void InitGeneric();
|
||||
|
||||
wxCaretTimer m_timer;
|
||||
bool m_blinkedOut; // TRUE => caret hidden right now
|
||||
};
|
||||
|
||||
#endif // _WX_CARET_H_
|
135
include/wx/generic/choicdgg.h
Normal file
135
include/wx/generic/choicdgg.h
Normal file
@@ -0,0 +1,135 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: choicdgg.h
|
||||
// Purpose: Generic choice dialogs
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __CHOICEDLGH_G__
|
||||
#define __CHOICEDLGH_G__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "choicdgg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/listbox.h"
|
||||
|
||||
#define wxCHOICE_HEIGHT 150
|
||||
#define wxCHOICE_WIDTH 200
|
||||
|
||||
#define wxCHOICEDLG_STYLE (wxDEFAULT_DIALOG_STYLE|wxOK | wxCANCEL | wxCENTRE)
|
||||
|
||||
class WXDLLEXPORT wxSingleChoiceDialog: public wxDialog
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxSingleChoiceDialog)
|
||||
|
||||
public:
|
||||
wxSingleChoiceDialog(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
int n,
|
||||
const wxString *choices,
|
||||
char **clientData = (char **)NULL,
|
||||
long style = wxCHOICEDLG_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
wxSingleChoiceDialog(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
const wxStringList& choices,
|
||||
char **clientData = (char **)NULL,
|
||||
long style = wxCHOICEDLG_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
int n,
|
||||
const wxString *choices,
|
||||
char **clientData = (char **)NULL,
|
||||
long style = wxCHOICEDLG_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
const wxStringList& choices,
|
||||
char **clientData = (char **)NULL,
|
||||
long style = wxCHOICEDLG_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
void SetSelection(int sel) ;
|
||||
int GetSelection() const { return m_selection; }
|
||||
wxString GetStringSelection() const { return m_stringSelection; }
|
||||
|
||||
// get client data associated with selection
|
||||
void *GetClientData() const { return m_clientData; }
|
||||
|
||||
// obsolete function (NB: no need to make it return wxChar, it's untyped)
|
||||
char *GetSelectionClientData() const { return (char *)m_clientData; }
|
||||
|
||||
// implementation from now on
|
||||
void OnOK(wxCommandEvent& event);
|
||||
void OnListBoxDClick(wxCommandEvent& event);
|
||||
|
||||
protected:
|
||||
int m_selection;
|
||||
int m_dialogStyle;
|
||||
wxString m_stringSelection;
|
||||
wxListBox *m_listbox;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
|
||||
int n, const wxString *choices, wxWindow *parent = (wxWindow *) NULL,
|
||||
int x = -1, int y = -1, bool centre = TRUE,
|
||||
int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
|
||||
|
||||
WXDLLEXPORT wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
|
||||
int n, wxChar *choices[], wxWindow *parent = (wxWindow *) NULL,
|
||||
int x = -1, int y = -1, bool centre = TRUE,
|
||||
int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
|
||||
|
||||
// Same as above but gets position in list of strings, instead of string,
|
||||
// or -1 if no selection
|
||||
WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
|
||||
int n, const wxString *choices, wxWindow *parent = (wxWindow *) NULL,
|
||||
int x = -1, int y = -1, bool centre = TRUE,
|
||||
int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
|
||||
|
||||
WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
|
||||
int n, wxChar *choices[], wxWindow *parent = (wxWindow *) NULL,
|
||||
int x = -1, int y = -1, bool centre = TRUE,
|
||||
int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
|
||||
|
||||
// Return client data instead
|
||||
// FIXME: this is horrible, using "char *" instead of "void *" belongs to the 70s!
|
||||
WXDLLEXPORT wxChar* wxGetSingleChoiceData(const wxString& message, const wxString& caption,
|
||||
int n, const wxString *choices, char **client_data,
|
||||
wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1,
|
||||
bool centre = TRUE,
|
||||
int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
|
||||
|
||||
WXDLLEXPORT wxChar* wxGetSingleChoiceData(const wxString& message, const wxString& caption,
|
||||
int n, wxChar *choices[], char **client_data,
|
||||
wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1,
|
||||
bool centre = TRUE,
|
||||
int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
|
||||
|
||||
/*
|
||||
WXDLLEXPORT int wxGetMultipleChoice(const wxString& message, const wxString& caption,
|
||||
int n, const wxString *choices,
|
||||
int nsel, int * selection,
|
||||
wxWindow *parent = NULL, int x = -1 , int y = -1, bool centre = TRUE,
|
||||
int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
|
||||
*/
|
||||
|
||||
#endif
|
120
include/wx/generic/colrdlgg.h
Normal file
120
include/wx/generic/colrdlgg.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: colrdlgg.h
|
||||
// Purpose: wxGenericColourDialog
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __COLORDLGH_G__
|
||||
#define __COLORDLGH_G__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "colrdlgg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/cmndata.h"
|
||||
|
||||
#define wxID_ADD_CUSTOM 3000
|
||||
#define wxID_RED_SLIDER 3001
|
||||
#define wxID_GREEN_SLIDER 3002
|
||||
#define wxID_BLUE_SLIDER 3003
|
||||
|
||||
class WXDLLEXPORT wxSlider;
|
||||
class WXDLLEXPORT wxGenericColourDialog: public wxDialog
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxGenericColourDialog)
|
||||
protected:
|
||||
wxColourData colourData;
|
||||
wxWindow *dialogParent;
|
||||
|
||||
// Area reserved for grids of colours
|
||||
wxRect standardColoursRect;
|
||||
wxRect customColoursRect;
|
||||
wxRect singleCustomColourRect;
|
||||
|
||||
// Size of each colour rectangle
|
||||
wxPoint smallRectangleSize;
|
||||
|
||||
// For single customizable colour
|
||||
wxPoint customRectangleSize;
|
||||
|
||||
// Grid spacing (between rectangles)
|
||||
int gridSpacing;
|
||||
|
||||
// Section spacing (between left and right halves of dialog box)
|
||||
int sectionSpacing;
|
||||
|
||||
// 48 'standard' colours
|
||||
wxColour standardColours[48];
|
||||
|
||||
// 16 'custom' colours
|
||||
wxColour customColours[16];
|
||||
|
||||
// One single custom colour (use sliders)
|
||||
wxColour singleCustomColour;
|
||||
|
||||
// Which colour is selected? An index into one of the two areas.
|
||||
int colourSelection;
|
||||
int whichKind; // 1 for standard colours, 2 for custom colours,
|
||||
|
||||
wxSlider *redSlider;
|
||||
wxSlider *greenSlider;
|
||||
wxSlider *blueSlider;
|
||||
|
||||
int buttonY;
|
||||
|
||||
int okButtonX;
|
||||
int customButtonX;
|
||||
|
||||
// static bool colourDialogCancelled;
|
||||
public:
|
||||
wxGenericColourDialog(void);
|
||||
wxGenericColourDialog(wxWindow *parent, wxColourData *data = (wxColourData *) NULL);
|
||||
~wxGenericColourDialog(void);
|
||||
|
||||
bool Create(wxWindow *parent, wxColourData *data = (wxColourData *) NULL);
|
||||
|
||||
int ShowModal(void);
|
||||
wxColourData &GetColourData(void) { return colourData; }
|
||||
|
||||
// Internal functions
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
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);
|
||||
|
||||
virtual void OnBasicColourClick(int which);
|
||||
virtual void OnCustomColourClick(int which);
|
||||
|
||||
void OnAddCustom(wxCommandEvent& event);
|
||||
|
||||
void OnRedSlider(wxCommandEvent& event);
|
||||
void OnGreenSlider(wxCommandEvent& event);
|
||||
void OnBlueSlider(wxCommandEvent& event);
|
||||
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/* This shouldn't be necessary, we have a #define in wx/colordlg.h.
|
||||
#ifdef __WXGTK__
|
||||
typedef wxGenericColourDialog wxColourDialog;
|
||||
#endif
|
||||
*/
|
||||
|
||||
#endif
|
32
include/wx/generic/cross.xpm
Normal file
32
include/wx/generic/cross.xpm
Normal file
@@ -0,0 +1,32 @@
|
||||
/* XPM */
|
||||
static char *cross_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"10 10 16 1",
|
||||
" c Gray0",
|
||||
". c #bf0000",
|
||||
"X c #00bf00",
|
||||
"o c #bfbf00",
|
||||
"O c #0000bf",
|
||||
"+ c #bf00bf",
|
||||
"@ c #00bfbf",
|
||||
"# c None",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
" ######## ",
|
||||
" #### ",
|
||||
"# ## #",
|
||||
"## ##",
|
||||
"### ###",
|
||||
"### ###",
|
||||
"## ##",
|
||||
"# ## #",
|
||||
" #### ",
|
||||
" ###### "
|
||||
};
|
281
include/wx/generic/dcpsg.h
Normal file
281
include/wx/generic/dcpsg.h
Normal file
@@ -0,0 +1,281 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dcps.h
|
||||
// Purpose: wxPostScriptDC class
|
||||
// Author: Julian Smart and others
|
||||
// Modified by:
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart, Robert Roebling and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DCPSG_H_
|
||||
#define _WX_DCPSG_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/dc.h"
|
||||
|
||||
#if wxUSE_PRINTING_ARCHITECTURE
|
||||
|
||||
#if wxUSE_POSTSCRIPT
|
||||
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/module.h"
|
||||
#include "wx/cmndata.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxPostScriptDC;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxPostScriptDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPostScriptDC: public wxDC
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPostScriptDC)
|
||||
|
||||
public:
|
||||
|
||||
wxPostScriptDC();
|
||||
|
||||
// Deprecated constructor
|
||||
wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
|
||||
|
||||
// Recommended constructor
|
||||
wxPostScriptDC(const wxPrintData& printData);
|
||||
|
||||
~wxPostScriptDC();
|
||||
|
||||
// Deprecated
|
||||
bool Create(const wxString& output, bool interactive = TRUE, wxWindow *parent = (wxWindow *) NULL);
|
||||
|
||||
virtual bool Ok() const;
|
||||
|
||||
// Deprecated: use wxGenericPrintDialog instead
|
||||
virtual bool PrinterDialog(wxWindow *parent = (wxWindow *) NULL);
|
||||
|
||||
virtual void BeginDrawing() {}
|
||||
virtual void EndDrawing() {}
|
||||
|
||||
void DoFloodFill(long x1, long y1, const wxColour &col, int style=wxFLOOD_SURFACE );
|
||||
bool DoGetPixel(long x1, long y1, wxColour *col) const;
|
||||
|
||||
void DoDrawLine(long x1, long y1, long x2, long y2);
|
||||
void DoCrossHair(long x, long y) ;
|
||||
void DoDrawArc(long x1,long y1,long x2,long y2,long xc,long yc);
|
||||
void DoDrawEllipticArc(long x,long y,long w,long h,double sa,double ea);
|
||||
void DoDrawPoint(long x, long y);
|
||||
void DoDrawLines(int n, wxPoint points[], long xoffset = 0, long yoffset = 0);
|
||||
void DoDrawPolygon(int n, wxPoint points[], long xoffset = 0, long yoffset = 0, int fillStyle=wxODDEVEN_RULE);
|
||||
void DoDrawRectangle(long x, long y, long width, long height);
|
||||
void DoDrawRoundedRectangle(long x, long y, long width, long height, double radius = 20);
|
||||
void DoDrawEllipse(long x, long y, long width, long height);
|
||||
|
||||
void DoDrawSpline(wxList *points);
|
||||
|
||||
bool DoBlit(long xdest, long ydest, long width, long height,
|
||||
wxDC *source, long xsrc, long ysrc, int rop = wxCOPY, bool useMask = FALSE);
|
||||
inline bool CanDrawBitmap(void) const { return TRUE; }
|
||||
|
||||
void DoDrawIcon( const wxIcon& icon, long x, long y );
|
||||
void DoDrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask=FALSE );
|
||||
|
||||
void DoDrawText(const wxString& text, long x, long y );
|
||||
|
||||
void Clear();
|
||||
void SetFont( const wxFont& font );
|
||||
void SetPen( const wxPen& pen );
|
||||
void SetBrush( const wxBrush& brush );
|
||||
void SetLogicalFunction( int function );
|
||||
void SetBackground( const wxBrush& brush );
|
||||
|
||||
void SetClippingRegion(long x, long y, long width, long height);
|
||||
void SetClippingRegion( const wxRegion ®ion );
|
||||
void DestroyClippingRegion();
|
||||
|
||||
void DoSetClippingRegionAsRegion( const wxRegion &WXUNUSED(clip) ) {}
|
||||
|
||||
bool StartDoc(const wxString& message);
|
||||
void EndDoc();
|
||||
void StartPage();
|
||||
void EndPage();
|
||||
|
||||
long GetCharHeight() const;
|
||||
long GetCharWidth() const;
|
||||
inline bool CanGetTextExtent(void) const { return FALSE; }
|
||||
void GetTextExtent(const wxString& string, long *x, long *y,
|
||||
long *descent = (long *) NULL,
|
||||
long *externalLeading = (long *) NULL,
|
||||
wxFont *theFont = (wxFont *) NULL ) const;
|
||||
|
||||
void DoGetSize(int* width, int* height) const;
|
||||
void DoGetSizeMM(int *width, int *height) const;
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize GetPPI(void) const;
|
||||
|
||||
void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
|
||||
void SetDeviceOrigin( long x, long y );
|
||||
|
||||
inline void SetBackgroundMode(int WXUNUSED(mode)) {}
|
||||
inline void SetPalette(const wxPalette& WXUNUSED(palette)) {}
|
||||
|
||||
wxPrintData& GetPrintData() { return m_printData; }
|
||||
void SetPrintData(const wxPrintData& data) { m_printData = data; }
|
||||
|
||||
virtual int GetDepth() const { return 24; }
|
||||
|
||||
protected:
|
||||
|
||||
FILE* m_pstream; // PostScript output stream
|
||||
wxString m_title;
|
||||
unsigned char m_currentRed;
|
||||
unsigned char m_currentGreen;
|
||||
unsigned char m_currentBlue;
|
||||
int m_pageNumber;
|
||||
bool m_clipping;
|
||||
double m_underlinePosition;
|
||||
double m_underlineThickness;
|
||||
wxPrintData m_printData;
|
||||
};
|
||||
|
||||
// Deprecated: should use wxGenericPrintDialog instead.
|
||||
#if 1
|
||||
#define wxID_PRINTER_COMMAND 1
|
||||
#define wxID_PRINTER_OPTIONS 2
|
||||
#define wxID_PRINTER_ORIENTATION 3
|
||||
#define wxID_PRINTER_MODES 4
|
||||
#define wxID_PRINTER_X_SCALE 5
|
||||
#define wxID_PRINTER_Y_SCALE 6
|
||||
#define wxID_PRINTER_X_TRANS 7
|
||||
#define wxID_PRINTER_Y_TRANS 8
|
||||
|
||||
class WXDLLEXPORT wxPostScriptPrintDialog: public wxDialog
|
||||
{
|
||||
DECLARE_CLASS(wxPostScriptPrintDialog)
|
||||
public:
|
||||
wxPostScriptPrintDialog (wxWindow *parent, const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE);
|
||||
|
||||
virtual int ShowModal(void) ;
|
||||
};
|
||||
#endif
|
||||
|
||||
// Print Orientation (Should also add Left, Right)
|
||||
enum
|
||||
{
|
||||
PS_PORTRAIT = 1,
|
||||
PS_LANDSCAPE = 2
|
||||
};// ps_orientation = PS_PORTRAIT;
|
||||
|
||||
// Print Actions
|
||||
enum
|
||||
{
|
||||
PS_NONE,
|
||||
PS_PREVIEW,
|
||||
PS_FILE,
|
||||
PS_PRINTER
|
||||
};// ps_action = PS_PREVIEW;
|
||||
|
||||
// PostScript printer settings
|
||||
WXDLLEXPORT void wxSetPrinterCommand(const wxString& cmd);
|
||||
WXDLLEXPORT void wxSetPrintPreviewCommand(const wxString& cmd);
|
||||
WXDLLEXPORT void wxSetPrinterOptions(const wxString& flags);
|
||||
WXDLLEXPORT void wxSetPrinterOrientation(int orientation);
|
||||
WXDLLEXPORT void wxSetPrinterScaling(double x, double y);
|
||||
WXDLLEXPORT void wxSetPrinterTranslation(long x, long y);
|
||||
WXDLLEXPORT void wxSetPrinterMode(int mode);
|
||||
WXDLLEXPORT void wxSetPrinterFile(const wxString& f);
|
||||
WXDLLEXPORT void wxSetAFMPath(const wxString& f);
|
||||
|
||||
// Get current values
|
||||
WXDLLEXPORT wxString wxGetPrinterCommand();
|
||||
WXDLLEXPORT wxString wxGetPrintPreviewCommand();
|
||||
WXDLLEXPORT wxString wxGetPrinterOptions();
|
||||
WXDLLEXPORT int wxGetPrinterOrientation();
|
||||
WXDLLEXPORT void wxGetPrinterScaling(double* x, double* y);
|
||||
WXDLLEXPORT void wxGetPrinterTranslation(long *x, long *y);
|
||||
WXDLLEXPORT int wxGetPrinterMode();
|
||||
WXDLLEXPORT wxString wxGetPrinterFile();
|
||||
WXDLLEXPORT wxString wxGetAFMPath();
|
||||
|
||||
/*
|
||||
* PostScript print setup information.
|
||||
* This is now obsolete, but retained for a while for compatibility
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxPrintSetupData: public wxObject
|
||||
{
|
||||
public:
|
||||
wxPrintSetupData();
|
||||
~wxPrintSetupData();
|
||||
|
||||
void SetPrinterCommand(const wxString& cmd) { m_printerCommand = cmd; };
|
||||
void SetPaperName(const wxString& paper) { m_paperName = paper; };
|
||||
void SetPrintPreviewCommand(const wxString& cmd) { m_previewCommand = cmd; };
|
||||
void SetPrinterOptions(const wxString& flags) { m_printerFlags = flags; };
|
||||
void SetPrinterFile(const wxString& f) { m_printerFile = f; };
|
||||
void SetPrinterOrientation(int orient) { m_printerOrient = orient; };
|
||||
void SetPrinterScaling(double x, double y) { m_printerScaleX = x; m_printerScaleY = y; };
|
||||
void SetPrinterTranslation(long x, long y) { m_printerTranslateX = x; m_printerTranslateY = y; };
|
||||
// 1 = Preview, 2 = print to file, 3 = send to printer
|
||||
void SetPrinterMode(int mode) { m_printerMode = mode; };
|
||||
void SetAFMPath(const wxString& f) { m_afmPath = f; };
|
||||
void SetColour(bool col) { m_printColour = col; };
|
||||
|
||||
// Get current values
|
||||
wxString GetPrinterCommand() const { return m_printerCommand; } ;
|
||||
wxString GetPrintPreviewCommand() const { return m_previewCommand; } ;
|
||||
wxString GetPrinterOptions() const { return m_printerFlags; };
|
||||
wxString GetPrinterFile() const { return m_printerFile; };
|
||||
wxString GetPaperName() const { return m_paperName; }
|
||||
int GetPrinterOrientation() const { return m_printerOrient; };
|
||||
void GetPrinterScaling(double* x, double* y) const { *x = m_printerScaleX; *y = m_printerScaleY; };
|
||||
void GetPrinterTranslation(long *x, long *y) const { *x = m_printerTranslateX; *y = m_printerTranslateY; };
|
||||
int GetPrinterMode() const { return m_printerMode; };
|
||||
wxString GetAFMPath() const { return m_afmPath; };
|
||||
bool GetColour() const { return m_printColour; };
|
||||
|
||||
void operator=(wxPrintSetupData& data);
|
||||
|
||||
// Initialize from a wxPrintData object (wxPrintData should now be used instead of wxPrintSetupData).
|
||||
// There is also an operator for initializing a wxPrintData from a wxPrintSetupData.
|
||||
void operator=(const wxPrintData& data);
|
||||
|
||||
public:
|
||||
wxString m_printerCommand;
|
||||
wxString m_previewCommand;
|
||||
wxString m_printerFlags;
|
||||
wxString m_printerFile;
|
||||
int m_printerOrient;
|
||||
double m_printerScaleX;
|
||||
double m_printerScaleY;
|
||||
long m_printerTranslateX;
|
||||
long m_printerTranslateY;
|
||||
// 1 = Preview, 2 = print to file, 3 = send to printer
|
||||
int m_printerMode;
|
||||
wxString m_afmPath;
|
||||
// A name in the paper database (see paper.h)
|
||||
wxString m_paperName;
|
||||
bool m_printColour;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxPrintSetupData)
|
||||
};
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxPrintSetupData*) wxThePrintSetupData;
|
||||
WXDLLEXPORT extern void wxInitializePrintSetupData(bool init = TRUE);
|
||||
|
||||
#endif
|
||||
// wxUSE_POSTSCRIPT
|
||||
|
||||
#endif
|
||||
// wxUSE_PRINTING_ARCHITECTURE
|
||||
|
||||
#endif
|
||||
// _WX_DCPSG_H_
|
42
include/wx/generic/dir_up.xpm
Normal file
42
include/wx/generic/dir_up.xpm
Normal file
@@ -0,0 +1,42 @@
|
||||
/* XPM */
|
||||
static char *dir_up_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"20 20 16 1",
|
||||
" c Gray0",
|
||||
". c #800000",
|
||||
"X c #008000",
|
||||
"o c #808000",
|
||||
"O c #000080",
|
||||
"+ c #800080",
|
||||
"@ c #008080",
|
||||
"# c None",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"####################",
|
||||
"####################",
|
||||
"####################",
|
||||
"#### ###########",
|
||||
"### *:*:* ##########",
|
||||
"## ####",
|
||||
"## :*:*:*:*:*:*: ###",
|
||||
"## *:*: :*:*:*:* ###",
|
||||
"## :*: :*:*:*: ###",
|
||||
"## *: :*:*:* ###",
|
||||
"## :*:* *:*:*:*: ###",
|
||||
"## *:*: :*:*:*:* ###",
|
||||
"## :*:* :*: ###",
|
||||
"## *:*:*:*:*:*:* ###",
|
||||
"## :*:*:*:*:*:*: ###",
|
||||
"## ###",
|
||||
"####################",
|
||||
"####################",
|
||||
"####################",
|
||||
"####################",
|
||||
};
|
177
include/wx/generic/dirdlgg.h
Normal file
177
include/wx/generic/dirdlgg.h
Normal file
@@ -0,0 +1,177 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dirdlgg.h
|
||||
// Purpose: wxDirDialog
|
||||
// Author: Harm van der Heijden and Robert Roebling
|
||||
// Modified by:
|
||||
// Created: 12/12/98
|
||||
// Copyright: (c) Harm van der Heijden and Robert Roebling
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows licence
|
||||
//
|
||||
// Notes: wxDirDialog class written by Harm van der Heijden,
|
||||
// uses wxDirCtrl class written by Robert Roebling for the
|
||||
// wxFile application, modified by Harm van der Heijden
|
||||
//
|
||||
// Description: This generic dirdialog implementation defines three classes:
|
||||
// 1) wxDirItemData(public wxTreeItemData) stores pathname and
|
||||
// displayed name for each item in the directory tree
|
||||
// 2) wxDirCtrl(public wxTreeCtrl) is a tree widget that
|
||||
// displays a directory tree. It is possible to define sections
|
||||
// for fast access to parts of the file system (such as the
|
||||
// user's homedir, /usr/local, /tmp ...etc), similar to
|
||||
// Win95 Explorer's shortcuts to 'My Computer', 'Desktop', etc.
|
||||
// 3) wxDirDialog is the dialog box itself. The user can choose
|
||||
// a directory by navigating the tree, or by typing a dir
|
||||
// in an inputbox. The inputbox displays paths selected in the
|
||||
// tree. It is possible to create new directories. The user
|
||||
// will automatically be prompted for dir creation if he
|
||||
// enters a non-existing dir.
|
||||
//
|
||||
// TODO/BUGS: - standard sections only have reasonable defaults for Unix
|
||||
// (but others are easily added in wxDirCtrl::SetupSections)
|
||||
// - No direct support for "show hidden" toggle. Partly due
|
||||
// to laziness on my part and partly because
|
||||
// wxFindFirst/NextFile never seems to find hidden dirs
|
||||
// anyway.
|
||||
// - No automatic update of the tree (branch) after directory
|
||||
// creation.
|
||||
// - I call wxBeginBusyCursor while expanding items (creating
|
||||
// a new branch might take a few seconds, especially if a
|
||||
// CDROM drive or something is involved) but that doesn't
|
||||
// seem to do anything. Need to look into that.
|
||||
// - Am still looking for an efficient way to delete wxTreeCtrl
|
||||
// branches. DeleteChildren has disappeared and
|
||||
// CollapseAndReset( parent ) deletes the parent as well.
|
||||
// - The dialog window layout is done using wxConstraints. It
|
||||
// works, but it's not as simple as I'd like it to be (see
|
||||
// comments in wxDirDialog::doSize)
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DIRDLGG_H_
|
||||
#define _WX_DIRDLGG_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dirdlgg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_DIRDLG
|
||||
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/treectrl.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxFileSelectorPromptStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxDirDialogDefaultFolderStr;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxDirItemData;
|
||||
class wxDirCtrl;
|
||||
class wxDirDialog;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDirItemData
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDirItemData : public wxTreeItemData
|
||||
{
|
||||
public:
|
||||
wxDirItemData(wxString& path, wxString& name);
|
||||
~wxDirItemData();
|
||||
bool HasSubDirs();
|
||||
void SetNewDirName( wxString path );
|
||||
wxString m_path, m_name;
|
||||
bool m_isHidden;
|
||||
bool m_hasSubDirs;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDirCtrl
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDirCtrl: public wxTreeCtrl
|
||||
{
|
||||
public:
|
||||
bool m_showHidden;
|
||||
wxTreeItemId m_rootId;
|
||||
|
||||
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 );
|
||||
void ShowHidden( const bool yesno );
|
||||
void OnExpandItem(wxTreeEvent &event );
|
||||
void OnCollapseItem(wxTreeEvent &event );
|
||||
void OnBeginEditItem(wxTreeEvent &event );
|
||||
void OnEndEditItem(wxTreeEvent &event );
|
||||
|
||||
protected:
|
||||
void CreateItems(const wxTreeItemId &parent);
|
||||
void SetupSections();
|
||||
wxArrayString m_paths, m_names;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxDirCtrl)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDirDialog
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDirDialog: public wxDialog
|
||||
{
|
||||
public:
|
||||
wxDirDialog(wxWindow *parent,
|
||||
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; }
|
||||
|
||||
inline wxString GetMessage() const { return m_message; }
|
||||
inline wxString GetPath() const { return m_path; }
|
||||
inline long GetStyle() const { return m_dialogStyle; }
|
||||
|
||||
int ShowModal();
|
||||
|
||||
void OnTreeSelected( wxTreeEvent &event );
|
||||
void OnTreeKeyDown( wxTreeEvent &event );
|
||||
void OnOK(wxCommandEvent& event);
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
void OnNew(wxCommandEvent& event);
|
||||
// void OnCheck(wxCommandEvent& event);
|
||||
|
||||
protected:
|
||||
// implementation
|
||||
wxString m_message;
|
||||
long m_dialogStyle;
|
||||
wxString m_path;
|
||||
wxDirCtrl *m_dir;
|
||||
wxTextCtrl *m_input;
|
||||
wxCheckBox *m_check; // not yet used
|
||||
wxButton *m_ok, *m_cancel, *m_new;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxDirDialog)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_DIRDLGG_H_
|
||||
|
129
include/wx/generic/error.xpm
Normal file
129
include/wx/generic/error.xpm
Normal file
@@ -0,0 +1,129 @@
|
||||
/* XPM */
|
||||
static char * error_xpm[] = {
|
||||
"48 48 78 1",
|
||||
" c None",
|
||||
". c #000000",
|
||||
"+ c #200000",
|
||||
"@ c #4A0000",
|
||||
"# c #6B0000",
|
||||
"$ c #8F0000",
|
||||
"% c #890000",
|
||||
"& c #5F0000",
|
||||
"* c #380000",
|
||||
"= c #0E0000",
|
||||
"- c #030000",
|
||||
"; c #480000",
|
||||
"> c #9C0000",
|
||||
", c #E40000",
|
||||
"' c #FE0000",
|
||||
") c #FF0000",
|
||||
"! c #C90000",
|
||||
"~ c #7E0000",
|
||||
"{ c #250000",
|
||||
"] c #090000",
|
||||
"^ c #700000",
|
||||
"/ c #DE0000",
|
||||
"( c #FB0000",
|
||||
"_ c #BB0000",
|
||||
": c #410000",
|
||||
"< c #500000",
|
||||
"[ c #DF0000",
|
||||
"} c #B00000",
|
||||
"| c #0D0000",
|
||||
"1 c #AB0000",
|
||||
"2 c #F60000",
|
||||
"3 c #600000",
|
||||
"4 c #010000",
|
||||
"5 c #220000",
|
||||
"6 c #DA0000",
|
||||
"7 c #950000",
|
||||
"8 c #070000",
|
||||
"9 c #350000",
|
||||
"0 c #F00000",
|
||||
"a c #BD0000",
|
||||
"b c #080000",
|
||||
"c c #B10000",
|
||||
"d c #880000",
|
||||
"e c #FD0000",
|
||||
"f c #4D0000",
|
||||
"g c #0B0000",
|
||||
"h c #F50000",
|
||||
"i c #1A0000",
|
||||
"j c #820000",
|
||||
"k c #E30000",
|
||||
"l c #040000",
|
||||
"m c #3C0000",
|
||||
"n c #FEAFAF",
|
||||
"o c #FFFEFE",
|
||||
"p c #FEFEFE",
|
||||
"q c #FF7F7F",
|
||||
"r c #840000",
|
||||
"s c #FFAFAF",
|
||||
"t c #FFFFFF",
|
||||
"u c #C00000",
|
||||
"v c #EA0000",
|
||||
"w c #2F0000",
|
||||
"x c #290000",
|
||||
"y c #D80000",
|
||||
"z c #AE0000",
|
||||
"A c #FE6D6D",
|
||||
"B c #FF9F9F",
|
||||
"C c #FE9F9F",
|
||||
"D c #FF4F4F",
|
||||
"E c #690000",
|
||||
"F c #C10000",
|
||||
"G c #5B0000",
|
||||
"H c #050000",
|
||||
"I c #B70000",
|
||||
"J c #E50000",
|
||||
"K c #F40000",
|
||||
"L c #420000",
|
||||
"M c #650000",
|
||||
" ",
|
||||
" ",
|
||||
" ..+@#$$$%&*=. ",
|
||||
" -;>,''''''))))!~{. ",
|
||||
" ]^/'''''''''))))))(_:. ",
|
||||
" .<['''''''''''))))))))'}+. ",
|
||||
" |1'''''''''''''))))))))))234 ",
|
||||
" 56)'''''''''''''))))))))))))78 ",
|
||||
" 90))''''''''''''')))))))))))))ab ",
|
||||
" 50)))'''''''''''''))))))))))))))c4 ",
|
||||
" |6))))''''''''''''')))))))))))))))d. ",
|
||||
" .1'))))''''''''''''')))))))))))))))ef ",
|
||||
" <''))))''''''''''''')))))))))))))))),g ",
|
||||
" ][')))))''''''''''''')))))))))))))))))%. ",
|
||||
" ^'''))))''''''''''''')))))))))))))))))hi ",
|
||||
" -/'''))))'''''''''''''))))))))))))))))))j ",
|
||||
" ;)'')))))'''''''''''''))))))))))))))))))kl ",
|
||||
" >''''))))''''''''''''')))))))))))))))))))m ",
|
||||
" .,'''noooopppppppppppppoooooooooooooooq)))r ",
|
||||
" +))')sttttppppppppppppptttttttttttttttq)))u. ",
|
||||
" @''''nttttppppppppppppptttttttttttttttq)))v. ",
|
||||
" #))''nttttppppppppppppptttttttttttttttq))))g ",
|
||||
" $)'''nttttppppppppppppptttttttttttttttq))))w ",
|
||||
" $''''nttttppppppppppppptttttttttttttttq))))w ",
|
||||
" $)'''nttttppppppppppppptttttttttttttttq))))w ",
|
||||
" %)'''nttttppppppppppppptttttttttttttttq))))x ",
|
||||
" &''''nttttppppppppppppptttttttttttttttq)))). ",
|
||||
" *)'''nttttppppppppppppptttttttttttttttq)))y. ",
|
||||
" =))''sttttppppppppppppptttttttttttttttq)))z ",
|
||||
" .!'''ABBBBCCCCCCCCCCCCCBBBBBBBBBBBBBBBD)))E ",
|
||||
" ~''''))))'''''''''''''))))))))))))))))))e+ ",
|
||||
" {('))))))'''''''''''''))))))))))))))))))F. ",
|
||||
" ._'''))))'''''''''''''))))))))))))))))))G ",
|
||||
" :'''))))''''''''''''')))))))))))))))))6H ",
|
||||
" .}))))))''''''''''''')))))))))))))))))< ",
|
||||
" +2'))))'''''''''''''))))))))))))))))I. ",
|
||||
" .3)))))''''''''''''')))))))))))))))Ji ",
|
||||
" 47))))'''''''''''''))))))))))))))KL ",
|
||||
" 8a)))'''''''''''''))))))))))))))M. ",
|
||||
" bc))'''''''''''''))))))))))))KM. ",
|
||||
" 4de''''''''''''')))))))))))JL. ",
|
||||
" .f,''''''''''''))))))))))Ii ",
|
||||
" g%h''''''''''))))))))6<. ",
|
||||
" .ijk'''''''')))))eFGH ",
|
||||
" .lmruv''''))yzE+. ",
|
||||
" ..gwwwx... ",
|
||||
" ",
|
||||
" "};
|
240
include/wx/generic/filedlgg.h
Normal file
240
include/wx/generic/filedlgg.h
Normal file
@@ -0,0 +1,240 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: filedlgg.h
|
||||
// Purpose: wxFileDialog
|
||||
// Author: Robert Roebling
|
||||
// Modified by:
|
||||
// Created: 8/17/99
|
||||
// Copyright: (c) Robert Roebling
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_FILEDLGG_H_
|
||||
#define _WX_FILEDLGG_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "filedlgg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/listctrl.h"
|
||||
#include "wx/textctrl.h"
|
||||
#include "wx/choice.h"
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/stattext.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar *)wxFileSelectorPromptStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar *)wxFileSelectorDefaultWildcardStr;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxFileData;
|
||||
class wxFileCtrl;
|
||||
class wxFileDialog;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxFileData
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxFileData : public wxObject
|
||||
{
|
||||
private:
|
||||
wxString m_name;
|
||||
wxString m_fileName;
|
||||
long m_size;
|
||||
int m_hour;
|
||||
int m_minute;
|
||||
int m_year;
|
||||
int m_month;
|
||||
int m_day;
|
||||
wxString m_permissions;
|
||||
bool m_isDir;
|
||||
bool m_isLink;
|
||||
bool m_isExe;
|
||||
|
||||
public:
|
||||
wxFileData() { }
|
||||
wxFileData( const wxString &name, const wxString &fname );
|
||||
wxString GetName() const;
|
||||
wxString GetFullName() const;
|
||||
wxString GetHint() const;
|
||||
wxString GetEntry( int num );
|
||||
bool IsDir();
|
||||
bool IsLink();
|
||||
bool IsExe();
|
||||
long GetSize();
|
||||
void MakeItem( wxListItem &item );
|
||||
void SetNewName( const wxString &name, const wxString &fname );
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxFileData);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxFileCtrl
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxFileCtrl : public wxListCtrl
|
||||
{
|
||||
private:
|
||||
wxString m_dirName;
|
||||
bool m_showHidden;
|
||||
wxString m_wild;
|
||||
|
||||
public:
|
||||
wxFileCtrl();
|
||||
wxFileCtrl( wxWindow *win,
|
||||
wxWindowID id,
|
||||
const wxString &dirName,
|
||||
const wxString &wild,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
const wxSize &size = wxDefaultSize,
|
||||
long style = wxLC_LIST,
|
||||
const wxValidator &validator = wxDefaultValidator,
|
||||
const wxString &name = wxT("filelist") );
|
||||
void ChangeToListMode();
|
||||
void ChangeToReportMode();
|
||||
void ChangeToIconMode();
|
||||
void ShowHidden( bool show = TRUE );
|
||||
long Add( wxFileData *fd, wxListItem &item );
|
||||
void Update();
|
||||
virtual void StatusbarText( char *WXUNUSED(text) ) {};
|
||||
void MakeDir();
|
||||
void GoToParentDir();
|
||||
void GoToHomeDir();
|
||||
void GoToDir( const wxString &dir );
|
||||
void SetWild( const wxString &wild );
|
||||
void GetDir( wxString &dir );
|
||||
void OnListDeleteItem( wxListEvent &event );
|
||||
void OnListEndLabelEdit( wxListEvent &event );
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxFileCtrl);
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// File selector
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class wxFileDialog: public wxDialog
|
||||
{
|
||||
public:
|
||||
wxFileDialog() { }
|
||||
|
||||
wxFileDialog(wxWindow *parent,
|
||||
const wxString& message = wxFileSelectorPromptStr,
|
||||
const wxString& defaultDir = "",
|
||||
const wxString& defaultFile = "",
|
||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||
long style = 0,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
~wxFileDialog();
|
||||
|
||||
void SetMessage(const wxString& message) { m_message = message; }
|
||||
void SetPath(const wxString& path);
|
||||
void SetDirectory(const wxString& dir) { m_dir = dir; }
|
||||
void SetFilename(const wxString& name) { m_fileName = name; }
|
||||
void SetWildcard(const wxString& wildCard) { m_wildCard = wildCard; }
|
||||
void SetStyle(long style) { m_dialogStyle = style; }
|
||||
void SetFilterIndex(int filterIndex) { m_filterIndex = filterIndex; }
|
||||
|
||||
wxString GetMessage() const { return m_message; }
|
||||
wxString GetPath() const { return m_path; }
|
||||
wxString GetDirectory() const { return m_dir; }
|
||||
wxString GetFilename() const { return m_fileName; }
|
||||
wxString GetWildcard() const { return m_wildCard; }
|
||||
long GetStyle() const { return m_dialogStyle; }
|
||||
int GetFilterIndex() const { return m_filterIndex ; }
|
||||
|
||||
void OnSelected( wxListEvent &event );
|
||||
void OnActivated( wxListEvent &event );
|
||||
void OnList( wxCommandEvent &event );
|
||||
void OnReport( wxCommandEvent &event );
|
||||
void OnUp( wxCommandEvent &event );
|
||||
void OnHome( wxCommandEvent &event );
|
||||
void OnListOk( wxCommandEvent &event );
|
||||
void OnNew( wxCommandEvent &event );
|
||||
void OnChoice( wxCommandEvent &event );
|
||||
void OnTextEnter( wxCommandEvent &event );
|
||||
|
||||
void HandleAction( const wxString &fn );
|
||||
|
||||
protected:
|
||||
wxString m_message;
|
||||
long m_dialogStyle;
|
||||
wxString m_dir;
|
||||
wxString m_path; // Full path
|
||||
wxString m_fileName;
|
||||
wxString m_wildCard;
|
||||
int m_filterIndex;
|
||||
wxChoice *m_choice;
|
||||
wxTextCtrl *m_text;
|
||||
wxFileCtrl *m_list;
|
||||
wxCheckBox *m_check;
|
||||
wxStaticText *m_static;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
wxOPEN = 1,
|
||||
wxSAVE = 2,
|
||||
wxOVERWRITE_PROMPT = 4,
|
||||
wxHIDE_READONLY = 8,
|
||||
wxFILE_MUST_EXIST = 16
|
||||
};
|
||||
|
||||
// File selector - backward compatibility
|
||||
WXDLLEXPORT wxString
|
||||
wxFileSelector(const wxChar *message = wxFileSelectorPromptStr,
|
||||
const wxChar *default_path = NULL,
|
||||
const wxChar *default_filename = NULL,
|
||||
const wxChar *default_extension = NULL,
|
||||
const wxChar *wildcard = wxFileSelectorDefaultWildcardStr,
|
||||
int flags = 0,
|
||||
wxWindow *parent = NULL,
|
||||
int x = -1, int y = -1);
|
||||
|
||||
// An extended version of wxFileSelector
|
||||
WXDLLEXPORT wxString
|
||||
wxFileSelectorEx(const wxChar *message = wxFileSelectorPromptStr,
|
||||
const wxChar *default_path = NULL,
|
||||
const wxChar *default_filename = NULL,
|
||||
int *indexDefaultExtension = NULL,
|
||||
const wxChar *wildcard = wxFileSelectorDefaultWildcardStr,
|
||||
int flags = 0,
|
||||
wxWindow *parent = NULL,
|
||||
int x = -1, int y = -1);
|
||||
|
||||
// Ask for filename to load
|
||||
WXDLLEXPORT wxString
|
||||
wxLoadFileSelector(const wxChar *what,
|
||||
const wxChar *extension,
|
||||
const wxChar *default_name = (const wxChar *)NULL,
|
||||
wxWindow *parent = (wxWindow *) NULL);
|
||||
|
||||
// Ask for filename to save
|
||||
WXDLLEXPORT wxString
|
||||
wxSaveFileSelector(const wxChar *what,
|
||||
const wxChar *extension,
|
||||
const wxChar *default_name = (const wxChar *) NULL,
|
||||
wxWindow *parent = (wxWindow *) NULL);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
// _WX_DIRDLGG_H_
|
||||
|
95
include/wx/generic/fontdlgg.h
Normal file
95
include/wx/generic/fontdlgg.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: fontdlgg.h
|
||||
// Purpose: wxGenericFontDialog
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __FONTDLGH_G__
|
||||
#define __FONTDLGH_G__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "fontdlgg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/font.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/cmndata.h"
|
||||
|
||||
/*
|
||||
* FONT DIALOG
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxChoice;
|
||||
class WXDLLEXPORT wxText;
|
||||
class WXDLLEXPORT wxCheckBox;
|
||||
|
||||
#define wxID_FONT_UNDERLINE 3000
|
||||
#define wxID_FONT_STYLE 3001
|
||||
#define wxID_FONT_WEIGHT 3002
|
||||
#define wxID_FONT_FAMILY 3003
|
||||
#define wxID_FONT_COLOUR 3004
|
||||
#define wxID_FONT_SIZE 3005
|
||||
|
||||
class WXDLLEXPORT wxGenericFontDialog: public wxDialog
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxGenericFontDialog)
|
||||
protected:
|
||||
wxFontData fontData;
|
||||
wxFont dialogFont;
|
||||
wxWindow *dialogParent;
|
||||
|
||||
// Area reserved for font display
|
||||
wxRect fontRect;
|
||||
|
||||
wxChoice *familyChoice;
|
||||
wxChoice *styleChoice;
|
||||
wxChoice *weightChoice;
|
||||
wxChoice *colourChoice;
|
||||
wxCheckBox *underLineCheckBox;
|
||||
wxChoice *pointSizeChoice;
|
||||
bool m_useEvents;
|
||||
|
||||
// static bool fontDialogCancelled;
|
||||
public:
|
||||
|
||||
wxGenericFontDialog(void);
|
||||
wxGenericFontDialog(wxWindow *parent, wxFontData *data = (wxFontData *) NULL);
|
||||
~wxGenericFontDialog(void);
|
||||
|
||||
bool Create(wxWindow *parent, wxFontData *data = (wxFontData *) NULL);
|
||||
|
||||
int ShowModal(void);
|
||||
|
||||
inline wxFontData& GetFontData(void) { return fontData; }
|
||||
|
||||
// Internal functions
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
|
||||
virtual void CreateWidgets(void);
|
||||
virtual void InitializeFont(void);
|
||||
|
||||
virtual void PaintFontBackground(wxDC& dc);
|
||||
virtual void PaintFont(wxDC& dc);
|
||||
|
||||
void OnChangeFont(wxCommandEvent& event);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
wxChar WXDLLEXPORT *wxFontFamilyIntToString(int family);
|
||||
wxChar WXDLLEXPORT *wxFontWeightIntToString(int weight);
|
||||
wxChar WXDLLEXPORT *wxFontStyleIntToString(int style);
|
||||
int WXDLLEXPORT wxFontFamilyStringToInt(wxChar *family);
|
||||
int WXDLLEXPORT wxFontWeightStringToInt(wxChar *weight);
|
||||
int WXDLLEXPORT wxFontStyleStringToInt(wxChar *style);
|
||||
|
||||
#endif
|
1086
include/wx/generic/grid.h
Normal file
1086
include/wx/generic/grid.h
Normal file
File diff suppressed because it is too large
Load Diff
424
include/wx/generic/gridg.h
Normal file
424
include/wx/generic/gridg.h
Normal file
@@ -0,0 +1,424 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: gridg.h
|
||||
// Purpose: wxGenericGrid
|
||||
// Author: Julian Smart
|
||||
// Modified by: Michael Bedward
|
||||
// Added edit in place facility, 20 April 1999
|
||||
// Added cursor key control, 29 Jun 1999
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __GRIDH_G__
|
||||
#define __GRIDH_G__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "gridg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/panel.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/scrolbar.h"
|
||||
#include "wx/event.h"
|
||||
|
||||
#define wxGRID_DEFAULT_EDIT_WIDTH 300
|
||||
#define wxGRID_DEFAULT_EDIT_HEIGHT 27
|
||||
#define wxGRID_DEFAULT_EDIT_X 2
|
||||
#define wxGRID_DEFAULT_EDIT_Y 1
|
||||
#define wxGRID_DEFAULT_SHEET_TOP 31
|
||||
#define wxGRID_DEFAULT_SHEET_LEFT 0
|
||||
#define wxGRID_DEFAULT_CELL_HEIGHT 20
|
||||
#define wxGRID_DEFAULT_CELL_WIDTH 80
|
||||
#define wxGRID_DEFAULT_VERTICAL_LABEL_WIDTH 40
|
||||
#define wxGRID_DEFAULT_HORIZONAL_LABEL_HEIGHT 20
|
||||
|
||||
#define WXGENERIC_GRID_VERSION 0.5
|
||||
|
||||
class WXDLLEXPORT wxGridEvent;
|
||||
class WXDLLEXPORT wxGridCell;
|
||||
|
||||
class WXDLLEXPORT wxGenericGrid : public wxPanel
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxGenericGrid)
|
||||
|
||||
public:
|
||||
wxGenericGrid();
|
||||
|
||||
wxGenericGrid(wxWindow *parent, int x, int y, int width, int height, long style = 0, char *name = "grid")
|
||||
{
|
||||
Create(parent, -1, wxPoint(x, y), wxSize(width, height), style, name);
|
||||
}
|
||||
wxGenericGrid(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style = 0, const wxString& name = "grid")
|
||||
{
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
~wxGenericGrid();
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID, const wxPoint& pos, const wxSize& size, long style = 0, const wxString& name = "grid");
|
||||
|
||||
bool CreateGrid(int nRows, int nCols, wxString **cellValues = (wxString **) NULL, short *widths = (short *) NULL,
|
||||
short defaultWidth = wxGRID_DEFAULT_CELL_WIDTH, short defaultHeight = wxGRID_DEFAULT_CELL_HEIGHT);
|
||||
void PaintGrid(wxDC& dc);
|
||||
void ClearGrid();
|
||||
virtual wxGridCell *GetCell(int row, int col) const;
|
||||
wxGridCell ***GetCells() const { return m_gridCells; }
|
||||
bool InsertCols(int pos = 0, int n = 1, bool updateLabels = TRUE);
|
||||
bool InsertRows(int pos = 0, int n = 1, bool updateLabels = TRUE);
|
||||
bool AppendCols(int n = 1, bool updateLabels = TRUE);
|
||||
bool AppendRows(int n = 1, bool updateLabels = TRUE);
|
||||
bool DeleteCols(int pos = 0, int n = 1, bool updateLabels = TRUE);
|
||||
bool DeleteRows(int pos = 0, int n = 1, bool updateLabels = TRUE);
|
||||
|
||||
// Cell accessors
|
||||
void SetCellValue(const wxString& val, int row, int col);
|
||||
wxString& GetCellValue(int row, int col) const;
|
||||
void SetCellAlignment(int flag, int row, int col);
|
||||
void SetCellAlignment(int flag);
|
||||
int GetCellAlignment(int row, int col) const;
|
||||
int GetCellAlignment() const;
|
||||
void SetCellTextColour(const wxColour& val, int row, int col);
|
||||
void SetCellTextColour(const wxColour& col);
|
||||
wxColour& GetCellTextColour(int row, int col) const;
|
||||
wxColour& GetCellTextColour() const { return (wxColour&) m_cellTextColour; }
|
||||
void SetCellBackgroundColour(const wxColour& col);
|
||||
void SetCellBackgroundColour(const wxColour& colour, int row, int col);
|
||||
wxColour& GetCellBackgroundColour() const { return (wxColour&) m_cellBackgroundColour; }
|
||||
wxColour& GetCellBackgroundColour(int row, int col) const;
|
||||
wxFont& GetCellTextFont() const { return (wxFont&) m_cellTextFont; }
|
||||
wxFont& GetCellTextFont(int row, int col) const;
|
||||
void SetCellTextFont(const wxFont& fnt);
|
||||
void SetCellTextFont(const wxFont& fnt, int row, int col);
|
||||
wxBitmap *GetCellBitmap(int row, int col) const;
|
||||
void SetCellBitmap(wxBitmap *bitmap, int row, int col);
|
||||
void *SetCellData(void *data, int row, int col);
|
||||
void *GetCellData(int row, int col);
|
||||
|
||||
// Size accessors
|
||||
void SetColumnWidth(int col, int width);
|
||||
int GetColumnWidth(int col) const;
|
||||
void SetRowHeight(int row, int height);
|
||||
int GetRowHeight(int row) const;
|
||||
int GetViewHeight() const { return m_viewHeight; }
|
||||
int GetViewWidth() const { return m_viewWidth; }
|
||||
|
||||
// Label accessors
|
||||
void SetLabelSize(int orientation, int sz);
|
||||
int GetLabelSize(int orientation) const;
|
||||
void SetLabelAlignment(int orientation, int alignment);
|
||||
int GetLabelAlignment(int orientation) const;
|
||||
wxGridCell *GetLabelCell(int orientation, int pos) const;
|
||||
void SetLabelValue(int orientation, const wxString& val, int pos);
|
||||
wxString& GetLabelValue(int orientation, int pos) const;
|
||||
void SetLabelTextColour(const wxColour& colour);
|
||||
void SetLabelBackgroundColour(const wxColour& colour);
|
||||
wxColour& GetLabelTextColour() const { return (wxColour&) m_labelTextColour; }
|
||||
wxColour& GetLabelBackgroundColour() { return (wxColour&) m_labelBackgroundColour; }
|
||||
wxFont& GetLabelTextFont() { return (wxFont&) m_labelTextFont; }
|
||||
void SetLabelTextFont(const wxFont& fnt) { m_labelTextFont = fnt; }
|
||||
|
||||
// Miscellaneous accessors
|
||||
int GetCursorRow() const { return m_wCursorRow; }
|
||||
int GetCursorColumn() const { return m_wCursorColumn; }
|
||||
void SetGridCursor(int row, int col);
|
||||
int GetRows() const { return m_totalRows; }
|
||||
int GetCols() const { return m_totalCols; }
|
||||
int GetScrollPosX() const { return m_scrollPosX; }
|
||||
int GetScrollPosY() const { return m_scrollPosY; }
|
||||
void SetScrollPosX(int pos) { m_scrollPosX = pos; }
|
||||
void SetScrollPosY(int pos) { m_scrollPosY = pos; }
|
||||
wxTextCtrl *GetTextItem() const { return m_textItem; }
|
||||
wxScrollBar *GetHorizScrollBar() const { return m_hScrollBar; }
|
||||
wxScrollBar *GetVertScrollBar() const { return m_vScrollBar; }
|
||||
bool GetEditable() const { return m_editable; }
|
||||
void SetEditable(bool edit);
|
||||
|
||||
bool GetEditInPlace() const { return m_editInPlace; }
|
||||
void SetEditInPlace(bool edit = TRUE);
|
||||
|
||||
wxRect& GetCurrentRect() const { return (wxRect&) m_currentRect; }
|
||||
bool CurrentCellVisible() const { return m_currentRectVisible; }
|
||||
void SetDividerPen(const wxPen& pen) { m_divisionPen = pen; }
|
||||
wxPen& GetDividerPen() const { return (wxPen&) m_divisionPen; }
|
||||
|
||||
// High-level event handling
|
||||
// Override e.g. to check value of current cell; but call
|
||||
// base member for default processing.
|
||||
virtual void OnSelectCellImplementation(wxDC *dc, int row, int col);
|
||||
|
||||
virtual void OnSelectCell(int WXUNUSED(row), int WXUNUSED(col)) {};
|
||||
void _OnSelectCell(wxGridEvent& event);
|
||||
|
||||
// Override to create your own class of grid cell
|
||||
virtual wxGridCell *OnCreateCell();
|
||||
void _OnCreateCell(wxGridEvent& event);
|
||||
|
||||
// Override to change labels e.g. creation of grid, inserting/deleting a row/col.
|
||||
// By default, auto-labels the grid.
|
||||
virtual void OnChangeLabels();
|
||||
void _OnChangeLabels(wxGridEvent& event);
|
||||
|
||||
// Override to change the label of the edit field when selecting a cell
|
||||
// By default, sets it to e.g. A12
|
||||
virtual void OnChangeSelectionLabel();
|
||||
void _OnChangeSelectionLabel(wxGridEvent& event);
|
||||
|
||||
// Override for event processing
|
||||
virtual void OnCellChange(int WXUNUSED(row), int WXUNUSED(col)) {};
|
||||
virtual void OnCellLeftClick(int WXUNUSED(row), int WXUNUSED(col), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(control), bool WXUNUSED(shift)) {};
|
||||
virtual void OnCellRightClick(int WXUNUSED(row), int WXUNUSED(col), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(control), bool WXUNUSED(shift)) {};
|
||||
virtual void OnLabelLeftClick(int WXUNUSED(row), int WXUNUSED(col), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(control), bool WXUNUSED(shift)) {};
|
||||
virtual void OnLabelRightClick(int WXUNUSED(row), int WXUNUSED(col), int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(control), bool WXUNUSED(shift)) {};
|
||||
|
||||
void _OnCellChange(wxGridEvent& event);
|
||||
void _OnCellLeftClick(wxGridEvent& event);
|
||||
void _OnCellRightClick(wxGridEvent& event);
|
||||
void _OnLabelLeftClick(wxGridEvent& event);
|
||||
void _OnLabelRightClick(wxGridEvent& event);
|
||||
|
||||
// Activation: call from wxFrame::OnActivate
|
||||
void OnActivate(bool active);
|
||||
|
||||
// Miscellaneous
|
||||
void AdjustScrollbars();
|
||||
void UpdateDimensions();
|
||||
|
||||
void SetCurrentRect (int Row, int Column, int canvasW = -1, int canvasH = -1);
|
||||
void HighlightCell(wxDC *dc, bool doHighlight);
|
||||
void DrawCellText();
|
||||
void SetGridClippingRegion(wxDC *dc);
|
||||
|
||||
virtual bool CellHitTest(int x, int y, int *row, int *col);
|
||||
virtual bool LabelSashHitTest(int x, int y, int *orientation, int *rowOrCol, int *startPos);
|
||||
virtual bool LabelHitTest(int x, int y, int *row, int *col);
|
||||
|
||||
// Painting
|
||||
virtual void DrawLabelAreas(wxDC *dc);
|
||||
virtual void DrawEditableArea(wxDC *dc);
|
||||
virtual void DrawGridLines(wxDC *dc);
|
||||
virtual void DrawColumnLabels(wxDC *dc);
|
||||
virtual void DrawColumnLabel(wxDC *dc, wxRect *rect, int col);
|
||||
virtual void DrawRowLabels(wxDC *dc);
|
||||
virtual void DrawRowLabel(wxDC *dc, wxRect *rect, int row);
|
||||
virtual void DrawCells(wxDC *dc);
|
||||
virtual void DrawCellValue(wxDC *dc, wxRect *rect, int row, int col);
|
||||
virtual void DrawCellBackground(wxDC *dc, wxRect *rect, int row, int col);
|
||||
virtual void DrawTextRect(wxDC *dc, const wxString& text, wxRect *rect, int flag);
|
||||
virtual void DrawBitmapRect(wxDC *dc, wxBitmap *bitmap, wxRect *rect, int flag);
|
||||
|
||||
// Refresh cell and optionally set the text field
|
||||
void RefreshCell(int row, int col, bool setText = FALSE);
|
||||
|
||||
// Don't refresh within the outer pair of these.
|
||||
void BeginBatch() { m_batchCount ++; }
|
||||
void EndBatch() { m_batchCount --; }
|
||||
int GetBatchCount() { return m_batchCount; }
|
||||
|
||||
// implementation from now on
|
||||
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnText(wxCommandEvent& ev);
|
||||
void OnTextEnter(wxCommandEvent& ev);
|
||||
void OnTextInPlace(wxCommandEvent& ev);
|
||||
void OnTextInPlaceEnter(wxCommandEvent& ev);
|
||||
void OnGridScroll(wxScrollEvent& ev);
|
||||
|
||||
protected:
|
||||
wxPanel* m_editingPanel; // Contains the text control
|
||||
wxTextCtrl* m_textItem;
|
||||
wxTextCtrl* m_inPlaceTextItem;
|
||||
|
||||
wxScrollBar* m_hScrollBar;
|
||||
wxScrollBar* m_vScrollBar;
|
||||
int m_wCursorRow;
|
||||
int m_wCursorColumn;
|
||||
wxRect m_currentRect;
|
||||
bool m_currentRectVisible;
|
||||
wxGridCell*** m_gridCells;
|
||||
wxGridCell** m_rowLabelCells;
|
||||
wxGridCell** m_colLabelCells;
|
||||
|
||||
bool m_editCreated;
|
||||
bool m_editable;
|
||||
bool m_editInPlace;
|
||||
bool m_inOnTextInPlace;
|
||||
bool m_inScroll;
|
||||
|
||||
int m_totalRows;
|
||||
int m_totalCols;
|
||||
|
||||
// Row and column we're currently looking at
|
||||
int m_scrollPosX;
|
||||
int m_scrollPosY;
|
||||
|
||||
// Dimensions
|
||||
int m_leftOfSheet;
|
||||
int m_topOfSheet;
|
||||
int m_rightOfSheet; // Calculated from m_colWidths
|
||||
int m_bottomOfSheet; // Calculated from m_rowHeights
|
||||
int m_totalGridWidth; // Total 'virtual' size
|
||||
int m_totalGridHeight;
|
||||
int m_viewHeight; // Number of rows displayed
|
||||
int m_viewWidth; // Number of columns displayed
|
||||
int m_cellHeight; // For now, a default
|
||||
int m_verticalLabelWidth;
|
||||
int m_horizontalLabelHeight;
|
||||
int m_verticalLabelAlignment;
|
||||
int m_horizontalLabelAlignment;
|
||||
int m_cellAlignment;
|
||||
short* m_colWidths; // Dynamically allocated
|
||||
short* m_rowHeights; // Dynamically allocated
|
||||
int m_scrollWidth; // Vert. scroll width, horiz. scroll height
|
||||
|
||||
// Colours
|
||||
wxColour m_cellTextColour;
|
||||
wxColour m_cellBackgroundColour;
|
||||
wxFont m_cellTextFont;
|
||||
wxColour m_labelTextColour;
|
||||
wxColour m_labelBackgroundColour;
|
||||
wxBrush m_labelBackgroundBrush;
|
||||
wxFont m_labelTextFont;
|
||||
wxPen m_divisionPen;
|
||||
wxPen m_highlightPen;
|
||||
wxBitmap* m_doubleBufferingBitmap;
|
||||
|
||||
// Position of Edit control
|
||||
wxRect m_editControlPosition;
|
||||
|
||||
// Drag status
|
||||
int m_dragStatus;
|
||||
int m_dragRowOrCol;
|
||||
int m_dragStartPosition;
|
||||
int m_dragLastPosition;
|
||||
wxCursor m_horizontalSashCursor;
|
||||
wxCursor m_verticalSashCursor;
|
||||
|
||||
// To avoid multiple refreshes, use Begin/EndBatch
|
||||
int m_batchCount;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#define wxGRID_TEXT_CTRL 2000
|
||||
#define wxGRID_HSCROLL 2001
|
||||
#define wxGRID_VSCROLL 2002
|
||||
#define wxGRID_EDIT_IN_PLACE_TEXT_CTRL 2003
|
||||
|
||||
class WXDLLEXPORT wxGridCell : public wxObject
|
||||
{
|
||||
public:
|
||||
wxString textValue;
|
||||
wxFont font;
|
||||
wxColour textColour;
|
||||
wxColour backgroundColour;
|
||||
wxBrush backgroundBrush;
|
||||
wxBitmap* cellBitmap;
|
||||
void* cellData; // intended for additional data associated with a cell
|
||||
int alignment;
|
||||
|
||||
wxGridCell(wxGenericGrid *window = (wxGenericGrid *) NULL);
|
||||
~wxGridCell();
|
||||
|
||||
virtual wxString& GetTextValue() const { return (wxString&) textValue; }
|
||||
virtual void SetTextValue(const wxString& str) { textValue = str; }
|
||||
wxFont& GetFont() const { return (wxFont&) font; }
|
||||
void SetFont(const wxFont& f) { font = f; }
|
||||
wxColour& GetTextColour() const { return (wxColour&) textColour; }
|
||||
void SetTextColour(const wxColour& colour) { textColour = colour; }
|
||||
wxColour& GetBackgroundColour() const { return (wxColour&) backgroundColour; }
|
||||
void SetBackgroundColour(const wxColour& colour);
|
||||
wxBrush& GetBackgroundBrush() const { return (wxBrush&) backgroundBrush; }
|
||||
void SetBackgroundBrush(const wxBrush& brush) { backgroundBrush = brush; }
|
||||
int GetAlignment() const { return alignment; }
|
||||
void SetAlignment(int align) { alignment = align; }
|
||||
wxBitmap *GetCellBitmap() const { return cellBitmap; }
|
||||
void SetCellBitmap(wxBitmap *bitmap) { cellBitmap = bitmap; }
|
||||
|
||||
void *SetCellData(void *data) { void *rc = cellData; cellData = data; return rc; }
|
||||
void *GetCellData() const { return cellData; }
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxGrid : public wxGenericGrid
|
||||
{
|
||||
public:
|
||||
wxGrid() : wxGenericGrid() { }
|
||||
wxGrid(wxWindow *parent, int x=-1, int y=-1, int width=-1, int height=-1,
|
||||
long style=0, char *name = "gridWindow")
|
||||
: wxGenericGrid(parent, x, y, width, height, style, name)
|
||||
{
|
||||
}
|
||||
wxGrid(wxWindow *parent, wxWindowID id, const wxPoint& pos,
|
||||
const wxSize& size, long style = 0, const wxString& name = "grid")
|
||||
: wxGenericGrid(parent, id, pos, size, style, name)
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxGridEvent : public wxCommandEvent
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxGridEvent)
|
||||
|
||||
public:
|
||||
wxGridEvent()
|
||||
: wxCommandEvent(), m_row(-1), m_col(-1), m_x(-1), m_y(-1),
|
||||
m_control(0), m_shift(0), m_cell(0)
|
||||
{
|
||||
}
|
||||
|
||||
wxGridEvent(int id, wxEventType type, wxObject* obj,
|
||||
int row=-1, int col=-1, int x=-1, int y=-1,
|
||||
bool control=FALSE, bool shift=FALSE)
|
||||
: wxCommandEvent(type, id), m_row(row), m_col(col), m_x(x), m_y(y),
|
||||
m_control(control), m_shift(shift), m_cell(0)
|
||||
{
|
||||
SetEventObject(obj);
|
||||
}
|
||||
|
||||
//private:
|
||||
int m_row;
|
||||
int m_col;
|
||||
int m_x;
|
||||
int m_y;
|
||||
bool m_control;
|
||||
bool m_shift;
|
||||
wxGridCell* m_cell;
|
||||
|
||||
int GetRow() const { return m_row; }
|
||||
int GetCol() const { return m_col; }
|
||||
wxPoint GetPosition() const { return wxPoint( m_x, m_y ); }
|
||||
wxGridCell* GetCell() const { return m_cell; }
|
||||
bool ControlDown() const { return m_control; }
|
||||
bool ShiftDown() const { return m_shift; }
|
||||
};
|
||||
|
||||
const wxEventType wxEVT_GRID_SELECT_CELL = wxEVT_FIRST + 1575;
|
||||
const wxEventType wxEVT_GRID_CREATE_CELL = wxEVT_FIRST + 1576;
|
||||
const wxEventType wxEVT_GRID_CHANGE_LABELS = wxEVT_FIRST + 1577;
|
||||
const wxEventType wxEVT_GRID_CHANGE_SEL_LABEL = wxEVT_FIRST + 1578;
|
||||
const wxEventType wxEVT_GRID_CELL_CHANGE = wxEVT_FIRST + 1579;
|
||||
const wxEventType wxEVT_GRID_CELL_LCLICK = wxEVT_FIRST + 1580;
|
||||
const wxEventType wxEVT_GRID_CELL_RCLICK = wxEVT_FIRST + 1581;
|
||||
const wxEventType wxEVT_GRID_LABEL_LCLICK = wxEVT_FIRST + 1582;
|
||||
const wxEventType wxEVT_GRID_LABEL_RCLICK = wxEVT_FIRST + 1583;
|
||||
|
||||
|
||||
typedef void (wxEvtHandler::*wxGridEventFunction)(wxGridEvent&);
|
||||
|
||||
#define EVT_GRID_SELECT_CELL(fn) { wxEVT_GRID_SELECT_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||
#define EVT_GRID_CREATE_CELL(fn) { wxEVT_GRID_CREATE_CELL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||
#define EVT_GRID_CHANGE_LABELS(fn) { wxEVT_GRID_CHANGE_LABELS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||
#define EVT_GRID_CHANGE_SEL_LABEL(fn) { wxEVT_GRID_CHANGE_SEL_LABEL, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||
#define EVT_GRID_CELL_CHANGE(fn) { wxEVT_GRID_CELL_CHANGE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||
#define EVT_GRID_CELL_LCLICK(fn) { wxEVT_GRID_CELL_LCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||
#define EVT_GRID_CELL_RCLICK(fn) { wxEVT_GRID_CELL_RCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||
#define EVT_GRID_LABEL_LCLICK(fn) { wxEVT_GRID_LABEL_LCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||
#define EVT_GRID_LABEL_RCLICK(fn) { wxEVT_GRID_LABEL_RCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxGridEventFunction) &fn, NULL },
|
||||
|
||||
#endif // __GRIDH_G__
|
||||
|
82
include/wx/generic/helpext.h
Normal file
82
include/wx/generic/helpext.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/*-*- c++ -*-********************************************************
|
||||
* helpext.h - an external help controller for wxWindows *
|
||||
* *
|
||||
* (C) 1998 by Karsten Ball<6C>der (Ballueder@usa.net) *
|
||||
* *
|
||||
* $Id$
|
||||
*******************************************************************/
|
||||
|
||||
#ifndef __WX_HELPEXT_H_
|
||||
#define __WX_HELPEXT_H_
|
||||
|
||||
#if wxUSE_HELP
|
||||
|
||||
#ifdef __GNUG__
|
||||
# pragma interface "wxexthlp.h"
|
||||
#endif
|
||||
|
||||
#include "wx/generic/helphtml.h"
|
||||
|
||||
#ifndef WXEXTHELP_DEFAULTBROWSER
|
||||
/// Default browser name.
|
||||
# define WXEXTHELP_DEFAULTBROWSER "netscape"
|
||||
/// Is default browse a variant of netscape?
|
||||
# define WXEXTHELP_DEFAULTBROWSER_IS_NETSCAPE TRUE
|
||||
#endif
|
||||
/// Name of environment variable to set help browser.
|
||||
#define WXEXTHELP_ENVVAR_BROWSER "WX_HELPBROWSER"
|
||||
/// Is browser a netscape browser?
|
||||
#define WXEXTHELP_ENVVAR_BROWSERISNETSCAPE "WX_HELPBROWSER_NS"
|
||||
|
||||
/**
|
||||
This class implements help via an external browser.
|
||||
It requires the name of a directory containing the documentation
|
||||
and a file mapping numerical Section numbers to relative URLS.
|
||||
|
||||
The map file contains two or three fields per line:
|
||||
numeric_id relative_URL [; comment/documentation]
|
||||
|
||||
The numeric_id is the id used to look up the entry in
|
||||
DisplaySection()/DisplayBlock(). The relative_URL is a filename of
|
||||
an html file, relative to the help directory. The optional
|
||||
comment/documentation field (after a ';') is used for keyword
|
||||
searches, so some meaningful text here does not hurt.
|
||||
If the documentation itself contains a ';', only the part before
|
||||
that will be displayed in the listbox, but all of it used for search.
|
||||
|
||||
Lines starting with ';' will be ignored.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxExtHelpController : public wxHTMLHelpControllerBase
|
||||
{
|
||||
DECLARE_CLASS(wxExtHelpController)
|
||||
public:
|
||||
wxExtHelpController(void);
|
||||
|
||||
/** Tell it which browser to use.
|
||||
The Netscape support will check whether Netscape is already
|
||||
running (by looking at the .netscape/lock file in the user's
|
||||
home directory) and tell it to load the page into the existing
|
||||
window.
|
||||
@param browsername The command to call a browser/html viewer.
|
||||
@param isNetscape Set this to TRUE if the browser is some variant of Netscape.
|
||||
*/
|
||||
// Obsolete form
|
||||
void SetBrowser(wxString const & browsername = WXEXTHELP_DEFAULTBROWSER,
|
||||
bool isNetscape = WXEXTHELP_DEFAULTBROWSER_IS_NETSCAPE);
|
||||
|
||||
// Set viewer: new name for SetBrowser
|
||||
virtual void SetViewer(const wxString& viewer = WXEXTHELP_DEFAULTBROWSER, long flags = wxHELP_NETSCAPE);
|
||||
|
||||
private:
|
||||
/// How to call the html viewer.
|
||||
wxString m_BrowserName;
|
||||
/// Is the viewer a variant of netscape?
|
||||
bool m_BrowserIsNetscape;
|
||||
/// Call the browser using a relative URL.
|
||||
virtual bool DisplayHelp(wxString const &);
|
||||
};
|
||||
|
||||
#endif // wxUSE_HELP
|
||||
|
||||
#endif // __WX_HELPEXT_H_
|
152
include/wx/generic/helphtml.h
Normal file
152
include/wx/generic/helphtml.h
Normal file
@@ -0,0 +1,152 @@
|
||||
/*-*- c++ -*-********************************************************
|
||||
* helphtml.h - base class for html based help controllers *
|
||||
* *
|
||||
* (C) 1999 by Karsten Ball<6C>der (Ballueder@usa.net) *
|
||||
* *
|
||||
* $Id$
|
||||
*******************************************************************/
|
||||
|
||||
#ifndef __WX_HELPHTML_H_
|
||||
#define __WX_HELPHTML_H_
|
||||
|
||||
#if wxUSE_HELP
|
||||
|
||||
#ifdef __GNUG__
|
||||
# pragma interface "helphtml.h"
|
||||
#endif
|
||||
|
||||
#include "wx/helpbase.h"
|
||||
#include "wx/frame.h"
|
||||
|
||||
/// Name for map file.
|
||||
#define WXEXTHELP_MAPFILE "wxhelp.map"
|
||||
/// Path separator.
|
||||
#ifdef __WXMSW__
|
||||
#define WXEXTHELP_SEPARATOR '\\'
|
||||
#else
|
||||
#define WXEXTHELP_SEPARATOR '/'
|
||||
#endif
|
||||
/// Maximum line length in map file.
|
||||
#define WXEXTHELP_BUFLEN 512
|
||||
/// Character introducing comments/documentation field in map file.
|
||||
#define WXEXTHELP_COMMENTCHAR ';'
|
||||
|
||||
class WXDLLEXPORT wxExtHelpMapList;
|
||||
|
||||
|
||||
/**
|
||||
This class is the base class for all html help implementations.
|
||||
It requires the name of a directory containing the documentation
|
||||
and a file mapping numerical Section numbers to relative URLS.
|
||||
|
||||
The map file contains two or three fields per line:
|
||||
numeric_id relative_URL [; comment/documentation]
|
||||
|
||||
The numeric_id is the id used to look up the entry in
|
||||
DisplaySection()/DisplayBlock(). The relative_URL is a filename of
|
||||
an html file, relative to the help directory. The optional
|
||||
comment/documentation field (after a ';') is used for keyword
|
||||
searches, so some meaningful text here does not hurt.
|
||||
If the documentation itself contains a ';', only the part before
|
||||
that will be displayed in the listbox, but all of it used for search.
|
||||
|
||||
Lines starting with ';' will be ignored.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxHTMLHelpControllerBase : public wxHelpControllerBase
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxHTMLHelpControllerBase)
|
||||
public:
|
||||
wxHTMLHelpControllerBase(void);
|
||||
virtual ~wxHTMLHelpControllerBase(void);
|
||||
|
||||
/** This must be called to tell the controller where to find the
|
||||
documentation.
|
||||
If a locale is set, look in file/localename, i.e.
|
||||
If passed "/usr/local/myapp/help" and the current wxLocale is
|
||||
set to be "de", then look in "/usr/local/myapp/help/de/"
|
||||
first and fall back to "/usr/local/myapp/help" if that
|
||||
doesn't exist.
|
||||
|
||||
@param file - NOT a filename, but a directory name.
|
||||
@return true on success
|
||||
*/
|
||||
virtual bool Initialize(const wxString& dir, int WXUNUSED(server))
|
||||
{ return Initialize(dir); }
|
||||
|
||||
/** This must be called to tell the controller where to find the
|
||||
documentation.
|
||||
If a locale is set, look in file/localename, i.e.
|
||||
If passed "/usr/local/myapp/help" and the current wxLocale is
|
||||
set to be "de", then look in "/usr/local/myapp/help/de/"
|
||||
first and fall back to "/usr/local/myapp/help" if that
|
||||
doesn't exist.
|
||||
@param dir - directory name where to fine the help files
|
||||
@return true on success
|
||||
*/
|
||||
virtual bool Initialize(const wxString& dir);
|
||||
|
||||
/** If file is "", reloads file given in Initialize.
|
||||
@file Name of help directory.
|
||||
@return true on success
|
||||
*/
|
||||
virtual bool LoadFile(const wxString& file = "");
|
||||
|
||||
/** Display list of all help entries.
|
||||
@return true on success
|
||||
*/
|
||||
virtual bool DisplayContents(void);
|
||||
/** Display help for id sectionNo.
|
||||
@return true on success
|
||||
*/
|
||||
virtual bool DisplaySection(int sectionNo);
|
||||
/** Display help for id sectionNo -- identical with DisplaySection().
|
||||
@return true on success
|
||||
*/
|
||||
virtual bool DisplayBlock(long blockNo);
|
||||
/** Search comment/documentation fields in map file and present a
|
||||
list to chose from.
|
||||
@key k string to search for, empty string will list all entries
|
||||
@return true on success
|
||||
*/
|
||||
virtual bool KeywordSearch(const wxString& k);
|
||||
|
||||
/// does nothing
|
||||
virtual bool Quit(void);
|
||||
/// does nothing
|
||||
virtual void OnQuit(void);
|
||||
|
||||
/// Call the browser using a relative URL.
|
||||
virtual bool DisplayHelp(wxString const &) = 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
|
||||
}
|
||||
|
||||
protected:
|
||||
/// Filename of currently active map file.
|
||||
wxString m_MapFile;
|
||||
/// How many entries do we have in the map file?
|
||||
int m_NumOfEntries;
|
||||
/// A list containing all id,url,documentation triples.
|
||||
wxList *m_MapList;
|
||||
/// Deletes the list and all objects.
|
||||
void DeleteList(void);
|
||||
};
|
||||
|
||||
#endif // wxUSE_HELP
|
||||
|
||||
#endif // __WX_HELPHTML_H_
|
75
include/wx/generic/helpwxht.h
Normal file
75
include/wx/generic/helpwxht.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/*-*- c++ -*-********************************************************
|
||||
* helpwxht.h - a help controller using wxHTML *
|
||||
* *
|
||||
* (C) 1999 by Karsten Ball<6C>der (Ballueder@usa.net) *
|
||||
* *
|
||||
* $Id$
|
||||
*******************************************************************/
|
||||
|
||||
#ifndef __WX_HELPWXHT_H_
|
||||
#define __WX_HELPWXHT_H_
|
||||
|
||||
#if wxUSE_HELP
|
||||
#if wxUSE_HTML
|
||||
|
||||
#ifdef __GNUG__
|
||||
# pragma interface "helpwxht.h"
|
||||
#endif
|
||||
|
||||
#include "wx/generic/helphtml.h"
|
||||
|
||||
|
||||
/**
|
||||
This class implements help via wxHTML.
|
||||
It requires the name of a directory containing the documentation
|
||||
and a file mapping numerical Section numbers to relative URLS.
|
||||
|
||||
The map file contains two or three fields per line:
|
||||
numeric_id relative_URL [; comment/documentation]
|
||||
|
||||
The numeric_id is the id used to look up the entry in
|
||||
DisplaySection()/DisplayBlock(). The relative_URL is a filename of
|
||||
an html file, relative to the help directory. The optional
|
||||
comment/documentation field (after a ';') is used for keyword
|
||||
searches, so some meaningful text here does not hurt.
|
||||
If the documentation itself contains a ';', only the part before
|
||||
that will be displayed in the listbox, but all of it used for search.
|
||||
|
||||
Lines starting with ';' will be ignored.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxHelpControllerHtml : public wxHTMLHelpControllerBase
|
||||
{
|
||||
DECLARE_CLASS(wxHelpControllerHtml)
|
||||
public:
|
||||
wxHelpControllerHtml(void);
|
||||
~wxHelpControllerHtml(void);
|
||||
|
||||
/// Allows one to override the default settings for the help frame.
|
||||
virtual void SetFrameParameters(const wxString &title,
|
||||
const wxSize &size,
|
||||
const wxPoint &pos = wxDefaultPosition,
|
||||
bool newFrameEachTime = FALSE);
|
||||
/// Obtains the latest settings used by the help frame.
|
||||
virtual wxFrame * GetFrameParameters(wxSize *size = NULL,
|
||||
wxPoint *pos = NULL,
|
||||
bool *newFrameEachTime = NULL);
|
||||
|
||||
|
||||
private:
|
||||
/// Call the browser using a relative URL.
|
||||
virtual bool DisplayHelp(wxString const &);
|
||||
protected:
|
||||
friend class wxHelpFrame;
|
||||
class wxHelpFrame *m_Frame;
|
||||
wxString m_FrameTitle;
|
||||
wxPoint m_FramePosition;
|
||||
wxSize m_FrameSize;
|
||||
bool m_NewFrameEachTime;
|
||||
size_t m_offset;
|
||||
};
|
||||
|
||||
#endif // wxUSE_HELP
|
||||
#endif // wxUSE_HTML
|
||||
|
||||
#endif // __WX_HELPEXT_H_
|
126
include/wx/generic/helpxlp.h
Normal file
126
include/wx/generic/helpxlp.h
Normal file
@@ -0,0 +1,126 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: helpxlp.h
|
||||
// Purpose: Help system: wxHelp implementation
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __HELPXLPH__
|
||||
#define __HELPXLPH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "helpxlp.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "wx/wx.h"
|
||||
|
||||
#if wxUSE_HELP
|
||||
|
||||
#include "wx/helpbase.h"
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include "wx/dde.h"
|
||||
#else
|
||||
#include "wx/sckipc.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxXLPHelpController;
|
||||
|
||||
// Connection class for implementing the connection between the
|
||||
// wxHelp process and the application
|
||||
class WXDLLEXPORT wxXLPHelpConnection: public
|
||||
|
||||
#ifdef __WXMSW__
|
||||
wxDDEConnection
|
||||
#else
|
||||
wxTCPConnection
|
||||
#endif
|
||||
|
||||
{
|
||||
friend class wxXLPHelpController;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxXLPHelpConnection)
|
||||
|
||||
public:
|
||||
|
||||
wxXLPHelpConnection(wxXLPHelpController *instance);
|
||||
bool OnDisconnect(void);
|
||||
|
||||
private:
|
||||
wxXLPHelpController *helpInstance;
|
||||
};
|
||||
|
||||
// Connection class for implementing the client process
|
||||
// controlling the wxHelp process
|
||||
class WXDLLEXPORT wxXLPHelpClient: public
|
||||
|
||||
#ifdef __WXMSW__
|
||||
wxDDEClient
|
||||
#else
|
||||
wxTCPClient
|
||||
#endif
|
||||
|
||||
{
|
||||
DECLARE_CLASS(wxXLPHelpClient)
|
||||
|
||||
friend class WXDLLEXPORT wxXLPHelpController;
|
||||
public:
|
||||
wxXLPHelpClient(wxXLPHelpController* c) { m_controller = c; }
|
||||
|
||||
wxConnectionBase *OnMakeConnection(void)
|
||||
{ return new wxXLPHelpConnection(m_controller);
|
||||
}
|
||||
protected:
|
||||
wxXLPHelpController* m_controller;
|
||||
};
|
||||
|
||||
// An application can have one or more instances of wxHelp,
|
||||
// represented by an object of this class.
|
||||
// Nothing happens on initial creation; the application
|
||||
// must call a member function to display help.
|
||||
// If the instance of wxHelp is already active, that instance
|
||||
// will be used for subsequent help.
|
||||
|
||||
class WXDLLEXPORT wxXLPHelpController: public wxHelpControllerBase
|
||||
{
|
||||
friend class WXDLLEXPORT wxXLPHelpConnection;
|
||||
DECLARE_CLASS(wxXLPHelpController)
|
||||
|
||||
public:
|
||||
wxXLPHelpController(void);
|
||||
~wxXLPHelpController(void);
|
||||
|
||||
// Must call this to set the filename and server name
|
||||
virtual bool Initialize(const wxString& file, int server = -1);
|
||||
// If file is "", reloads file given in Initialize
|
||||
virtual bool LoadFile(const wxString& file = "");
|
||||
virtual bool DisplayContents(void);
|
||||
virtual bool DisplaySection(int sectionNo);
|
||||
virtual bool DisplayBlock(long blockNo);
|
||||
virtual bool KeywordSearch(const wxString& k);
|
||||
|
||||
virtual bool Quit(void);
|
||||
virtual void OnQuit(void);
|
||||
|
||||
// Private
|
||||
bool Run(void);
|
||||
|
||||
protected:
|
||||
wxString helpFile;
|
||||
wxString helpHost;
|
||||
int helpServer;
|
||||
bool helpRunning;
|
||||
wxXLPHelpConnection* helpConnection;
|
||||
wxXLPHelpClient helpClient;
|
||||
private:
|
||||
virtual bool Initialize(const wxString& file) { return(wxHelpControllerBase::Initialize(file)); };
|
||||
};
|
||||
|
||||
#endif // wxUSE_HELP
|
||||
#endif
|
||||
// __HELPXLPH__
|
26
include/wx/generic/home.xpm
Normal file
26
include/wx/generic/home.xpm
Normal file
@@ -0,0 +1,26 @@
|
||||
/* XPM */
|
||||
static char * home_xpm[] = {
|
||||
"20 20 3 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" .. ",
|
||||
" . .... ",
|
||||
" . .XX . ",
|
||||
" . .XXXX . ",
|
||||
" ..XXXXXX . ",
|
||||
" .XXXXXXXX . ",
|
||||
" .XXXXXXXXX . ",
|
||||
" ...XXXXXXXX ... ",
|
||||
" .XXXXXXXX . ",
|
||||
" .XXX...XX . ",
|
||||
" .XXX. .XX . ",
|
||||
" .XXX. .XX . ",
|
||||
" .XXX. .XX . ",
|
||||
" .XXX. .XX . ",
|
||||
" ..... ...... ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
78
include/wx/generic/imaglist.h
Normal file
78
include/wx/generic/imaglist.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imaglist.h
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __IMAGELISTH_G__
|
||||
#define __IMAGELISTH_G__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "imaglist.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/dc.h"
|
||||
|
||||
/*
|
||||
* wxImageList is used for wxListCtrl, wxTreeCtrl. These controls refer to
|
||||
* images for their items by an index into an image list.
|
||||
* A wxImageList is capable of creating images with optional masks from
|
||||
* a variety of sources - a single bitmap plus a colour to indicate the mask,
|
||||
* two bitmaps, or an icon.
|
||||
*
|
||||
* Image lists can also create and draw images used for drag and drop functionality.
|
||||
* This is not yet implemented in wxImageList. We need to discuss a generic API
|
||||
* for doing drag and drop and see whether it ties in with the Win95 view of it.
|
||||
* See below for candidate functions and an explanation of how they might be
|
||||
* used.
|
||||
*/
|
||||
|
||||
// Flags for Draw
|
||||
#define wxIMAGELIST_DRAW_NORMAL 0x0001
|
||||
#define wxIMAGELIST_DRAW_TRANSPARENT 0x0002
|
||||
#define wxIMAGELIST_DRAW_SELECTED 0x0004
|
||||
#define wxIMAGELIST_DRAW_FOCUSED 0x0008
|
||||
|
||||
// Flag values for Set/GetImageList
|
||||
enum {
|
||||
wxIMAGE_LIST_NORMAL, // Normal icons
|
||||
wxIMAGE_LIST_SMALL, // Small icons
|
||||
wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation)
|
||||
};
|
||||
|
||||
class wxImageList: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxImageList)
|
||||
|
||||
public:
|
||||
|
||||
wxImageList() { }
|
||||
wxImageList( int width, int height, bool mask = TRUE, int initialCount = 1 );
|
||||
~wxImageList();
|
||||
bool Create();
|
||||
int GetImageCount() const;
|
||||
int Add( const wxBitmap &bitmap );
|
||||
const wxBitmap *GetBitmap(int index) const;
|
||||
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:
|
||||
|
||||
wxList m_images;
|
||||
int m_width;
|
||||
int m_height;
|
||||
};
|
||||
|
||||
#endif // __IMAGELISTH_G__
|
||||
|
210
include/wx/generic/info.xpm
Normal file
210
include/wx/generic/info.xpm
Normal file
@@ -0,0 +1,210 @@
|
||||
/* XPM */
|
||||
static char * info_xpm[] = {
|
||||
"48 48 159 2",
|
||||
" c None",
|
||||
". c #12165C",
|
||||
"+ c #9E9EC4",
|
||||
"@ c #565294",
|
||||
"# c #2E3274",
|
||||
"$ c #1A227C",
|
||||
"% c #16229C",
|
||||
"& c #262274",
|
||||
"* c #362E8C",
|
||||
"= c #262A9C",
|
||||
"- c #121E7C",
|
||||
"; c #1A2AAC",
|
||||
"> c #162284",
|
||||
", c #262EA4",
|
||||
"' c #2A2A84",
|
||||
") c #1E1E6C",
|
||||
"! c #3E3A84",
|
||||
"~ c #7A72B4",
|
||||
"{ c #121E74",
|
||||
"] c #1E2284",
|
||||
"^ c #2A2E9C",
|
||||
"/ c #362E9C",
|
||||
"( c #D2D2E4",
|
||||
"_ c #62669C",
|
||||
": c #1E269C",
|
||||
"< c #1A2AB4",
|
||||
"[ c #6A6EAC",
|
||||
"} c #121A6C",
|
||||
"| c #2E2A84",
|
||||
"1 c #26268C",
|
||||
"2 c #3E328C",
|
||||
"3 c #322E9C",
|
||||
"4 c #B6B6CC",
|
||||
"5 c #1626AC",
|
||||
"6 c #1E268C",
|
||||
"7 c #2E267C",
|
||||
"8 c #363294",
|
||||
"9 c #1A2694",
|
||||
"0 c #22226C",
|
||||
"a c #26267C",
|
||||
"b c #2E2A9C",
|
||||
"c c #1A1E7C",
|
||||
"d c #222A9C",
|
||||
"e c #162294",
|
||||
"f c #1E2EBC",
|
||||
"g c #2A2EAC",
|
||||
"h c #6A6A9C",
|
||||
"i c #2E2A94",
|
||||
"j c #CACADC",
|
||||
"k c #1A1A64",
|
||||
"l c #16269C",
|
||||
"m c #262AAC",
|
||||
"n c #161E8C",
|
||||
"o c #464294",
|
||||
"p c #8286C4",
|
||||
"q c #1A1E64",
|
||||
"r c #222AB4",
|
||||
"s c #6A6EB4",
|
||||
"t c #1A1A6C",
|
||||
"u c #BABAD4",
|
||||
"v c #1E2694",
|
||||
"w c #121A64",
|
||||
"x c #2E2E94",
|
||||
"y c #3A2E8C",
|
||||
"z c #2A2A9C",
|
||||
"A c #161E7C",
|
||||
"B c #1A2284",
|
||||
"C c #262A94",
|
||||
"D c #2E2E9C",
|
||||
"E c #36329C",
|
||||
"F c #FEFEFC",
|
||||
"G c #666AA4",
|
||||
"H c #1E2AB4",
|
||||
"I c #161A6C",
|
||||
"J c #322A84",
|
||||
"K c #2A267C",
|
||||
"L c #262EB4",
|
||||
"M c #1A269C",
|
||||
"N c #1E2274",
|
||||
"O c #1E2AA4",
|
||||
"P c #221E6C",
|
||||
"Q c #423E8C",
|
||||
"R c #222284",
|
||||
"S c #E6E6EC",
|
||||
"T c #22269C",
|
||||
"U c #6E6EA4",
|
||||
"V c #3232A4",
|
||||
"W c #BAB6D4",
|
||||
"X c #1A26AC",
|
||||
"Y c #222684",
|
||||
"Z c #3A328C",
|
||||
"` c #22227C",
|
||||
" . c #222AAC",
|
||||
".. c #222EB4",
|
||||
"+. c #8A86BC",
|
||||
"@. c #1A1E74",
|
||||
"#. c #161A5C",
|
||||
"$. c #322E8C",
|
||||
"%. c #3A329C",
|
||||
"&. c #A29ECC",
|
||||
"*. c #26227C",
|
||||
"=. c #362E94",
|
||||
"-. c #262AA4",
|
||||
";. c #121E84",
|
||||
">. c #16228C",
|
||||
",. c #262EAC",
|
||||
"'. c #2A2A8C",
|
||||
"). c #1E1E74",
|
||||
"!. c #7A76B4",
|
||||
"~. c #161E74",
|
||||
"{. c #1E228C",
|
||||
"]. c #2A2EA4",
|
||||
"^. c #6266A4",
|
||||
"/. c #1E26A4",
|
||||
"(. c #1A2ABC",
|
||||
"_. c #121A74",
|
||||
":. c #2E2A8C",
|
||||
"<. c #262694",
|
||||
"[. c #3E3294",
|
||||
"}. c #322EA4",
|
||||
"|. c #B6B6D4",
|
||||
"1. c #222274",
|
||||
"2. c #262684",
|
||||
"3. c #222AA4",
|
||||
"4. c #1A2294",
|
||||
"5. c #2E2EAC",
|
||||
"6. c #6E6AA4",
|
||||
"7. c #322A94",
|
||||
"8. c #1626A4",
|
||||
"9. c #8E8ABC",
|
||||
"0. c #4A429C",
|
||||
"a. c #6E6EBC",
|
||||
"b. c #222694",
|
||||
"c. c #2A2A94",
|
||||
"d. c #1A1E6C",
|
||||
"e. c #BABADC",
|
||||
"f. c #3A2E94",
|
||||
"g. c #2A2AA4",
|
||||
"h. c #161E84",
|
||||
"i. c #1A228C",
|
||||
"j. c #2E2EA4",
|
||||
"k. c #3632A4",
|
||||
"l. c #666AAC",
|
||||
"m. c #1E2ABC",
|
||||
"n. c #161A74",
|
||||
"o. c #322A8C",
|
||||
"p. c #2A2684",
|
||||
"q. c #1A26A4",
|
||||
"r. c #1E227C",
|
||||
"s. c #1E2AAC",
|
||||
"t. c #423E94",
|
||||
"u. c #E6E6F4",
|
||||
"v. c #6E6EAC",
|
||||
"w. c #1A26B4",
|
||||
"x. c #22268C",
|
||||
"y. c #3A3294",
|
||||
"z. c #222EBC",
|
||||
"A. c #161A64",
|
||||
"B. c #322E94",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" 7 7 7 7 7 7 7 7 & ",
|
||||
" 2 2 2 2 2 2 y y y f.f.[.y 7 *. ",
|
||||
" J y 2 2 2 2 2 [.[.[.[.y.=.=.f.=./ B.p. ",
|
||||
" 2 2 2 2 [.2 [.[.f.y y y * * =.=.B./ B.3 o.*.*. ",
|
||||
" y 2 2 [.2 [.2 2 y [.[.f.f.o.* $.$.B.B.7.D 3 D }.D ",
|
||||
" 2 2 [.[.2 [.2 [.f.[.y ~ ( F F W 0.$.:.i x 7.3 D D <.R ",
|
||||
" y 2 [.[.[.2 [.2 2 y y ~ F F F F F u.o :.:.c.c.b b D }.}.g. ",
|
||||
" 2 [.[.2 [.2 [.2 [.y 2 Z ( F F F F F F +.7 '.:.:.i D b ].].z R ",
|
||||
" y 2 2 [.[.[.[.[.2 f.y y y F F F F F F F |.p.p.'.'.<.z z g.].].5.m ",
|
||||
" 2 2 [.t.[.[.2 2 2 f.2 f.* * u.F F F F F F + *.2.2.C '.c.z ^ ].g m = n ",
|
||||
" y 2 [.2 [.[.[.[.2 f.2 f.* * &.F F F F F F @ a *.2.2.C C z = g.].,.g. . ",
|
||||
" 2 2 [.[.[.[.[.2 [.[.[.f.* o.J $.u F F F u.U 1.0 Y *.2.1 <.C ^ -.m g.L = n ",
|
||||
" 2 2 2 [.2 t.[.[.f.[.Z y.* $.J 7 | Q U 6.P 1.P P ` ` 2.1 <.= = , ,.,.m m . ",
|
||||
" 2 [.[.[.[.[.[.2 f.2 f.f.* =.o.:.| K & & 0 0 P N 1.1.` R 2.d <.= -.-.m ..../.n ",
|
||||
" 2 2 [.2 [.2 [.[.[.[.y.=.=.* o.:.p.K ! 6.h 4 4 ) ) ).r.6 Y b.= = , ,.,.m ..r r ",
|
||||
" [.2 t.[.[.[.[.[.f.y.8 y.* B.9.W S F F F F F F ) ) N 1.R R x.b.= 3.m m ..m ..s. ",
|
||||
" 7 [.2 [.2 [.[.[.[.[.f.=.=.=.o.e.F F F F F F F F ) ) ).N R x.b.T 3.3. .m ..r H m.H ",
|
||||
" 2 [.[.[.[.[.[.[.[.f.%.=.=.$.B.:.o W F F F F F F k q N r.] R b.d T , . .r ....s.n ",
|
||||
" y 2 2 [.[.[.[.[.%.f.%.=.=.B.$.:.'.v.F F F F F F t k ) N ] 6 x.d T 3... .H r H m.< ",
|
||||
" 2 [.[.[.[.[.[.%.y.%.=.E / 7.7.p.p.v.F F F F F F q d.t @.r.R v T O . .....f r X n ",
|
||||
" y 2 2 [.[.[.[.%.=.%.=.B.B.x B.:.| v.F F F F F F k d.d.c $ {.6 T d O .r r f f m.(. ",
|
||||
" 2 [.[.[.[.[.%.%.%./ E / 3 7.i '.2.v.F F F F F F A.A.t @.r.] b.: /. .s.H H H m.5 ;. ",
|
||||
" J 2 [.[.[.[.f.%.8 / E 8 3 i i :.p.v.F F F F F F k A.d.~.$ B 6 : : /.s.H m.m.f (.(. ",
|
||||
" [.[.[.%.[.%.%./ f.E / 3 3 B.i p.1 v.F F F F F F . A.I @.c {.{.: O s. .H H m.(.w.;. ",
|
||||
" 7 [.[.%.f.%.%.E / V =.3 D D ^ '.1 v.F F F F F F #.A.I @.A i.9 : O s.s.H f m.(.(.w. ",
|
||||
" [.[.[.[.%.%.E E E / 3 3 7.i i c.2.v.F F F F F F . . A.~.c B {.M /.X H H (.(.(.w.;. ",
|
||||
" [.%.%./ %.f./ V 3 3 D D c.c.<.Y v.F F F F F F #.A.A.~.A B 4.9 /.X ; < f f (.(. ",
|
||||
" %.f.E %./ k.k./ V }.}.D D c.'.1 [ F F F F F F . . } I c >.i.M q.; H < (.(.(.5 ",
|
||||
" J f.k.E E E / / 3 V 3 D b z 1 x.v.F F F F F F #.. A.} c B 4.M /.X < (.(.(.(.(. ",
|
||||
" %.%.%.E / V }.V D j.z z c.C 1 [ F F F F F F . A.} ~.A h.4.4.q.; w.(.(.(.5 ",
|
||||
" 7 k./ V / V D }.j.j.^ z z <.x.[ F F F F F F . . . _.A h.4.% q.; 5 w.w.(.(. ",
|
||||
" / k./ V }.}.j.j.j.b z C C R l.F F F F F F . } I ~.A >.e M 5 5 (.(.(.5 ",
|
||||
" 7 V 3 V V V }.j.].].g.= C <.s F F F F F F # w } n.A >.e 4.X 5 < (.w.(. ",
|
||||
" / k.}.}.j.j.j.j.g.z = a.p u.F F F F F F j _ _ - - n e 8.5 5 w.w.5 ",
|
||||
" V V j.j.j.].].].z = F F F F F F F F F F F F n.;.n e % X 5 (.(. ",
|
||||
" j.V j.j.j.].-.-.<.a.a.s [ l.G G _ _ _ ^.^.- h.e % 8.5 < 5 ",
|
||||
" 5.].g j.]., , d T b.{.{.c A ~._.} } _.n.;.;.e % % 5 5 ",
|
||||
" 5.j.].g g.-.-.d : v i.> A A ~._.- - - >.e e % 5 % ",
|
||||
" g g.g -., 3.d : v v i.B h.A n.h.;.;.;.n % 8.% ",
|
||||
" -.,. .-.3.T : 4.{.>.>.>.>.;.>.n % % % ",
|
||||
" 3.-.3.3.O M 4.4.i.n e n e e e ",
|
||||
" : : : /.4.% e n ;. ",
|
||||
" ",
|
||||
" "};
|
198
include/wx/generic/laywin.h
Normal file
198
include/wx/generic/laywin.h
Normal file
@@ -0,0 +1,198 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: laywin.h
|
||||
// Purpose: Implements a simple layout algorithm, plus
|
||||
// wxSashLayoutWindow which is an example of a window with
|
||||
// layout-awareness (via event handlers). This is suited to
|
||||
// IDE-style window layout.
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_LAYWIN_H_G_
|
||||
#define _WX_LAYWIN_H_G_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "laywin.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_SASH
|
||||
#include "wx/sashwin.h"
|
||||
#endif // wxUSE_SASH
|
||||
|
||||
const wxEventType wxEVT_QUERY_LAYOUT_INFO = wxEVT_FIRST + 1500;
|
||||
const wxEventType wxEVT_CALCULATE_LAYOUT = wxEVT_FIRST + 1501;
|
||||
|
||||
enum wxLayoutOrientation
|
||||
{
|
||||
wxLAYOUT_HORIZONTAL,
|
||||
wxLAYOUT_VERTICAL
|
||||
};
|
||||
|
||||
enum wxLayoutAlignment
|
||||
{
|
||||
wxLAYOUT_NONE,
|
||||
wxLAYOUT_TOP,
|
||||
wxLAYOUT_LEFT,
|
||||
wxLAYOUT_RIGHT,
|
||||
wxLAYOUT_BOTTOM
|
||||
};
|
||||
|
||||
// Not sure this is necessary
|
||||
// Tell window which dimension we're sizing on
|
||||
#define wxLAYOUT_LENGTH_Y 0x0008
|
||||
#define wxLAYOUT_LENGTH_X 0x0000
|
||||
|
||||
// Use most recently used length
|
||||
#define wxLAYOUT_MRU_LENGTH 0x0010
|
||||
|
||||
// Only a query, so don't actually move it.
|
||||
#define wxLAYOUT_QUERY 0x0100
|
||||
|
||||
/*
|
||||
* This event is used to get information about window alignment,
|
||||
* orientation and size.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxQueryLayoutInfoEvent: public wxEvent
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxQueryLayoutInfoEvent)
|
||||
public:
|
||||
|
||||
wxQueryLayoutInfoEvent(wxWindowID id = 0)
|
||||
{
|
||||
SetEventType(wxEVT_QUERY_LAYOUT_INFO);
|
||||
m_requestedLength = 0;
|
||||
m_flags = 0;
|
||||
m_id = id;
|
||||
m_alignment = wxLAYOUT_TOP;
|
||||
m_orientation = wxLAYOUT_HORIZONTAL;
|
||||
}
|
||||
|
||||
// Read by the app
|
||||
void SetRequestedLength(int length) { m_requestedLength = length; }
|
||||
int GetRequestedLength() const { return m_requestedLength; }
|
||||
|
||||
void SetFlags(int flags) { m_flags = flags; }
|
||||
int GetFlags() const { return m_flags; }
|
||||
|
||||
// Set by the app
|
||||
void SetSize(const wxSize& size) { m_size = size; }
|
||||
wxSize GetSize() const { return m_size; }
|
||||
|
||||
void SetOrientation(wxLayoutOrientation orient) { m_orientation = orient; }
|
||||
wxLayoutOrientation GetOrientation() const { return m_orientation; }
|
||||
|
||||
void SetAlignment(wxLayoutAlignment align) { m_alignment = align; }
|
||||
wxLayoutAlignment GetAlignment() const { return m_alignment; }
|
||||
|
||||
protected:
|
||||
int m_flags;
|
||||
int m_requestedLength;
|
||||
wxSize m_size;
|
||||
wxLayoutOrientation m_orientation;
|
||||
wxLayoutAlignment m_alignment;
|
||||
|
||||
};
|
||||
|
||||
typedef void (wxEvtHandler::*wxQueryLayoutInfoEventFunction)(wxQueryLayoutInfoEvent&);
|
||||
|
||||
#define EVT_QUERY_LAYOUT_INFO(func) { wxEVT_QUERY_LAYOUT_INFO, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryLayoutInfoEventFunction) & func, NULL },
|
||||
|
||||
/*
|
||||
* This event is used to take a bite out of the available client area.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxCalculateLayoutEvent: public wxEvent
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxCalculateLayoutEvent)
|
||||
public:
|
||||
wxCalculateLayoutEvent(wxWindowID id = 0)
|
||||
{
|
||||
SetEventType(wxEVT_CALCULATE_LAYOUT);
|
||||
m_flags = 0;
|
||||
m_id = id;
|
||||
}
|
||||
// Read by the app
|
||||
inline void SetFlags(int flags) { m_flags = flags; }
|
||||
inline int GetFlags() const { return m_flags; }
|
||||
|
||||
// Set by the app
|
||||
inline void SetRect(const wxRect& rect) { m_rect = rect; }
|
||||
inline wxRect GetRect() const { return m_rect; }
|
||||
protected:
|
||||
int m_flags;
|
||||
wxRect m_rect;
|
||||
};
|
||||
|
||||
typedef void (wxEvtHandler::*wxCalculateLayoutEventFunction)(wxCalculateLayoutEvent&);
|
||||
|
||||
#define EVT_CALCULATE_LAYOUT(func) { wxEVT_CALCULATE_LAYOUT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCalculateLayoutEventFunction) & func, NULL },
|
||||
|
||||
#if wxUSE_SASH
|
||||
|
||||
// This is window that can remember alignment/orientation, does its own layout,
|
||||
// and can provide sashes too. Useful for implementing docked windows with sashes in
|
||||
// an IDE-style interface.
|
||||
class WXDLLEXPORT wxSashLayoutWindow: public wxSashWindow
|
||||
{
|
||||
DECLARE_CLASS(wxSashLayoutWindow)
|
||||
public:
|
||||
wxSashLayoutWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "layoutWindow");
|
||||
|
||||
// Accessors
|
||||
inline wxLayoutAlignment GetAlignment() const { return m_alignment; };
|
||||
inline wxLayoutOrientation GetOrientation() const { return m_orientation; };
|
||||
|
||||
inline void SetAlignment(wxLayoutAlignment align) { m_alignment = align; };
|
||||
inline void SetOrientation(wxLayoutOrientation orient) { m_orientation = orient; };
|
||||
|
||||
// Give the window default dimensions
|
||||
inline void SetDefaultSize(const wxSize& size) { m_defaultSize = size; }
|
||||
|
||||
// Event handlers
|
||||
// Called by layout algorithm to allow window to take a bit out of the
|
||||
// client rectangle, and size itself if not in wxLAYOUT_QUERY mode.
|
||||
void OnCalculateLayout(wxCalculateLayoutEvent& event);
|
||||
|
||||
// Called by layout algorithm to retrieve information about the window.
|
||||
void OnQueryLayoutInfo(wxQueryLayoutInfoEvent& event);
|
||||
protected:
|
||||
wxLayoutAlignment m_alignment;
|
||||
wxLayoutOrientation m_orientation;
|
||||
wxSize m_defaultSize;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // wxUSE_SASH
|
||||
|
||||
class WXDLLEXPORT wxMDIParentFrame;
|
||||
class WXDLLEXPORT wxFrame;
|
||||
|
||||
// This class implements the layout algorithm
|
||||
class WXDLLEXPORT wxLayoutAlgorithm: public wxObject
|
||||
{
|
||||
public:
|
||||
wxLayoutAlgorithm() {}
|
||||
|
||||
// The MDI client window is sized to whatever's left over.
|
||||
bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = (wxRect*) NULL);
|
||||
|
||||
// mainWindow is sized to whatever's left over. This function for backward
|
||||
// compatibility; use LayoutWindow.
|
||||
bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = (wxWindow*) NULL)
|
||||
{
|
||||
return LayoutWindow(frame, mainWindow);
|
||||
}
|
||||
|
||||
// mainWindow is sized to whatever's left over. This function for backward
|
||||
bool LayoutWindow(wxWindow* frame, wxWindow* mainWindow = (wxWindow*) NULL);
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_LAYWIN_H_G_
|
618
include/wx/generic/listctrl.h
Normal file
618
include/wx/generic/listctrl.h
Normal file
@@ -0,0 +1,618 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: listctrl.h
|
||||
// Purpose: Generic list control
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __LISTCTRLH_G__
|
||||
#define __LISTCTRLH_G__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "listctrl.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/generic/imaglist.h"
|
||||
#include "wx/control.h"
|
||||
#include "wx/timer.h"
|
||||
#include "wx/textctrl.h"
|
||||
#include "wx/dcclient.h"
|
||||
#include "wx/scrolwin.h"
|
||||
#include "wx/settings.h"
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
class WXDLLEXPORT wxDropTarget;
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxListItem;
|
||||
class WXDLLEXPORT wxListEvent;
|
||||
class WXDLLEXPORT wxListCtrl;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// internal classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxListHeaderData;
|
||||
class WXDLLEXPORT wxListItemData;
|
||||
class WXDLLEXPORT wxListLineData;
|
||||
|
||||
class WXDLLEXPORT wxListHeaderWindow;
|
||||
class WXDLLEXPORT wxListMainWindow;
|
||||
|
||||
class WXDLLEXPORT wxListRenameTimer;
|
||||
class WXDLLEXPORT wxListTextCtrl;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// types
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// type of compare function for wxListCtrl sort operation
|
||||
typedef int (*wxListCtrlCompare)(long item1, long item2, long sortData);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListCtrl flags
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define wxLC_ICON 0x0004
|
||||
#define wxLC_SMALL_ICON 0x0008
|
||||
#define wxLC_LIST 0x0010
|
||||
#define wxLC_REPORT 0x0020
|
||||
#define wxLC_ALIGN_TOP 0x0040
|
||||
#define wxLC_ALIGN_LEFT 0x0080
|
||||
#define wxLC_AUTOARRANGE 0x0100 // not supported in wxGLC
|
||||
#define wxLC_USER_TEXT 0x0200 // not supported in wxGLC (how does it work?)
|
||||
#define wxLC_EDIT_LABELS 0x0400
|
||||
#define wxLC_NO_HEADER 0x0800
|
||||
#define wxLC_NO_SORT_HEADER 0x1000 // not supported in wxGLC
|
||||
#define wxLC_SINGLE_SEL 0x2000
|
||||
#define wxLC_SORT_ASCENDING 0x4000
|
||||
#define wxLC_SORT_DESCENDING 0x8000 // not supported in wxGLC
|
||||
|
||||
#define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT)
|
||||
#define wxLC_MASK_ALIGN (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT)
|
||||
#define wxLC_MASK_SORT (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING)
|
||||
|
||||
// Omitted because (a) too much detail (b) not enough style flags
|
||||
// #define wxLC_NO_SCROLL
|
||||
// #define wxLC_NO_LABEL_WRAP
|
||||
// #define wxLC_OWNERDRAW_FIXED
|
||||
// #define wxLC_SHOW_SEL_ALWAYS
|
||||
|
||||
// Mask flags to tell app/GUI what fields of wxListItem are valid
|
||||
#define wxLIST_MASK_STATE 0x0001
|
||||
#define wxLIST_MASK_TEXT 0x0002
|
||||
#define wxLIST_MASK_IMAGE 0x0004
|
||||
#define wxLIST_MASK_DATA 0x0008
|
||||
#define wxLIST_SET_ITEM 0x0010
|
||||
#define wxLIST_MASK_WIDTH 0x0020
|
||||
#define wxLIST_MASK_FORMAT 0x0040
|
||||
|
||||
// State flags for indicating the state of an item
|
||||
#define wxLIST_STATE_DONTCARE 0x0000
|
||||
#define wxLIST_STATE_DROPHILITED 0x0001 // not supported in wxGLC
|
||||
#define wxLIST_STATE_FOCUSED 0x0002
|
||||
#define wxLIST_STATE_SELECTED 0x0004
|
||||
#define wxLIST_STATE_CUT 0x0008 // not supported in wxGLC
|
||||
|
||||
// Hit test flags, used in HitTest // wxGLC suppots 20 and 80
|
||||
#define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area.
|
||||
#define wxLIST_HITTEST_BELOW 0x0002 // Below the client area.
|
||||
#define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item.
|
||||
#define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item.
|
||||
#define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item.
|
||||
#define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item.
|
||||
#define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state.
|
||||
#define wxLIST_HITTEST_TOLEFT 0x0400 // To the right of the client area.
|
||||
#define wxLIST_HITTEST_TORIGHT 0x0800 // To the left of the client area.
|
||||
|
||||
#define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON)
|
||||
|
||||
|
||||
|
||||
// Flags for GetNextItem // always wxLIST_NEXT_ALL in wxGLC
|
||||
enum {
|
||||
wxLIST_NEXT_ABOVE, // Searches for an item above the specified item
|
||||
wxLIST_NEXT_ALL, // Searches for subsequent item by index
|
||||
wxLIST_NEXT_BELOW, // Searches for an item below the specified item
|
||||
wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item
|
||||
wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item
|
||||
};
|
||||
|
||||
// Alignment flags for Arrange // always wxLIST_ALIGN_LEFT in wxGLC
|
||||
enum {
|
||||
wxLIST_ALIGN_DEFAULT,
|
||||
wxLIST_ALIGN_LEFT,
|
||||
wxLIST_ALIGN_TOP,
|
||||
wxLIST_ALIGN_SNAP_TO_GRID
|
||||
};
|
||||
|
||||
// Column format // always wxLIST_FORMAT_LEFT in wxGLC
|
||||
enum {
|
||||
wxLIST_FORMAT_LEFT,
|
||||
wxLIST_FORMAT_RIGHT,
|
||||
wxLIST_FORMAT_CENTRE,
|
||||
wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE
|
||||
};
|
||||
|
||||
// Autosize values for SetColumnWidth
|
||||
enum {
|
||||
wxLIST_AUTOSIZE = -1, // width of longest item
|
||||
wxLIST_AUTOSIZE_USEHEADER = -2 // always 80 in wxGLC
|
||||
};
|
||||
|
||||
// Flag values for GetItemRect
|
||||
enum {
|
||||
wxLIST_RECT_BOUNDS,
|
||||
wxLIST_RECT_ICON,
|
||||
wxLIST_RECT_LABEL
|
||||
};
|
||||
|
||||
// Flag values for FindItem // not supported by wxGLC
|
||||
enum {
|
||||
wxLIST_FIND_UP,
|
||||
wxLIST_FIND_DOWN,
|
||||
wxLIST_FIND_LEFT,
|
||||
wxLIST_FIND_RIGHT
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListItem
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxListItem: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxListItem)
|
||||
|
||||
public:
|
||||
long m_mask; // Indicates what fields are valid
|
||||
long m_itemId; // The zero-based item position
|
||||
int m_col; // Zero-based column, if in report mode
|
||||
long m_state; // The state of the item
|
||||
long m_stateMask; // Which flags of m_state are valid (uses same flags)
|
||||
wxString m_text; // The label/header text
|
||||
int m_image; // The zero-based index into an image list
|
||||
long m_data; // App-defined data
|
||||
wxColour *m_colour; // only wxGLC, not supported by Windows ;->
|
||||
|
||||
// For columns only
|
||||
int m_format; // left, right, centre
|
||||
int m_width; // width of column
|
||||
|
||||
wxListItem();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListItemData (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxListItemData : public wxObject
|
||||
{
|
||||
public:
|
||||
wxString m_text;
|
||||
int m_image;
|
||||
long m_data;
|
||||
int m_xpos,m_ypos;
|
||||
int m_width,m_height;
|
||||
wxColour *m_colour;
|
||||
|
||||
public:
|
||||
wxListItemData();
|
||||
wxListItemData( const wxListItem &info );
|
||||
void SetItem( const wxListItem &info );
|
||||
void SetText( const wxString &s );
|
||||
void SetImage( int image );
|
||||
void SetData( long data );
|
||||
void SetPosition( int x, int y );
|
||||
void SetSize( int width, int height );
|
||||
void SetColour( wxColour *col );
|
||||
bool HasImage() const;
|
||||
bool HasText() const;
|
||||
bool IsHit( int x, int y ) const;
|
||||
void GetText( wxString &s );
|
||||
int GetX( void ) const;
|
||||
int GetY( void ) const;
|
||||
int GetWidth() const;
|
||||
int GetHeight() const;
|
||||
int GetImage() const;
|
||||
void GetItem( wxListItem &info );
|
||||
wxColour *GetColour();
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxListItemData);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListHeaderData (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxListHeaderData : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxListHeaderData);
|
||||
|
||||
protected:
|
||||
long m_mask;
|
||||
int m_image;
|
||||
wxString m_text;
|
||||
int m_format;
|
||||
int m_width;
|
||||
int m_xpos,m_ypos;
|
||||
int m_height;
|
||||
|
||||
public:
|
||||
wxListHeaderData();
|
||||
wxListHeaderData( const wxListItem &info );
|
||||
void SetItem( const wxListItem &item );
|
||||
void SetPosition( int x, int y );
|
||||
void SetWidth( int w );
|
||||
void SetFormat( int format );
|
||||
void SetHeight( int h );
|
||||
bool HasImage() const;
|
||||
bool HasText() const;
|
||||
bool IsHit( int x, int y ) const;
|
||||
void GetItem( wxListItem &item );
|
||||
void GetText( wxString &s );
|
||||
int GetImage() const;
|
||||
int GetWidth() const;
|
||||
int GetFormat() const;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListLineData (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxListLineData : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxListLineData);
|
||||
|
||||
public:
|
||||
wxList m_items;
|
||||
wxRect m_bound_all;
|
||||
wxRect m_bound_label;
|
||||
wxRect m_bound_icon;
|
||||
wxRect m_bound_hilight;
|
||||
int m_mode;
|
||||
bool m_hilighted;
|
||||
wxBrush *m_hilightBrush;
|
||||
int m_spacing;
|
||||
wxListMainWindow *m_owner;
|
||||
|
||||
void DoDraw( wxDC *dc, bool hilight, bool paintBG );
|
||||
|
||||
public:
|
||||
wxListLineData() {};
|
||||
wxListLineData( wxListMainWindow *owner, int mode, wxBrush *hilightBrush );
|
||||
void CalculateSize( wxDC *dc, int spacing );
|
||||
void SetPosition( wxDC *dc, int x, int y, int window_width );
|
||||
void SetColumnPosition( int index, int x );
|
||||
void GetSize( int &width, int &height );
|
||||
void GetExtent( int &x, int &y, int &width, int &height );
|
||||
void GetLabelExtent( int &x, int &y, int &width, int &height );
|
||||
long IsHit( int x, int y );
|
||||
void InitItems( int num );
|
||||
void SetItem( int index, const wxListItem &info );
|
||||
void GetItem( int index, wxListItem &info );
|
||||
void GetText( int index, wxString &s );
|
||||
void SetText( int index, const wxString s );
|
||||
int GetImage( int index );
|
||||
void GetRect( wxRect &rect );
|
||||
void Hilight( bool on );
|
||||
void ReverseHilight();
|
||||
void DrawRubberBand( wxDC *dc, bool on );
|
||||
void Draw( wxDC *dc );
|
||||
bool IsInRect( int x, int y, const wxRect &rect );
|
||||
bool IsHilighted();
|
||||
void AssignRect( wxRect &dest, int x, int y, int width, int height );
|
||||
void AssignRect( wxRect &dest, const wxRect &source );
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListHeaderWindow (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxListHeaderWindow : public wxWindow
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxListHeaderWindow)
|
||||
|
||||
protected:
|
||||
wxListMainWindow *m_owner;
|
||||
wxCursor *m_currentCursor;
|
||||
wxCursor *m_resizeCursor;
|
||||
bool m_isDragging;
|
||||
int m_column;
|
||||
int m_minX;
|
||||
int m_currentX;
|
||||
|
||||
public:
|
||||
wxListHeaderWindow();
|
||||
~wxListHeaderWindow();
|
||||
wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMainWindow *owner,
|
||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
||||
long style = 0, const wxString &name = "columntitles" );
|
||||
void DoDrawRect( wxDC *dc, int x, int y, int w, int h );
|
||||
void OnPaint( wxPaintEvent &event );
|
||||
void DrawCurrent();
|
||||
void OnMouse( wxMouseEvent &event );
|
||||
void OnSetFocus( wxFocusEvent &event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListRenameTimer (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxListRenameTimer: public wxTimer
|
||||
{
|
||||
private:
|
||||
wxListMainWindow *m_owner;
|
||||
|
||||
public:
|
||||
wxListRenameTimer( wxListMainWindow *owner );
|
||||
void Notify();
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListTextCtrl (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxListTextCtrl: public wxTextCtrl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxListTextCtrl);
|
||||
|
||||
private:
|
||||
bool *m_accept;
|
||||
wxString *m_res;
|
||||
wxListMainWindow *m_owner;
|
||||
wxString m_startValue;
|
||||
|
||||
public:
|
||||
wxListTextCtrl() {};
|
||||
wxListTextCtrl( wxWindow *parent, const wxWindowID id,
|
||||
bool *accept, wxString *res, wxListMainWindow *owner,
|
||||
const wxString &value = "",
|
||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
||||
int style = 0, const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString &name = "wxListTextCtrlText" );
|
||||
void OnChar( wxKeyEvent &event );
|
||||
void OnKillFocus( wxFocusEvent &event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListMainWindow (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxListMainWindow: public wxScrolledWindow
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxListMainWindow);
|
||||
|
||||
public:
|
||||
long m_mode;
|
||||
wxList m_lines;
|
||||
wxList m_columns;
|
||||
wxListLineData *m_current;
|
||||
wxListLineData *m_currentEdit;
|
||||
int m_visibleLines;
|
||||
wxBrush *m_hilightBrush;
|
||||
wxColour *m_hilightColour;
|
||||
int m_xScroll,m_yScroll;
|
||||
bool m_dirty;
|
||||
wxImageList *m_small_image_list;
|
||||
wxImageList *m_normal_image_list;
|
||||
int m_small_spacing;
|
||||
int m_normal_spacing;
|
||||
bool m_hasFocus;
|
||||
bool m_usedKeys;
|
||||
bool m_lastOnSame;
|
||||
wxTimer *m_renameTimer;
|
||||
bool m_renameAccept;
|
||||
wxString m_renameRes;
|
||||
bool m_isCreated;
|
||||
int m_dragCount;
|
||||
wxPoint m_dragStart;
|
||||
|
||||
public:
|
||||
wxListMainWindow();
|
||||
wxListMainWindow( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
||||
long style = 0, const wxString &name = "listctrl" );
|
||||
~wxListMainWindow();
|
||||
void RefreshLine( wxListLineData *line );
|
||||
void OnPaint( wxPaintEvent &event );
|
||||
void HilightAll( bool on );
|
||||
void SendNotify( wxListLineData *line, wxEventType command );
|
||||
void FocusLine( wxListLineData *line );
|
||||
void UnfocusLine( wxListLineData *line );
|
||||
void SelectLine( wxListLineData *line );
|
||||
void DeselectLine( wxListLineData *line );
|
||||
void DeleteLine( wxListLineData *line );
|
||||
|
||||
void EditLabel( long item );
|
||||
void Edit( long item ) { EditLabel(item); } // deprecated
|
||||
void OnRenameTimer();
|
||||
void OnRenameAccept();
|
||||
|
||||
void OnMouse( wxMouseEvent &event );
|
||||
void MoveToFocus();
|
||||
void OnArrowChar( wxListLineData *newCurrent, bool shiftDown );
|
||||
void OnChar( wxKeyEvent &event );
|
||||
void OnKeyDown( wxKeyEvent &event );
|
||||
void OnSetFocus( wxFocusEvent &event );
|
||||
void OnKillFocus( wxFocusEvent &event );
|
||||
void OnSize( wxSizeEvent &event );
|
||||
|
||||
void DrawImage( int index, wxDC *dc, int x, int y );
|
||||
void GetImageSize( int index, int &width, int &height );
|
||||
int GetIndexOfLine( const wxListLineData *line );
|
||||
int GetTextLength( wxString &s ); // should be const
|
||||
|
||||
void SetImageList( wxImageList *imageList, int which );
|
||||
void SetItemSpacing( int spacing, bool isSmall = FALSE );
|
||||
int GetItemSpacing( bool isSmall = FALSE );
|
||||
void SetColumn( int col, wxListItem &item );
|
||||
void SetColumnWidth( int col, int width );
|
||||
void GetColumn( int col, wxListItem &item );
|
||||
int GetColumnWidth( int vol );
|
||||
int GetColumnCount();
|
||||
int GetCountPerPage();
|
||||
void SetItem( wxListItem &item );
|
||||
void GetItem( wxListItem &item );
|
||||
void SetItemState( long item, long state, long stateMask );
|
||||
int GetItemState( long item, long stateMask );
|
||||
int GetItemCount();
|
||||
void GetItemRect( long index, wxRect &rect );
|
||||
bool GetItemPosition( long item, wxPoint& pos );
|
||||
int GetSelectedItemCount();
|
||||
void SetMode( long mode );
|
||||
long GetMode() const;
|
||||
void CalculatePositions();
|
||||
void RealizeChanges();
|
||||
long GetNextItem( long item, int geometry, int state );
|
||||
void DeleteItem( long index );
|
||||
void DeleteAllItems();
|
||||
void DeleteColumn( int col );
|
||||
void DeleteEverything();
|
||||
void EnsureVisible( long index );
|
||||
long FindItem( long start, const wxString& str, bool partial = FALSE );
|
||||
long FindItem( long start, long data);
|
||||
long HitTest( int x, int y, int &flags );
|
||||
void InsertItem( wxListItem &item );
|
||||
// void AddItem( wxListItem &item );
|
||||
void InsertColumn( long col, wxListItem &item );
|
||||
// void AddColumn( wxListItem &item );
|
||||
void SortItems( wxListCtrlCompare fn, long data );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxListCtrl
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxListCtrl: public wxControl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxListCtrl);
|
||||
|
||||
public:
|
||||
wxListCtrl();
|
||||
wxListCtrl( wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
||||
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString &name = "listctrl" )
|
||||
{
|
||||
Create(parent, id, pos, size, style, validator, name);
|
||||
}
|
||||
~wxListCtrl();
|
||||
bool Create( wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
||||
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString &name = "listctrl" );
|
||||
void OnSize( wxSizeEvent &event );
|
||||
bool GetColumn( int col, wxListItem& item ) const;
|
||||
bool SetColumn( int col, wxListItem& item );
|
||||
int GetColumnWidth( int col ) const;
|
||||
bool SetColumnWidth( int col, int width);
|
||||
int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think
|
||||
bool GetItem( wxListItem& info ) const;
|
||||
bool SetItem( wxListItem& info ) ;
|
||||
long SetItem( long index, int col, const wxString& label, int imageId = -1 );
|
||||
int GetItemState( long item, long stateMask ) const;
|
||||
bool SetItemState( long item, long state, long stateMask);
|
||||
bool SetItemImage( long item, int image, int selImage);
|
||||
wxString GetItemText( long item ) const;
|
||||
void SetItemText( long item, const wxString& str );
|
||||
long GetItemData( long item ) const;
|
||||
bool SetItemData( long item, long data );
|
||||
bool GetItemRect( long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS ) const;
|
||||
bool GetItemPosition( long item, wxPoint& pos ) const;
|
||||
bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC
|
||||
int GetItemCount() const;
|
||||
int GetColumnCount() const;
|
||||
void SetItemSpacing( int spacing, bool isSmall = FALSE );
|
||||
int GetItemSpacing( bool isSmall ) const;
|
||||
int GetSelectedItemCount() const;
|
||||
// wxColour GetTextColour() const; // wxGLC has colours for every Item (see wxListItem)
|
||||
// void SetTextColour(const wxColour& col);
|
||||
long GetTopItem() const;
|
||||
void SetSingleStyle( long style, bool add = TRUE ) ;
|
||||
void SetWindowStyleFlag( long style );
|
||||
void RecreateWindow() {}
|
||||
long GetNextItem( long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE ) const;
|
||||
wxImageList *GetImageList( int which ) const;
|
||||
void SetImageList( wxImageList *imageList, int which );
|
||||
bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC
|
||||
|
||||
void ClearAll();
|
||||
bool DeleteItem( long item );
|
||||
bool DeleteAllItems();
|
||||
bool DeleteAllColumns();
|
||||
bool DeleteColumn( int col );
|
||||
|
||||
void EditLabel( long item ) { Edit(item); }
|
||||
void Edit( long item );
|
||||
|
||||
bool EnsureVisible( long item );
|
||||
long FindItem( long start, const wxString& str, bool partial = FALSE );
|
||||
long FindItem( long start, long data );
|
||||
long FindItem( long start, const wxPoint& pt, int direction ); // not supported in wxGLC
|
||||
long HitTest( const wxPoint& point, int& flags);
|
||||
long InsertItem(wxListItem& info);
|
||||
long InsertItem( long index, const wxString& label );
|
||||
long InsertItem( long index, int imageIndex );
|
||||
long InsertItem( long index, const wxString& label, int imageIndex );
|
||||
long InsertColumn( long col, wxListItem& info );
|
||||
long InsertColumn( long col, const wxString& heading, int format = wxLIST_FORMAT_LEFT,
|
||||
int width = -1 );
|
||||
bool ScrollList( int dx, int dy );
|
||||
bool SortItems( wxListCtrlCompare fn, long data );
|
||||
bool Update( long item );
|
||||
void OnIdle( wxIdleEvent &event );
|
||||
|
||||
// We have to hand down a few functions
|
||||
|
||||
bool SetBackgroundColour( const wxColour &colour );
|
||||
bool SetForegroundColour( const wxColour &colour );
|
||||
bool SetFont( const wxFont &font );
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
void SetDropTarget( wxDropTarget *dropTarget )
|
||||
{ m_mainWin->SetDropTarget( dropTarget ); }
|
||||
wxDropTarget *GetDropTarget() const
|
||||
{ return m_mainWin->GetDropTarget(); }
|
||||
#endif
|
||||
|
||||
bool SetCursor( const wxCursor &cursor )
|
||||
{ return m_mainWin ? m_mainWin->wxWindow::SetCursor(cursor) : FALSE; }
|
||||
wxColour GetBackgroundColour() const
|
||||
{ return m_mainWin ? m_mainWin->GetBackgroundColour() : wxColour(); }
|
||||
wxColour GetForegroundColour() const
|
||||
{ return m_mainWin ? m_mainWin->GetForegroundColour() : wxColour(); }
|
||||
bool DoPopupMenu( wxMenu *menu, int x, int y )
|
||||
{ return m_mainWin->PopupMenu( menu, x, y ); }
|
||||
void SetFocus()
|
||||
{ m_mainWin->SetFocus(); }
|
||||
|
||||
// implementation
|
||||
|
||||
wxImageList *m_imageListNormal;
|
||||
wxImageList *m_imageListSmall;
|
||||
wxImageList *m_imageListState; // what's that ?
|
||||
wxListHeaderWindow *m_headerWin;
|
||||
wxListMainWindow *m_mainWin;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __LISTCTRLH_G__
|
28
include/wx/generic/listview.xpm
Normal file
28
include/wx/generic/listview.xpm
Normal file
@@ -0,0 +1,28 @@
|
||||
/* XPM */
|
||||
static char * listview_xpm[] = {
|
||||
"20 20 3 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ................. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX.....XXX....X. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXXXX..XXX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX..XXXXXX...XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX.....XXX...XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXXXXXXXXX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" ................. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
|
60
include/wx/generic/msgdlgg.h
Normal file
60
include/wx/generic/msgdlgg.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: msgdlgg.h
|
||||
// Purpose: Generic wxMessageDialog
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __MSGDLGH_G__
|
||||
#define __MSGDLGH_G__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "msgdlgg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
#include "wx/dialog.h"
|
||||
|
||||
// type is an 'or' (|) of wxOK, wxCANCEL, wxYES_NO
|
||||
// Returns wxYES/NO/OK/CANCEL
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
|
||||
|
||||
class WXDLLEXPORT wxGenericMessageDialog: public wxDialog
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxGenericMessageDialog)
|
||||
|
||||
public:
|
||||
wxGenericMessageDialog(wxWindow *parent, const wxString& message,
|
||||
const wxString& caption = wxMessageBoxCaptionStr,
|
||||
long style = wxOK|wxCENTRE, const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
void OnYes(wxCommandEvent& event);
|
||||
void OnNo(wxCommandEvent& event);
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
int m_dialogStyle;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#if !defined( __WXMSW__ ) && !defined( __WXMAC__) && !defined(__WXPM__)
|
||||
#define wxMessageDialog wxGenericMessageDialog
|
||||
|
||||
int wxMessageBox( const wxString& message
|
||||
,const wxString& caption = wxMessageBoxCaptionStr
|
||||
,long style = wxOK|wxCENTRE
|
||||
,wxWindow *parent = (wxWindow *) NULL
|
||||
,int x = -1
|
||||
,int y = -1
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// __MSGDLGH_G__
|
42
include/wx/generic/new_dir.xpm
Normal file
42
include/wx/generic/new_dir.xpm
Normal file
@@ -0,0 +1,42 @@
|
||||
/* XPM */
|
||||
static char *new_dir_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"20 20 16 1",
|
||||
" c Gray0",
|
||||
". c #800000",
|
||||
"X c #008000",
|
||||
"o c #808000",
|
||||
"O c #000080",
|
||||
"+ c #800080",
|
||||
"@ c #008080",
|
||||
"# c None",
|
||||
"$ c #808080",
|
||||
"% c Red",
|
||||
"& c Green",
|
||||
"* c Yellow",
|
||||
"= c Blue",
|
||||
"- c Magenta",
|
||||
"; c Cyan",
|
||||
": c Gray100",
|
||||
/* pixels */
|
||||
"####################",
|
||||
"####################",
|
||||
"############# ######",
|
||||
"####################",
|
||||
"############# ######",
|
||||
"########## ##### ###",
|
||||
"##### ## # # ####",
|
||||
"#### *:*: ## # #####",
|
||||
"### ## # ##",
|
||||
"### :*:*:*:*: #####",
|
||||
"### *:*:*:*:* # ####",
|
||||
"### :*:*:*:*: ## ###",
|
||||
"### *:*:*:*:* ######",
|
||||
"### :*:*:*:*: ######",
|
||||
"### *:*:*:*:* ######",
|
||||
"### ######",
|
||||
"####################",
|
||||
"####################",
|
||||
"####################",
|
||||
"####################"
|
||||
};
|
203
include/wx/generic/notebook.h
Normal file
203
include/wx/generic/notebook.h
Normal file
@@ -0,0 +1,203 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: notebook.h
|
||||
// Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog)
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_NOTEBOOK_H_
|
||||
#define _WX_NOTEBOOK_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "notebook.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/event.h"
|
||||
#include "wx/control.h"
|
||||
#include "wx/generic/tabg.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// types
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// fwd declarations
|
||||
class WXDLLEXPORT wxImageList;
|
||||
class WXDLLEXPORT wxWindow;
|
||||
|
||||
// array of notebook pages
|
||||
typedef wxWindow wxNotebookPage; // so far, any window can be a page
|
||||
WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayPages);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxNotebook;
|
||||
|
||||
// This reuses wxTabView to draw the tabs.
|
||||
class WXDLLEXPORT wxNotebookTabView: public wxTabView
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxNotebookTabView)
|
||||
public:
|
||||
wxNotebookTabView(wxNotebook* notebook, long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR);
|
||||
~wxNotebookTabView(void);
|
||||
|
||||
// Called when a tab is activated
|
||||
virtual void OnTabActivate(int activateId, int deactivateId);
|
||||
|
||||
protected:
|
||||
wxNotebook* m_notebook;
|
||||
};
|
||||
|
||||
class wxNotebook : public wxControl
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
// -----
|
||||
// default for dynamic class
|
||||
wxNotebook();
|
||||
// the same arguments as for wxControl (@@@ any special styles?)
|
||||
wxNotebook(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = "notebook");
|
||||
// Create() function
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = "notebook");
|
||||
// dtor
|
||||
~wxNotebook();
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
// get number of pages in the dialog
|
||||
int GetPageCount() const;
|
||||
|
||||
// Find the position of the wxNotebookPage, -1 if not found.
|
||||
int FindPagePosition(wxNotebookPage* page) const;
|
||||
|
||||
// set the currently selected page, return the index of the previously
|
||||
// selected one (or -1 on error)
|
||||
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
|
||||
int SetSelection(int nPage);
|
||||
// cycle thru the tabs
|
||||
void AdvanceSelection(bool bForward = TRUE);
|
||||
// get the currently selected page
|
||||
int GetSelection() const { return m_nSelection; }
|
||||
|
||||
// set/get the title of a page
|
||||
bool SetPageText(int nPage, const wxString& strText);
|
||||
wxString GetPageText(int nPage) const;
|
||||
|
||||
// image list stuff: each page may have an image associated with it. All
|
||||
// the images belong to an image list, so you have to
|
||||
// 1) create an image list
|
||||
// 2) associate it with the notebook
|
||||
// 3) set for each page it's image
|
||||
// associate image list with a control
|
||||
void SetImageList(wxImageList* imageList);
|
||||
// get pointer (may be NULL) to the associated image list
|
||||
wxImageList* GetImageList() const { return m_pImageList; }
|
||||
|
||||
// sets/returns item's image index in the current image list
|
||||
int GetPageImage(int nPage) const;
|
||||
bool SetPageImage(int nPage, int nImage);
|
||||
|
||||
// currently it's always 1 because wxGTK doesn't support multi-row
|
||||
// tab controls
|
||||
int GetRowCount() const;
|
||||
|
||||
// control the appearance of the notebook pages
|
||||
// set the size (the same for all pages)
|
||||
void SetPageSize(const wxSize& size);
|
||||
// set the padding between tabs (in pixels)
|
||||
void SetPadding(const wxSize& padding);
|
||||
|
||||
// Sets the size of the tabs (assumes all tabs are the same size)
|
||||
void SetTabSize(const wxSize& sz);
|
||||
|
||||
// operations
|
||||
// ----------
|
||||
// remove one page from the notebook, and delete the page.
|
||||
bool DeletePage(int nPage);
|
||||
bool DeletePage(wxNotebookPage* page);
|
||||
// remove one page from the notebook, without deleting the page.
|
||||
bool RemovePage(int nPage);
|
||||
bool RemovePage(wxNotebookPage* page);
|
||||
// remove all pages
|
||||
bool DeleteAllPages();
|
||||
// adds a new page to the notebook (it will be deleted ny the notebook,
|
||||
// don't delete it yourself). If bSelect, this page becomes active.
|
||||
bool AddPage(wxNotebookPage *pPage,
|
||||
const wxString& strText,
|
||||
bool bSelect = FALSE,
|
||||
int imageId = -1);
|
||||
// the same as AddPage(), but adds it at the specified position
|
||||
bool InsertPage(int nPage,
|
||||
wxNotebookPage *pPage,
|
||||
const wxString& strText,
|
||||
bool bSelect = FALSE,
|
||||
int imageId = -1);
|
||||
// get the panel which represents the given page
|
||||
wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; }
|
||||
|
||||
// callbacks
|
||||
// ---------
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
void OnSelChange(wxNotebookEvent& event);
|
||||
void OnSetFocus(wxFocusEvent& event);
|
||||
void OnNavigationKey(wxNavigationKeyEvent& event);
|
||||
|
||||
// base class virtuals
|
||||
// -------------------
|
||||
virtual void Command(wxCommandEvent& event);
|
||||
virtual void SetConstraintSizes(bool recurse = TRUE);
|
||||
virtual bool DoPhase(int nPhase);
|
||||
|
||||
// Implementation
|
||||
|
||||
// wxNotebook on Motif uses a generic wxTabView to implement itself.
|
||||
wxTabView *GetTabView() const { return m_tabView; }
|
||||
void SetTabView(wxTabView *v) { m_tabView = v; }
|
||||
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
virtual wxRect GetAvailableClientSize();
|
||||
|
||||
// Implementation: calculate the layout of the view rect
|
||||
// and resize the children if required
|
||||
bool RefreshLayout(bool force = TRUE);
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// helper functions
|
||||
void ChangePage(int nOldSel, int nSel); // change pages
|
||||
|
||||
wxImageList *m_pImageList; // we can have an associated image list
|
||||
wxArrayPages m_aPages; // array of pages
|
||||
|
||||
int m_nSelection; // the current selection (-1 if none)
|
||||
|
||||
wxTabView* m_tabView;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxNotebook)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // _WX_NOTEBOOK_H_
|
101
include/wx/generic/panelg.h
Normal file
101
include/wx/generic/panelg.h
Normal file
@@ -0,0 +1,101 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: panelg.h
|
||||
// Purpose: wxPanel: similar to wxWindows but is coloured as for a dialog
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __PANELH_G__
|
||||
#define __PANELH_G__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "panelg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/button.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
||||
|
||||
class WXDLLEXPORT wxPanel : public wxWindow
|
||||
{
|
||||
public:
|
||||
wxPanel() { Init(); }
|
||||
|
||||
// Old-style constructor (no default values for coordinates to avoid
|
||||
// ambiguity with the new one)
|
||||
wxPanel(wxWindow *parent,
|
||||
int x, int y, int width, int height,
|
||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, -1, wxPoint(x, y), wxSize(width, height), style, name);
|
||||
}
|
||||
|
||||
// Constructor
|
||||
wxPanel(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
// Pseudo ctor
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
// Sends an OnInitDialog event, which in turns transfers data to
|
||||
// to the dialog via validators.
|
||||
virtual void InitDialog();
|
||||
|
||||
// a default button is activated when Enter is pressed
|
||||
wxButton *GetDefaultItem() const { return m_btnDefault; }
|
||||
void SetDefaultItem(wxButton *btn) { m_btnDefault = btn; }
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
// responds to colour changes
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
|
||||
// process a keyboard navigation message (Tab traversal)
|
||||
void OnNavigationKey(wxNavigationKeyEvent& event);
|
||||
|
||||
// set the focus to the first child if we get it
|
||||
void OnFocus(wxFocusEvent& event);
|
||||
|
||||
// called by wxWindow whenever it gets focus
|
||||
void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
|
||||
wxWindow *GetLastFocus() const { return m_winLastFocused; }
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// the child which had the focus last time this panel was activated
|
||||
wxWindow *m_winLastFocused;
|
||||
|
||||
// a default button or NULL
|
||||
wxButton *m_btnDefault;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxPanel)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
// __PANELH_G__
|
70
include/wx/generic/printps.h
Normal file
70
include/wx/generic/printps.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: printps.h
|
||||
// Purpose: wxPostScriptPrinter, wxPostScriptPrintPreview
|
||||
// wxGenericPageSetupDialog
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __PRINTPSH__
|
||||
#define __PRINTPSH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "printps.h"
|
||||
#endif
|
||||
|
||||
#include "wx/prntbase.h"
|
||||
|
||||
#if wxUSE_PRINTING_ARCHITECTURE
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Represents the printer: manages printing a wxPrintout object
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPostScriptPrinter : public wxPrinterBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPostScriptPrinter)
|
||||
|
||||
public:
|
||||
wxPostScriptPrinter(wxPrintDialogData *data = (wxPrintDialogData *) NULL);
|
||||
virtual ~wxPostScriptPrinter();
|
||||
|
||||
virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE);
|
||||
virtual wxDC* PrintDialog(wxWindow *parent);
|
||||
virtual bool Setup(wxWindow *parent);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxPrintPreview: programmer creates an object of this class to preview a
|
||||
// wxPrintout.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPostScriptPrintPreview : public wxPrintPreviewBase
|
||||
{
|
||||
DECLARE_CLASS(wxPostScriptPrintPreview)
|
||||
|
||||
public:
|
||||
wxPostScriptPrintPreview(wxPrintout *printout,
|
||||
wxPrintout *printoutForPrinting = (wxPrintout *) NULL,
|
||||
wxPrintDialogData *data = (wxPrintDialogData *) NULL);
|
||||
wxPostScriptPrintPreview(wxPrintout *printout,
|
||||
wxPrintout *printoutForPrinting,
|
||||
wxPrintData *data);
|
||||
|
||||
virtual ~wxPostScriptPrintPreview();
|
||||
|
||||
virtual bool Print(bool interactive);
|
||||
virtual void DetermineScaling();
|
||||
|
||||
private:
|
||||
void Init(wxPrintout *printout, wxPrintout *printoutForPrinting);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// __PRINTPSH__
|
196
include/wx/generic/prntdlgg.h
Normal file
196
include/wx/generic/prntdlgg.h
Normal file
@@ -0,0 +1,196 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: prntdlgg.h
|
||||
// Purpose: wxGenericPrintDialog, wxGenericPrintSetupDialog,
|
||||
// wxGenericPageSetupDialog
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __PRINTDLGH_G_
|
||||
#define __PRINTDLGH_G_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "prntdlgg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_PRINTING_ARCHITECTURE
|
||||
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/dialog.h"
|
||||
|
||||
#if wxUSE_POSTSCRIPT
|
||||
#include "wx/dcps.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxTextCtrl;
|
||||
class WXDLLEXPORT wxButton;
|
||||
class WXDLLEXPORT wxCheckBox;
|
||||
class WXDLLEXPORT wxComboBox;
|
||||
class WXDLLEXPORT wxStaticText;
|
||||
class WXDLLEXPORT wxRadioBox;
|
||||
class WXDLLEXPORT wxPrintSetupData;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// FIXME why all these enums start with 10 or 30?
|
||||
|
||||
enum
|
||||
{
|
||||
wxPRINTID_STATIC = 10,
|
||||
wxPRINTID_RANGE,
|
||||
wxPRINTID_FROM,
|
||||
wxPRINTID_TO,
|
||||
wxPRINTID_COPIES,
|
||||
wxPRINTID_PRINTTOFILE,
|
||||
wxPRINTID_SETUP
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
wxPRINTID_LEFTMARGIN = 30,
|
||||
wxPRINTID_RIGHTMARGIN,
|
||||
wxPRINTID_TOPMARGIN,
|
||||
wxPRINTID_BOTTOMMARGIN
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
wxPRINTID_PRINTCOLOUR = 10,
|
||||
wxPRINTID_ORIENTATION,
|
||||
wxPRINTID_COMMAND,
|
||||
wxPRINTID_OPTIONS,
|
||||
wxPRINTID_PAPERSIZE
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Simulated Print and Print Setup dialogs for non-Windows platforms (and
|
||||
// Windows using PostScript print/preview)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_POSTSCRIPT
|
||||
class WXDLLEXPORT wxGenericPrintDialog : public wxDialog
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog)
|
||||
|
||||
public:
|
||||
wxGenericPrintDialog(wxWindow *parent,
|
||||
wxPrintDialogData* data = (wxPrintDialogData*)NULL);
|
||||
wxGenericPrintDialog(wxWindow *parent, wxPrintData* data);
|
||||
|
||||
virtual ~wxGenericPrintDialog();
|
||||
|
||||
void OnSetup(wxCommandEvent& event);
|
||||
void OnRange(wxCommandEvent& event);
|
||||
void OnOK(wxCommandEvent& event);
|
||||
|
||||
virtual bool TransferDataFromWindow();
|
||||
virtual bool TransferDataToWindow();
|
||||
|
||||
virtual int ShowModal();
|
||||
|
||||
#if wxUSE_POSTSCRIPT
|
||||
wxPrintData& GetPrintData()
|
||||
{ return m_printDialogData.GetPrintData(); }
|
||||
#endif // wxUSE_POSTSCRIPT
|
||||
|
||||
wxPrintDialogData& GetPrintDialogData() { return m_printDialogData; }
|
||||
wxDC *GetPrintDC();
|
||||
|
||||
public:
|
||||
// wxStaticText* m_printerMessage;
|
||||
wxButton* m_setupButton;
|
||||
// wxButton* m_helpButton;
|
||||
wxRadioBox* m_rangeRadioBox;
|
||||
wxTextCtrl* m_fromText;
|
||||
wxTextCtrl* m_toText;
|
||||
wxTextCtrl* m_noCopiesText;
|
||||
wxCheckBox* m_printToFileCheckBox;
|
||||
// wxCheckBox* m_collateCopiesCheckBox;
|
||||
|
||||
wxPrintDialogData m_printDialogData;
|
||||
|
||||
protected:
|
||||
void Init(wxWindow *parent);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxGenericPrintSetupDialog : public wxDialog
|
||||
{
|
||||
DECLARE_CLASS(wxGenericPrintSetupDialog)
|
||||
|
||||
public:
|
||||
// There are no configuration options for the dialog, so we
|
||||
// just pass the wxPrintData object (no wxPrintSetupDialogData class needed)
|
||||
wxGenericPrintSetupDialog(wxWindow *parent, wxPrintData* data);
|
||||
wxGenericPrintSetupDialog(wxWindow *parent, wxPrintSetupData* data);
|
||||
virtual ~wxGenericPrintSetupDialog();
|
||||
|
||||
void Init(wxPrintData* data);
|
||||
|
||||
virtual bool TransferDataFromWindow();
|
||||
virtual bool TransferDataToWindow();
|
||||
|
||||
wxComboBox *CreatePaperTypeChoice(int* x, int* y);
|
||||
|
||||
public:
|
||||
wxRadioBox* m_orientationRadioBox;
|
||||
wxTextCtrl* m_printerCommandText;
|
||||
wxTextCtrl* m_printerOptionsText;
|
||||
wxCheckBox* m_colourCheckBox;
|
||||
wxComboBox* m_paperTypeChoice;
|
||||
|
||||
#if wxUSE_POSTSCRIPT
|
||||
wxPrintData m_printData;
|
||||
wxPrintData& GetPrintData() { return m_printData; }
|
||||
#endif // wxUSE_POSTSCRIPT
|
||||
};
|
||||
#endif
|
||||
// wxUSE_POSTSCRIPT
|
||||
|
||||
class WXDLLEXPORT wxGenericPageSetupDialog : public wxDialog
|
||||
{
|
||||
DECLARE_CLASS(wxGenericPageSetupDialog)
|
||||
|
||||
public:
|
||||
wxGenericPageSetupDialog(wxWindow *parent, wxPageSetupData* data = (wxPageSetupData*) NULL);
|
||||
virtual ~wxGenericPageSetupDialog();
|
||||
|
||||
virtual bool TransferDataFromWindow();
|
||||
virtual bool TransferDataToWindow();
|
||||
|
||||
void OnPrinter(wxCommandEvent& event);
|
||||
|
||||
wxComboBox *CreatePaperTypeChoice(int* x, int* y);
|
||||
wxPageSetupData& GetPageSetupData() { return m_pageData; }
|
||||
|
||||
public:
|
||||
wxButton* m_printerButton;
|
||||
wxRadioBox* m_orientationRadioBox;
|
||||
wxTextCtrl* m_marginLeftText;
|
||||
wxTextCtrl* m_marginTopText;
|
||||
wxTextCtrl* m_marginRightText;
|
||||
wxTextCtrl* m_marginBottomText;
|
||||
wxComboBox* m_paperTypeChoice;
|
||||
|
||||
static bool m_pageSetupDialogCancelled;
|
||||
|
||||
wxPageSetupData m_pageData;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// __PRINTDLGH_G__
|
111
include/wx/generic/progdlgg.h
Normal file
111
include/wx/generic/progdlgg.h
Normal file
@@ -0,0 +1,111 @@
|
||||
////////////////////////////////////////////////////
|
||||
// Name: progdlgg.h
|
||||
// Purpose: wxProgressDialog class
|
||||
// Author: Karsten Ball<6C>der
|
||||
// Modified by:
|
||||
// Created: 09.05.1999
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Karsten Ball<6C>der
|
||||
// Licence: wxWindows license
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __PROGDLGH_G__
|
||||
#define __PROGDLGH_G__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "progdlgg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
|
||||
#if wxUSE_PROGRESSDLG
|
||||
|
||||
#include "wx/dialog.h"
|
||||
|
||||
class WXDLLEXPORT wxButton;
|
||||
class WXDLLEXPORT wxStaticText;
|
||||
|
||||
/* Progress dialog which shows a moving progress bar.
|
||||
Taken from the Mahogany project.*/
|
||||
|
||||
class WXDLLEXPORT wxProgressDialog : public wxDialog
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxProgressDialog)
|
||||
public:
|
||||
/* Creates and displays dialog, disables event handling for other
|
||||
frames or parent frame to avoid recursion problems.
|
||||
@param title title for window
|
||||
@param message message to display in window
|
||||
@param maximum value for status bar, if <= 0, no bar is shown
|
||||
@param parent window or NULL
|
||||
@param style is the bit mask of wxPD_XXX constants from wx/defs.h
|
||||
*/
|
||||
wxProgressDialog(const wxString &title, wxString const &message,
|
||||
int maximum = 100,
|
||||
wxWindow *parent = NULL,
|
||||
int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE);
|
||||
/* Destructor.
|
||||
Re-enables event handling for other windows.
|
||||
*/
|
||||
~wxProgressDialog();
|
||||
|
||||
/* Update the status bar to the new value.
|
||||
@param value new value
|
||||
@param newmsg if used, new message to display
|
||||
@returns true if ABORT button has not been pressed
|
||||
*/
|
||||
bool Update(int value = -1, const wxString& newmsg = wxT(""));
|
||||
|
||||
/* Can be called to continue after the cancel button has been pressed, but
|
||||
the program decided to continue the operation (e.g., user didn't
|
||||
confirm it)
|
||||
*/
|
||||
void Resume() { m_state = Continue; }
|
||||
|
||||
// implementation from now on
|
||||
// callback for optional abort button
|
||||
void OnCancel(wxCommandEvent& event);
|
||||
// callback to disable "hard" window closing
|
||||
void OnClose(wxCloseEvent& event);
|
||||
|
||||
private:
|
||||
// create the label with given text and another one to show the time nearby
|
||||
// under the lastWindow and modify it to be the same as the control created
|
||||
// (which is returned)
|
||||
wxStaticText *CreateLabel(const wxString& text, wxWindow **lastWindow);
|
||||
|
||||
// the status bar
|
||||
class wxGauge *m_gauge;
|
||||
// the message displayed
|
||||
class wxStaticText *m_msg;
|
||||
// disable all or parent window only
|
||||
bool m_disableParentOnly;
|
||||
// auto-hide?
|
||||
bool m_AutoHide;
|
||||
// displayed elapsed, estimated, remaining time
|
||||
class wxStaticText *m_elapsed,
|
||||
*m_estimated,
|
||||
*m_remaining;
|
||||
// time when the dialog was created
|
||||
unsigned long m_timeStart;
|
||||
// parent window
|
||||
wxWindow *m_parent;
|
||||
// continue processing or not (return value for Update())
|
||||
enum
|
||||
{
|
||||
Uncancelable = -1, // dialog can't be canceled
|
||||
Canceled, // can be cancelled and, in fact, was
|
||||
Continue, // can be cancelled but wasn't
|
||||
Finished // finished, waiting to be removed from screen
|
||||
} m_state;
|
||||
// the abort button (or NULL if none)
|
||||
wxButton *m_btnAbort;
|
||||
// the maximum value
|
||||
int m_maximum;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// __PROGDLGH_G__
|
216
include/wx/generic/question.xpm
Normal file
216
include/wx/generic/question.xpm
Normal file
@@ -0,0 +1,216 @@
|
||||
/* XPM */
|
||||
static char * question_xpm[] = {
|
||||
"48 48 165 2",
|
||||
" c None",
|
||||
". c #000000",
|
||||
"+ c #080808",
|
||||
"@ c #2A2A2A",
|
||||
"# c #434343",
|
||||
"$ c #545454",
|
||||
"% c #626262",
|
||||
"& c #6A6A6A",
|
||||
"* c #6E6E6E",
|
||||
"= c #424242",
|
||||
"- c #525252",
|
||||
"; c #898989",
|
||||
"> c #DCDCDC",
|
||||
", c #E5E5E5",
|
||||
"' c #EDEDED",
|
||||
") c #F4F4F4",
|
||||
"! c #F9F9F9",
|
||||
"~ c #FCFCFC",
|
||||
"{ c #FFFFFF",
|
||||
"] c #888888",
|
||||
"^ c #4F4F4F",
|
||||
"/ c #050505",
|
||||
"( c #0F0F0F",
|
||||
"_ c #9C9C9C",
|
||||
": c #E6E6E6",
|
||||
"< c #9B9B9B",
|
||||
"[ c #1F1F1F",
|
||||
"} c #A1A1A1",
|
||||
"| c #E3E3E3",
|
||||
"1 c #4D4D4D",
|
||||
"2 c #D6D6D6",
|
||||
"3 c #ECECEC",
|
||||
"4 c #D9D9D9",
|
||||
"5 c #C6C6C6",
|
||||
"6 c #B0B0B0",
|
||||
"7 c #848484",
|
||||
"8 c #D3D3D3",
|
||||
"9 c #010101",
|
||||
"0 c #8B8B8B",
|
||||
"a c #F2F2F2",
|
||||
"b c #F3F3F3",
|
||||
"c c #A6A6A6",
|
||||
"d c #5E5E5E",
|
||||
"e c #2F2F2F",
|
||||
"f c #272727",
|
||||
"g c #202020",
|
||||
"h c #4E4E4E",
|
||||
"i c #8A8A8A",
|
||||
"j c #0B0B0B",
|
||||
"k c #B6B6B6",
|
||||
"l c #5D5D5D",
|
||||
"m c #131313",
|
||||
"n c #9A9A9A",
|
||||
"o c #C9C9C9",
|
||||
"p c #878787",
|
||||
"q c #0A0A0A",
|
||||
"r c #373737",
|
||||
"s c #DADADA",
|
||||
"t c #B4B4B4",
|
||||
"u c #B1B1B1",
|
||||
"v c #030303",
|
||||
"w c #767676",
|
||||
"x c #FDFDFD",
|
||||
"y c #FAFAFA",
|
||||
"z c #383838",
|
||||
"A c #F8F8F8",
|
||||
"B c #AFAFAF",
|
||||
"C c #070707",
|
||||
"D c #818181",
|
||||
"E c #555555",
|
||||
"F c #BDBDBD",
|
||||
"G c #7D7D7D",
|
||||
"H c #3C3C3C",
|
||||
"I c #F6F6F6",
|
||||
"J c #535353",
|
||||
"K c #242424",
|
||||
"L c #ABABAB",
|
||||
"M c #393939",
|
||||
"N c #BBBBBB",
|
||||
"O c #EAEAEA",
|
||||
"P c #A3A3A3",
|
||||
"Q c #4B4B4B",
|
||||
"R c #616161",
|
||||
"S c #CFCFCF",
|
||||
"T c #060606",
|
||||
"U c #EFEFEF",
|
||||
"V c #B9B9B9",
|
||||
"W c #303030",
|
||||
"X c #161616",
|
||||
"Y c #2C2C2C",
|
||||
"Z c #C0C0C0",
|
||||
"` c #2E2E2E",
|
||||
" . c #858585",
|
||||
".. c #E4E4E4",
|
||||
"+. c #1C1C1C",
|
||||
"@. c #D4D4D4",
|
||||
"#. c #828282",
|
||||
"$. c #C7C7C7",
|
||||
"%. c #3A3A3A",
|
||||
"&. c #090909",
|
||||
"*. c #151515",
|
||||
"=. c #8E8E8E",
|
||||
"-. c #F7F7F7",
|
||||
";. c #C4C4C4",
|
||||
">. c #EBEBEB",
|
||||
",. c #CECECE",
|
||||
"'. c #3D3D3D",
|
||||
"). c #676767",
|
||||
"!. c #F1F1F1",
|
||||
"~. c #FBFBFB",
|
||||
"{. c #353535",
|
||||
"]. c #212121",
|
||||
"^. c #EEEEEE",
|
||||
"/. c #444444",
|
||||
"(. c #DEDEDE",
|
||||
"_. c #020202",
|
||||
":. c #6B6B6B",
|
||||
"<. c #E1E1E1",
|
||||
"[. c #575757",
|
||||
"}. c #111111",
|
||||
"|. c #939393",
|
||||
"1. c #ADADAD",
|
||||
"2. c #6C6C6C",
|
||||
"3. c #929292",
|
||||
"4. c #4A4A4A",
|
||||
"5. c #1E1E1E",
|
||||
"6. c #3B3B3B",
|
||||
"7. c #A0A0A0",
|
||||
"8. c #696969",
|
||||
"9. c #FEFEFE",
|
||||
"0. c #CBCBCB",
|
||||
"a. c #F0F0F0",
|
||||
"b. c #0E0E0E",
|
||||
"c. c #DFDFDF",
|
||||
"d. c #808080",
|
||||
"e. c #D0D0D0",
|
||||
"f. c #636363",
|
||||
"g. c #323232",
|
||||
"h. c #D2D2D2",
|
||||
"i. c #333333",
|
||||
"j. c #292929",
|
||||
"k. c #484848",
|
||||
"l. c #646464",
|
||||
"m. c #F5F5F5",
|
||||
"n. c #B2B2B2",
|
||||
"o. c #494949",
|
||||
"p. c #E2E2E2",
|
||||
"q. c #3F3F3F",
|
||||
"r. c #0D0D0D",
|
||||
"s. c #E0E0E0",
|
||||
"t. c #2D2D2D",
|
||||
"u. c #3E3E3E",
|
||||
"v. c #C8C8C8",
|
||||
"w. c #D1D1D1",
|
||||
"x. c #7C7C7C",
|
||||
"y. c #141414",
|
||||
"z. c #A4A4A4",
|
||||
"A. c #C2C2C2",
|
||||
"B. c #262626",
|
||||
"C. c #191919",
|
||||
"D. c #999999",
|
||||
"E. c #0C0C0C",
|
||||
"F. c #101010",
|
||||
"G. c #787878",
|
||||
"H. c #797979",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" . . . . . . . . . . . . . . . . ",
|
||||
" . . . . + @ # $ % & * * & % $ = @ + . . . . ",
|
||||
" . . . . - ; > , ' ) ! ~ { { ~ ! ) ' , > ] ^ . . . . ",
|
||||
" . . / ( _ : { { { { { { { { { { { { { { { { { { : < ( / . . ",
|
||||
" . . [ } | { { { { { { { { { { { { { { { { { { { { { { | } [ . . ",
|
||||
" . . 1 2 { { { { { { { { 3 4 5 6 7 7 7 < 5 8 : ! { { { { { { 2 1 . . . ",
|
||||
" . . 9 0 a { { { { { { { b c d e 9 9 9 f 9 9 9 g h i 4 { { { { { { a ; 9 . . ",
|
||||
" . . j k { { { { { { { { ' l m 9 9 9 9 n o p 9 9 9 9 q r s { { { { { { { t q . . ",
|
||||
" . . + u { { { { { { { { { # v 9 9 9 9 w x { y z 9 9 9 9 9 @ A { { { { { { { B C . . ",
|
||||
" . . . D y { { { { { { { { { 9 9 9 9 9 j ' { { { E 9 9 9 9 9 9 F { { { { { { { y G . . . ",
|
||||
" . . H I { { { { { { { { { { J 9 9 9 9 ^ { { { { K 9 9 9 9 9 9 L { { { { { { { { I M . . . ",
|
||||
" . . . N { { { { { { { { { { { O P Q Q R S { { { } 9 9 9 9 9 9 T U { { { { { { { { { V . . . ",
|
||||
" . . W ! { { { { { { { { { { { { { { { { { { A 6 X 9 9 9 9 9 Y Z { { { { { { { { { { ! ` . . ",
|
||||
" . . .{ { { { { { { { { { { { { { { { { { ..7 ( 9 9 9 9 +.* @.{ { { { { { { { { { { { #.. . . ",
|
||||
". . . $.{ { { { { { { { { { { { { { { { { < %.&.9 9 9 *.=.5 -.{ { { { { { { { { { { { { ;.. . . ",
|
||||
". . . >.{ { { { { { { { { { { { { { { ,.'.+ . . . . ).!.~ { { { { { { { { { { { { { { { O . . . ",
|
||||
". . . ~.{ { { { { { { { { { { { { { O {.. . . . . ].^.{ { { { { { { { { { { { { { { { { ~.. . . ",
|
||||
". . . A { { { { { { { { { { { { { { k 9 9 9 9 9 9 /.{ { { { { { { { { { { { { { { { { { A . . . ",
|
||||
". . . (.{ { { { { { { { { { { { { { 5 _.. . . . . q :.4 U U <.{ { { { { { { { { { { { { > . . . ",
|
||||
". . . 6 { { { { { { { { { { { { { { { [.&.. . . . . . . . }.|.{ { { { { { { { { { { { { 1.. . . ",
|
||||
". . . 2.{ { { { { { { { { { { { { { { a 3.4.5.9 9 9 5.6.).7.a { { { { { { { { { { { { { 8.. . . ",
|
||||
" . . ( !.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.<.0.F F F 0.s a.9.9.9.9.9.9.9.9.9.9.9.9.9.9.!.b.. . . ",
|
||||
" . . . D { { { { { { { { { { { { { { { { { U c.c.c.U { { { { { { { { { { { { { { { { d.. . . ",
|
||||
" . . . ( 8 { { { { { { { { { { { { { { { e.f.g.g.g.f.;.{ { { { { { { { { { { { { { h.b.. . . ",
|
||||
" . . . 4.) { { { { { { { { { { { { { ' i.9 9 9 9 9 j.' { { { { { { { { { { { { ) k.. . . ",
|
||||
" . . . l.m.{ { { { { { { { { { { { n.. . . . . . . n.{ { { { { { { { { { { m.f.. . . . ",
|
||||
" . . . o.p.{ { { { { { { { { { { F 9 9 9 9 9 9 9 5 { { { { { { { { { { p.k.. . . . ",
|
||||
" . . . @ 0.{ { { { { { { { { { b q.. . . . . d { { { { { { { { { { b j.. . . . ",
|
||||
" . . . r.7.{ { { { { { { { { { s.* = t.= < 3 { { { { { { { { { { A e . . . ",
|
||||
" . . . . u._ >.y { { { { { { { { { { { { { { { { { { { { { { { { a - . . ",
|
||||
" . . . . . W % v., { { { { { { { { { { { { { { , w.e.>.{ { { { { U x.T ",
|
||||
" . . . . . y.f D z.A.4 >.-.x x -.>.4 A.z.d.B.C.C.Y i c h.{ { { ) D.. ",
|
||||
" . . . . . . / &.E.( F.}.}.F.b.E.&./ . . . . . 9 T E.}.] 5 ' ) G.. ",
|
||||
" . . . . . . . . . . . . . . . . . . . . . . . . . . . . M H.H.. ",
|
||||
" . . . . . . . . . . . . . . . . . . . . . . . . ",
|
||||
" . . . . ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
29
include/wx/generic/repview.xpm
Normal file
29
include/wx/generic/repview.xpm
Normal file
@@ -0,0 +1,29 @@
|
||||
/* XPM */
|
||||
static char * repview_xpm[] = {
|
||||
"20 20 3 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ................. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" ................. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX..XXXX.XX..XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXX.XX..XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXX.XX..XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" .XX...XXX.XX..XX. ",
|
||||
" .XXXXXXXXXXXXXXX. ",
|
||||
" ................. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
|
||||
|
218
include/wx/generic/sashwin.h
Normal file
218
include/wx/generic/sashwin.h
Normal file
@@ -0,0 +1,218 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: sashwin.h
|
||||
// Purpose: wxSashWindow implementation. A sash window has an optional
|
||||
// sash on each edge, allowing it to be dragged. An event
|
||||
// is generated when the sash is released.
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_SASHWIN_H_G_
|
||||
#define _WX_SASHWIN_H_G_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "sashwin.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_SASH
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/window.h"
|
||||
#include "wx/string.h"
|
||||
|
||||
#define wxSASH_DRAG_NONE 0
|
||||
#define wxSASH_DRAG_DRAGGING 1
|
||||
#define wxSASH_DRAG_LEFT_DOWN 2
|
||||
|
||||
enum wxSashEdgePosition {
|
||||
wxSASH_TOP = 0,
|
||||
wxSASH_RIGHT,
|
||||
wxSASH_BOTTOM,
|
||||
wxSASH_LEFT,
|
||||
wxSASH_NONE = 100
|
||||
};
|
||||
|
||||
/*
|
||||
* wxSashEdge represents one of the four edges of a window.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxSashEdge
|
||||
{
|
||||
public:
|
||||
wxSashEdge() { m_show = FALSE; m_border = FALSE; m_margin = 0; }
|
||||
|
||||
bool m_show; // Is the sash showing?
|
||||
bool m_border; // Do we draw a border?
|
||||
int m_margin; // The margin size
|
||||
};
|
||||
|
||||
/*
|
||||
* wxSashWindow flags
|
||||
*/
|
||||
|
||||
#define wxSW_3D 0x0004
|
||||
|
||||
/*
|
||||
* wxSashWindow allows any of its edges to have a sash which can be dragged
|
||||
* to resize the window. The actual content window will be created as a child
|
||||
* of wxSashWindow.
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxSashWindow: public wxWindow
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxSashWindow)
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Public API
|
||||
|
||||
// Default constructor
|
||||
wxSashWindow();
|
||||
|
||||
// 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");
|
||||
~wxSashWindow();
|
||||
|
||||
// Set whether there's a sash in this position
|
||||
void SetSashVisible(wxSashEdgePosition edge, bool sash);
|
||||
|
||||
// Get whether there's a sash in this position
|
||||
inline bool GetSashVisible(wxSashEdgePosition edge) const { return m_sashes[edge].m_show; }
|
||||
|
||||
// Set whether there's a border in this position
|
||||
inline void SetSashBorder(wxSashEdgePosition edge, bool border) { m_sashes[edge].m_border = border; }
|
||||
|
||||
// Get whether there's a border in this position
|
||||
inline bool HasBorder(wxSashEdgePosition edge) const { return m_sashes[edge].m_border; }
|
||||
|
||||
// Get border size
|
||||
inline int GetEdgeMargin(wxSashEdgePosition edge) const { return m_sashes[edge].m_margin; }
|
||||
|
||||
// Sets the default sash border size
|
||||
inline void SetDefaultBorderSize(int width) { m_borderSize = width; }
|
||||
|
||||
// Gets the default sash border size
|
||||
inline int GetDefaultBorderSize() const { return m_borderSize; }
|
||||
|
||||
// Sets the addition border size between child and sash window
|
||||
inline void SetExtraBorderSize(int width) { m_extraBorderSize = width; }
|
||||
|
||||
// Gets the addition border size between child and sash window
|
||||
inline int GetExtraBorderSize() const { return m_extraBorderSize; }
|
||||
|
||||
virtual void SetMinimumSizeX(int min) { m_minimumPaneSizeX = min; }
|
||||
virtual void SetMinimumSizeY(int min) { m_minimumPaneSizeY = min; }
|
||||
virtual int GetMinimumSizeX() const { return m_minimumPaneSizeX; }
|
||||
virtual int GetMinimumSizeY() const { return m_minimumPaneSizeY; }
|
||||
|
||||
virtual void SetMaximumSizeX(int max) { m_maximumPaneSizeX = max; }
|
||||
virtual void SetMaximumSizeY(int max) { m_maximumPaneSizeY = max; }
|
||||
virtual int GetMaximumSizeX() const { return m_maximumPaneSizeX; }
|
||||
virtual int GetMaximumSizeY() const { return m_maximumPaneSizeY; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation
|
||||
|
||||
// Paints the border and sash
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
// Handles mouse events
|
||||
void OnMouseEvent(wxMouseEvent& ev);
|
||||
|
||||
// Adjusts the panes
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
// Draws borders
|
||||
void DrawBorders(wxDC& dc);
|
||||
|
||||
// Draws the sashes
|
||||
void DrawSash(wxSashEdgePosition edge, wxDC& dc);
|
||||
|
||||
// Draws the sashes
|
||||
void DrawSashes(wxDC& dc);
|
||||
|
||||
// Draws the sash tracker (for whilst moving the sash)
|
||||
void DrawSashTracker(wxSashEdgePosition edge, int x, int y);
|
||||
|
||||
// Tests for x, y over sash
|
||||
wxSashEdgePosition SashHitTest(int x, int y, int tolerance = 2);
|
||||
|
||||
// Resizes subwindows
|
||||
void SizeWindows();
|
||||
|
||||
// Initialize colours
|
||||
void InitColours();
|
||||
|
||||
protected:
|
||||
wxSashEdge m_sashes[4];
|
||||
int m_dragMode;
|
||||
wxSashEdgePosition m_draggingEdge;
|
||||
int m_oldX;
|
||||
int m_oldY;
|
||||
int m_borderSize;
|
||||
int m_extraBorderSize;
|
||||
int m_firstX;
|
||||
int m_firstY;
|
||||
int m_minimumPaneSizeX;
|
||||
int m_minimumPaneSizeY;
|
||||
int m_maximumPaneSizeX;
|
||||
int m_maximumPaneSizeY;
|
||||
wxCursor* m_sashCursorWE;
|
||||
wxCursor* m_sashCursorNS;
|
||||
wxColour m_lightShadowColour;
|
||||
wxColour m_mediumShadowColour;
|
||||
wxColour m_darkShadowColour;
|
||||
wxColour m_hilightColour;
|
||||
wxColour m_faceColour;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#define wxEVT_SASH_DRAGGED (wxEVT_FIRST + 1200)
|
||||
|
||||
enum wxSashDragStatus
|
||||
{
|
||||
wxSASH_STATUS_OK,
|
||||
wxSASH_STATUS_OUT_OF_RANGE
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxSashEvent: public wxCommandEvent
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxSashEvent)
|
||||
|
||||
public:
|
||||
inline wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE) {
|
||||
m_eventType = (wxEventType) wxEVT_SASH_DRAGGED; m_id = id; m_edge = edge; }
|
||||
|
||||
inline void SetEdge(wxSashEdgePosition edge) { m_edge = edge; }
|
||||
inline wxSashEdgePosition GetEdge() const { return m_edge; }
|
||||
|
||||
//// The rectangle formed by the drag operation
|
||||
inline void SetDragRect(const wxRect& rect) { m_dragRect = rect; }
|
||||
inline wxRect GetDragRect() const { return m_dragRect; }
|
||||
|
||||
//// Whether the drag caused the rectangle to be reversed (e.g.
|
||||
//// dragging the top below the bottom)
|
||||
inline void SetDragStatus(wxSashDragStatus status) { m_dragStatus = status; }
|
||||
inline wxSashDragStatus GetDragStatus() const { return m_dragStatus; }
|
||||
private:
|
||||
wxSashEdgePosition m_edge;
|
||||
wxRect m_dragRect;
|
||||
wxSashDragStatus m_dragStatus;
|
||||
};
|
||||
|
||||
typedef void (wxEvtHandler::*wxSashEventFunction)(wxSashEvent&);
|
||||
|
||||
#define EVT_SASH_DRAGGED(id, fn) { wxEVT_SASH_DRAGGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxSashEventFunction) & fn, NULL },
|
||||
#define EVT_SASH_DRAGGED_RANGE(id1, id2, fn) { wxEVT_SASH_DRAGGED, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxSashEventFunction) & fn, NULL },
|
||||
|
||||
#endif // wxUSE_SASH
|
||||
|
||||
#endif
|
||||
// _WX_SASHWIN_H_G_
|
@@ -1,90 +1,135 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/generic/scrolwin.h
|
||||
// Purpose: wxGenericScrolledWindow class
|
||||
// Name: scrolwin.h
|
||||
// Purpose: wxScrolledWindow class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GENERIC_SCROLLWIN_H_
|
||||
#define _WX_GENERIC_SCROLLWIN_H_
|
||||
#ifndef __SCROLWINH_G__
|
||||
#define __SCROLWINH_G__
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers and constants
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "scrolwin.h"
|
||||
#endif
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
extern WXDLLEXPORT_DATA(const wxChar*) wxPanelNameStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
||||
|
||||
// default scrolled window style
|
||||
#ifndef wxScrolledWindowStyle
|
||||
#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGenericScrolledWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxGenericScrolledWindow : public wxPanel,
|
||||
public wxScrollHelper
|
||||
class WXDLLEXPORT wxScrolledWindow : public wxPanel
|
||||
{
|
||||
public:
|
||||
wxGenericScrolledWindow() : wxScrollHelper(this) { }
|
||||
wxGenericScrolledWindow(wxWindow *parent,
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
: wxScrollHelper(this)
|
||||
wxScrolledWindow();
|
||||
inline wxScrolledWindow(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxHSCROLL|wxVSCROLL,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{
|
||||
Create(parent, winid, pos, size, style, name);
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
virtual ~wxGenericScrolledWindow();
|
||||
~wxScrolledWindow();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxHSCROLL|wxVSCROLL,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
|
||||
// Normally the wxScrolledWindow will scroll itself, but in
|
||||
// some rare occasions you might want it to scroll another
|
||||
// window (e.g. a child of it in order to scroll only a portion
|
||||
// the area between the scrollbars (spreadsheet: only cell area
|
||||
// will move).
|
||||
virtual void SetTargetWindow( wxWindow *target );
|
||||
virtual wxWindow *GetTargetWindow();
|
||||
|
||||
// lay out the window and its children
|
||||
virtual bool Layout();
|
||||
// Number of pixels per user unit (0 or -1 for no scrollbar)
|
||||
// Length of virtual canvas in user units
|
||||
// Length of page in user units
|
||||
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
|
||||
int noUnitsX, int noUnitsY,
|
||||
int xPos = 0, int yPos = 0,
|
||||
bool noRefresh = FALSE );
|
||||
|
||||
virtual void DoSetVirtualSize(int x, int y);
|
||||
// Physically scroll the window
|
||||
virtual void Scroll(int x_pos, int y_pos);
|
||||
|
||||
// wxWindow's GetBestVirtualSize returns the actual window size,
|
||||
// whereas we want to return the virtual size
|
||||
virtual wxSize GetBestVirtualSize() const;
|
||||
#if WXWIN_COMPATIBILITY
|
||||
virtual void GetScrollUnitsPerPage(int *x_page, int *y_page) const;
|
||||
virtual void CalcUnscrolledPosition(int x, int y, float *xx, float *yy) const ;
|
||||
#endif
|
||||
|
||||
// Return the size best suited for the current window
|
||||
// (this isn't a virtual size, this is a sensible size for the window)
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
int GetScrollPageSize(int orient) const ;
|
||||
void SetScrollPageSize(int orient, int pageSize);
|
||||
|
||||
protected:
|
||||
// this is needed for wxEVT_PAINT processing hack described in
|
||||
// wxScrollHelperEvtHandler::ProcessEvent()
|
||||
virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
|
||||
|
||||
// Enable/disable Windows scrolling in either direction.
|
||||
// If TRUE, wxWindows scrolls the canvas and only a bit of
|
||||
// the canvas is invalidated; no Clear() is necessary.
|
||||
// If FALSE, the whole canvas is invalidated and a Clear() is
|
||||
// necessary. Disable for when the scroll increment is used
|
||||
// to actually scroll a non-constant distance
|
||||
virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
|
||||
|
||||
// Get the view start
|
||||
virtual void ViewStart(int *x, int *y) const;
|
||||
|
||||
// Actual size in pixels when scrolling is taken into account
|
||||
virtual void GetVirtualSize(int *x, int *y) const;
|
||||
|
||||
// Set the scale factor, used in PrepareDC
|
||||
void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
|
||||
double GetScaleX() const { return m_scaleX; }
|
||||
double GetScaleY() const { return m_scaleY; }
|
||||
|
||||
virtual void CalcScrolledPosition(int x, int y, int *xx, int *yy) const ;
|
||||
virtual void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const ;
|
||||
|
||||
// Adjust the scrollbars
|
||||
virtual void AdjustScrollbars(void);
|
||||
|
||||
// Override this function to draw the graphic (or just process EVT_PAINT)
|
||||
virtual void OnDraw(wxDC& WXUNUSED(dc)) {};
|
||||
|
||||
// Override this function if you don't want to have wxScrolledWindow
|
||||
// automatically change the origin according to the scroll position.
|
||||
virtual void PrepareDC(wxDC& dc);
|
||||
|
||||
// implementation from now on
|
||||
void OnScroll(wxScrollWinEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
// we need to return a special WM_GETDLGCODE value to process just the
|
||||
// arrows but let the other navigation characters through
|
||||
#ifdef __WXMSW__
|
||||
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
#endif // __WXMSW__
|
||||
// Calculate scroll increment
|
||||
virtual int CalcScrollInc(wxScrollWinEvent& event);
|
||||
|
||||
protected:
|
||||
wxWindow *m_targetWindow;
|
||||
int m_xScrollPixelsPerLine;
|
||||
int m_yScrollPixelsPerLine;
|
||||
bool m_xScrollingEnabled;
|
||||
bool m_yScrollingEnabled;
|
||||
int m_xScrollPosition;
|
||||
int m_yScrollPosition;
|
||||
int m_xScrollLines;
|
||||
int m_yScrollLines;
|
||||
int m_xScrollLinesPerPage;
|
||||
int m_yScrollLinesPerPage;
|
||||
double m_scaleX;
|
||||
double m_scaleY;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericScrolledWindow)
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_ABSTRACT_CLASS(wxScrolledWindow)
|
||||
};
|
||||
|
||||
#endif // _WX_GENERIC_SCROLLWIN_H_
|
||||
|
||||
#endif
|
||||
// __SCROLWINH_G__
|
||||
|
338
include/wx/generic/splitter.h
Normal file
338
include/wx/generic/splitter.h
Normal file
@@ -0,0 +1,338 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: splitter.h
|
||||
// Purpose: wxSplitterWindow class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __SPLITTERH_G__
|
||||
#define __SPLITTERH_G__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "splitter.h"
|
||||
#endif
|
||||
|
||||
#include "wx/window.h" // base class declaration
|
||||
|
||||
class WXDLLEXPORT wxSplitterEvent;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// splitter constants
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
enum
|
||||
{
|
||||
wxSPLIT_HORIZONTAL = 1,
|
||||
wxSPLIT_VERTICAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
wxSPLIT_DRAG_NONE,
|
||||
wxSPLIT_DRAG_DRAGGING,
|
||||
wxSPLIT_DRAG_LEFT_DOWN
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxSplitterWindow maintains one or two panes, with
|
||||
// an optional vertical or horizontal split which
|
||||
// can be used with the mouse or programmatically.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// TODO:
|
||||
// 1) Perhaps make the borders sensitive to dragging in order to create a split.
|
||||
// The MFC splitter window manages scrollbars as well so is able to
|
||||
// put sash buttons on the scrollbars, but we probably don't want to go down
|
||||
// this path.
|
||||
// 2) for wxWindows 2.0, we must find a way to set the WS_CLIPCHILDREN style
|
||||
// to prevent flickering. (WS_CLIPCHILDREN doesn't work in all cases so can't be
|
||||
// standard).
|
||||
|
||||
class WXDLLEXPORT wxSplitterWindow: public wxWindow
|
||||
{
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Public API
|
||||
|
||||
// Default constructor
|
||||
wxSplitterWindow();
|
||||
|
||||
// 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");
|
||||
~wxSplitterWindow();
|
||||
|
||||
// Gets the only or left/top pane
|
||||
wxWindow *GetWindow1() const { return m_windowOne; }
|
||||
|
||||
// Gets the right/bottom pane
|
||||
wxWindow *GetWindow2() const { return m_windowTwo; }
|
||||
|
||||
// Sets the split mode
|
||||
void SetSplitMode(int mode) { m_splitMode = mode; }
|
||||
|
||||
// Gets the split mode
|
||||
int GetSplitMode() const { return m_splitMode; };
|
||||
|
||||
// Initialize with one window
|
||||
void Initialize(wxWindow *window);
|
||||
|
||||
// Associates the given window with window 2, drawing the appropriate sash
|
||||
// and changing the split mode.
|
||||
// Does nothing and returns FALSE if the window is already split.
|
||||
// A sashPosition of 0 means choose a default sash position,
|
||||
// negative sashPosition specifies the size of right/lower pane as it's
|
||||
// absolute value rather than the size of left/upper pane.
|
||||
virtual bool SplitVertically(wxWindow *window1,
|
||||
wxWindow *window2,
|
||||
int sashPosition = 0);
|
||||
virtual bool SplitHorizontally(wxWindow *window1,
|
||||
wxWindow *window2,
|
||||
int sashPosition = 0);
|
||||
|
||||
// Removes the specified (or second) window from the view
|
||||
// Doesn't actually delete the window.
|
||||
bool Unsplit(wxWindow *toRemove = (wxWindow *) NULL);
|
||||
|
||||
// Replaces one of the windows with another one (neither old nor new
|
||||
// parameter should be NULL)
|
||||
bool ReplaceWindow(wxWindow *winOld, wxWindow *winNew);
|
||||
|
||||
// Is the window split?
|
||||
bool IsSplit() const { return (m_windowTwo != NULL); }
|
||||
|
||||
// Sets the sash size
|
||||
void SetSashSize(int width) { m_sashSize = width; }
|
||||
|
||||
// Sets the border size
|
||||
void SetBorderSize(int width) { m_borderSize = width; }
|
||||
|
||||
// Gets the sash size
|
||||
int GetSashSize() const { return m_sashSize; }
|
||||
|
||||
// Gets the border size
|
||||
int GetBorderSize() const { return m_borderSize; }
|
||||
|
||||
// Set the sash position
|
||||
void SetSashPosition(int position, bool redraw = TRUE);
|
||||
|
||||
// Gets the sash position
|
||||
int GetSashPosition() const { return m_sashPosition; }
|
||||
|
||||
// If this is zero, we can remove panes by dragging the sash.
|
||||
void SetMinimumPaneSize(int min) { m_minimumPaneSize = min; }
|
||||
int GetMinimumPaneSize() const { return m_minimumPaneSize; }
|
||||
|
||||
// Called when the sash position is about to be changed, return
|
||||
// FALSE from here to prevent the change from taking place.
|
||||
// Repositions sash to minimum position if pane would be too small.
|
||||
// newSashPosition here is always positive or zero.
|
||||
virtual bool OnSashPositionChange(int WXUNUSED(newSashPosition))
|
||||
{ return TRUE; }
|
||||
|
||||
// If the sash is moved to an extreme position, a subwindow
|
||||
// is removed from the splitter window, and the app is
|
||||
// notified. The app should delete or hide the window.
|
||||
virtual void OnUnsplit(wxWindow *WXUNUSED(removed)) { }
|
||||
|
||||
// Called when the sash is double-clicked.
|
||||
// The default behaviour is to remove the sash if the
|
||||
// minimum pane size is zero.
|
||||
virtual void OnDoubleClickSash(int WXUNUSED(x), int WXUNUSED(y)) { }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Implementation
|
||||
|
||||
// Paints the border and sash
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
// Handles mouse events
|
||||
void OnMouseEvent(wxMouseEvent& ev);
|
||||
|
||||
// Adjusts the panes
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
// In live mode, resize child windows in idle time
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
// Draws borders
|
||||
void DrawBorders(wxDC& dc);
|
||||
|
||||
// Draws the sash
|
||||
void DrawSash(wxDC& dc);
|
||||
|
||||
// Draws the sash tracker (for whilst moving the sash)
|
||||
void DrawSashTracker(int x, int y);
|
||||
|
||||
// Tests for x, y over sash
|
||||
bool SashHitTest(int x, int y, int tolerance = 2);
|
||||
|
||||
// Resizes subwindows
|
||||
void SizeWindows();
|
||||
|
||||
// Initialize colours
|
||||
void InitColours();
|
||||
|
||||
protected:
|
||||
// our event handlers
|
||||
void OnSashPosChanged(wxSplitterEvent& event);
|
||||
void OnSashPosChanging(wxSplitterEvent& event);
|
||||
void OnDoubleClick(wxSplitterEvent& event);
|
||||
void OnUnsplitEvent(wxSplitterEvent& event);
|
||||
|
||||
void SendUnsplitEvent(wxWindow *winRemoved);
|
||||
|
||||
int m_splitMode;
|
||||
bool m_permitUnsplitAlways;
|
||||
bool m_needUpdating; // when in live mode, set the to TRUE to resize children in idle
|
||||
wxWindow* m_windowOne;
|
||||
wxWindow* m_windowTwo;
|
||||
int m_dragMode;
|
||||
int m_oldX;
|
||||
int m_oldY;
|
||||
int m_borderSize;
|
||||
int m_sashSize; // Sash width or height
|
||||
int m_sashPosition; // Number of pixels from left or top
|
||||
int m_firstX;
|
||||
int m_firstY;
|
||||
int m_minimumPaneSize;
|
||||
wxCursor* m_sashCursorWE;
|
||||
wxCursor* m_sashCursorNS;
|
||||
wxPen* m_sashTrackerPen;
|
||||
wxPen* m_lightShadowPen;
|
||||
wxPen* m_mediumShadowPen;
|
||||
wxPen* m_darkShadowPen;
|
||||
wxPen* m_hilightPen;
|
||||
wxBrush* m_faceBrush;
|
||||
wxPen* m_facePen;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxSplitterWindow)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event class and macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// we reuse the same class for all splitter event types because this is the
|
||||
// usual wxWin convention, but the three event types have different kind of
|
||||
// data associated with them, so the accessors can be only used if the real
|
||||
// event type matches with the one for which the accessors make sense
|
||||
class WXDLLEXPORT wxSplitterEvent : public wxCommandEvent
|
||||
{
|
||||
public:
|
||||
wxSplitterEvent(wxEventType type = wxEVT_NULL,
|
||||
wxSplitterWindow *splitter = (wxSplitterWindow *)NULL)
|
||||
: wxCommandEvent(type)
|
||||
{
|
||||
SetEventObject(splitter);
|
||||
}
|
||||
|
||||
// SASH_POS_CHANGED methods
|
||||
|
||||
// setting the sash position to -1 prevents the change from taking place at
|
||||
// all
|
||||
void SetSashPosition(int pos)
|
||||
{
|
||||
wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED
|
||||
|| GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING);
|
||||
|
||||
m_data.pos = pos;
|
||||
}
|
||||
|
||||
int GetSashPosition() const
|
||||
{
|
||||
wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED
|
||||
|| GetEventType() == wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING);
|
||||
|
||||
return m_data.pos;
|
||||
}
|
||||
|
||||
// UNSPLIT event methods
|
||||
wxWindow *GetWindowBeingRemoved() const
|
||||
{
|
||||
wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_UNSPLIT );
|
||||
|
||||
return m_data.win;
|
||||
}
|
||||
|
||||
// DCLICK event methods
|
||||
int GetX() const
|
||||
{
|
||||
wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_DOUBLECLICKED );
|
||||
|
||||
return m_data.pt.x;
|
||||
}
|
||||
|
||||
int GetY() const
|
||||
{
|
||||
wxASSERT( GetEventType() == wxEVT_COMMAND_SPLITTER_DOUBLECLICKED );
|
||||
|
||||
return m_data.pt.y;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class WXDLLEXPORT wxSplitterWindow;
|
||||
|
||||
// data for the different types of event
|
||||
union
|
||||
{
|
||||
int pos; // position for SASH_POS_CHANGED event
|
||||
wxWindow *win; // window being removed for UNSPLIT event
|
||||
struct
|
||||
{
|
||||
int x, y;
|
||||
} pt; // position of double click for DCLICK event
|
||||
} m_data;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxSplitterEvent)
|
||||
};
|
||||
|
||||
typedef void (wxEvtHandler::*wxSplitterEventFunction)(wxSplitterEvent&);
|
||||
|
||||
#define EVT_SPLITTER_SASH_POS_CHANGED(id, fn) \
|
||||
{ \
|
||||
wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, \
|
||||
id, \
|
||||
-1, \
|
||||
(wxObjectEventFunction)(wxEventFunction)(wxSplitterEventFunction) &fn, \
|
||||
NULL \
|
||||
},
|
||||
|
||||
#define EVT_SPLITTER_SASH_POS_CHANGING(id, fn) \
|
||||
{ \
|
||||
wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, \
|
||||
id, \
|
||||
-1, \
|
||||
(wxObjectEventFunction)(wxEventFunction)(wxSplitterEventFunction) &fn, \
|
||||
NULL \
|
||||
},
|
||||
|
||||
#define EVT_SPLITTER_DCLICK(id, fn) \
|
||||
{ \
|
||||
wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, \
|
||||
id, \
|
||||
-1, \
|
||||
(wxObjectEventFunction)(wxEventFunction)(wxSplitterEventFunction) &fn, \
|
||||
NULL \
|
||||
},
|
||||
|
||||
#define EVT_SPLITTER_UNSPLIT(id, fn) \
|
||||
{ \
|
||||
wxEVT_COMMAND_SPLITTER_UNSPLIT, \
|
||||
id, \
|
||||
-1, \
|
||||
(wxObjectEventFunction)(wxEventFunction)(wxSplitterEventFunction) &fn, \
|
||||
NULL \
|
||||
},
|
||||
|
||||
#endif // __SPLITTERH_G__
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user