removed stubs and qt 'ports'
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10334 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
393
src/qt/app.cpp
393
src/qt/app.cpp
@@ -1,393 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: app.cpp
|
||||
// Purpose: wxApp
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "app.h"
|
||||
#endif
|
||||
|
||||
#include "wx/frame.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/pen.h"
|
||||
#include "wx/brush.h"
|
||||
#include "wx/cursor.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/palette.h"
|
||||
#include "wx/dc.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/msgdlg.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/module.h"
|
||||
|
||||
#if wxUSE_WX_RESOURCES
|
||||
#include "wx/resource.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__WIN95__) && !defined(__GNUWIN32__)
|
||||
extern char *wxBuffer;
|
||||
extern wxList wxPendingDelete;
|
||||
|
||||
wxApp *wxTheApp = NULL;
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
|
||||
BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
|
||||
EVT_IDLE(wxApp::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
long wxApp::sm_lastMessageTime = 0;
|
||||
|
||||
void wxApp::CommonInit()
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
wxBuffer = new char[1500];
|
||||
#else
|
||||
wxBuffer = new char[BUFSIZ + 512];
|
||||
#endif
|
||||
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
|
||||
wxTheColourDatabase->Initialize();
|
||||
wxInitializeStockObjects();
|
||||
|
||||
#if wxUSE_WX_RESOURCES
|
||||
wxInitializeResourceSystem();
|
||||
#endif
|
||||
|
||||
// For PostScript printing
|
||||
#if wxUSE_POSTSCRIPT
|
||||
wxInitializePrintSetupData();
|
||||
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
|
||||
wxThePrintPaperDatabase->CreateDatabase();
|
||||
#endif
|
||||
|
||||
wxBitmap::InitStandardHandlers();
|
||||
|
||||
wxModule::RegisterModules();
|
||||
wxASSERT( wxModule::InitializeModules() == TRUE );
|
||||
}
|
||||
|
||||
void wxApp::CommonCleanUp()
|
||||
{
|
||||
wxModule::CleanUpModules();
|
||||
|
||||
#if wxUSE_WX_RESOURCES
|
||||
wxCleanUpResourceSystem();
|
||||
#endif
|
||||
|
||||
wxDeleteStockObjects() ;
|
||||
|
||||
// Destroy all GDI lists, etc.
|
||||
delete wxTheBrushList;
|
||||
wxTheBrushList = NULL;
|
||||
|
||||
delete wxThePenList;
|
||||
wxThePenList = NULL;
|
||||
|
||||
delete wxTheFontList;
|
||||
wxTheFontList = NULL;
|
||||
|
||||
delete wxTheBitmapList;
|
||||
wxTheBitmapList = NULL;
|
||||
|
||||
delete wxTheColourDatabase;
|
||||
wxTheColourDatabase = NULL;
|
||||
|
||||
#if wxUSE_POSTSCRIPT
|
||||
wxInitializePrintSetupData(FALSE);
|
||||
delete wxThePrintPaperDatabase;
|
||||
wxThePrintPaperDatabase = NULL;
|
||||
#endif
|
||||
|
||||
wxBitmap::CleanUpHandlers();
|
||||
|
||||
delete[] wxBuffer;
|
||||
wxBuffer = NULL;
|
||||
|
||||
// do it as the very last thing because everything else can log messages
|
||||
delete wxLog::SetActiveTarget(NULL);
|
||||
}
|
||||
|
||||
int wxEntry( int argc, char *argv[] )
|
||||
{
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
#if (WXDEBUG && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
|
||||
|
||||
#if !defined(_WINDLL)
|
||||
streambuf* sBuf = new wxDebugStreamBuf;
|
||||
#else
|
||||
streambuf* sBuf = NULL;
|
||||
#endif
|
||||
ostream* oStr = new ostream(sBuf) ;
|
||||
wxDebugContext::SetStream(oStr, sBuf);
|
||||
|
||||
#endif
|
||||
|
||||
if (!wxTheApp)
|
||||
{
|
||||
if (!wxApp::GetInitializerFunction())
|
||||
{
|
||||
printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" );
|
||||
return 0;
|
||||
};
|
||||
|
||||
wxTheApp = (* wxApp::GetInitializerFunction()) ();
|
||||
};
|
||||
|
||||
if (!wxTheApp)
|
||||
{
|
||||
printf( "wxWindows error: wxTheApp == NULL\n" );
|
||||
return 0;
|
||||
};
|
||||
|
||||
wxTheApp->argc = argc;
|
||||
wxTheApp->argv = argv;
|
||||
|
||||
// TODO: your platform-specific initialization.
|
||||
|
||||
wxApp::CommonInit();
|
||||
|
||||
// GUI-specific initialization, such as creating an app context.
|
||||
wxTheApp->OnInitGui();
|
||||
|
||||
// Here frames insert themselves automatically
|
||||
// into wxTopLevelWindows by getting created
|
||||
// in OnInit().
|
||||
|
||||
if (!wxTheApp->OnInit()) return 0;
|
||||
|
||||
wxTheApp->m_initialized = (wxTopLevelWindows.Number() > 0);
|
||||
|
||||
int retValue = 0;
|
||||
|
||||
if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun();
|
||||
|
||||
wxTheApp->DeletePendingObjects();
|
||||
|
||||
wxTheApp->OnExit();
|
||||
|
||||
wxApp::CommonCleanUp();
|
||||
|
||||
#if (WXDEBUG && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
|
||||
// At this point we want to check if there are any memory
|
||||
// blocks that aren't part of the wxDebugContext itself,
|
||||
// as a special case. Then when dumping we need to ignore
|
||||
// wxDebugContext, too.
|
||||
if (wxDebugContext::CountObjectsLeft() > 0)
|
||||
{
|
||||
wxTrace("There were memory leaks.\n");
|
||||
wxDebugContext::Dump();
|
||||
wxDebugContext::PrintStatistics();
|
||||
}
|
||||
wxDebugContext::SetStream(NULL, NULL);
|
||||
#endif
|
||||
|
||||
return retValue;
|
||||
};
|
||||
|
||||
// Static member initialization
|
||||
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
|
||||
|
||||
wxApp::wxApp()
|
||||
{
|
||||
m_topWindow = NULL;
|
||||
wxTheApp = this;
|
||||
m_className = "";
|
||||
m_wantDebugOutput = TRUE ;
|
||||
m_appName = "";
|
||||
argc = 0;
|
||||
argv = NULL;
|
||||
#ifdef __WXMSW__
|
||||
m_printMode = wxPRINT_WINDOWS;
|
||||
#else
|
||||
m_printMode = wxPRINT_POSTSCRIPT;
|
||||
#endif
|
||||
m_exitOnFrameDelete = TRUE;
|
||||
m_auto3D = TRUE;
|
||||
}
|
||||
|
||||
bool wxApp::Initialized()
|
||||
{
|
||||
if (GetTopWindow())
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int wxApp::MainLoop()
|
||||
{
|
||||
m_keepGoing = TRUE;
|
||||
|
||||
/* TODO: implement your main loop here, calling ProcessIdle in idle time.
|
||||
while (m_keepGoing)
|
||||
{
|
||||
while (!::PeekMessage(&s_currentMsg, 0, 0, 0, PM_NOREMOVE) &&
|
||||
ProcessIdle()) {}
|
||||
if (!DoMessage())
|
||||
m_keepGoing = FALSE;
|
||||
}
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Returns TRUE if more time is needed.
|
||||
bool wxApp::ProcessIdle()
|
||||
{
|
||||
wxIdleEvent event;
|
||||
event.SetEventObject(this);
|
||||
ProcessEvent(event);
|
||||
|
||||
return event.MoreRequested();
|
||||
}
|
||||
|
||||
void wxApp::ExitMainLoop()
|
||||
{
|
||||
m_keepGoing = FALSE;
|
||||
}
|
||||
|
||||
// Is a message/event pending?
|
||||
bool wxApp::Pending()
|
||||
{
|
||||
/* TODO.
|
||||
*/
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Dispatch a message.
|
||||
void wxApp::Dispatch()
|
||||
{
|
||||
/* TODO.
|
||||
*/
|
||||
}
|
||||
|
||||
void wxApp::OnIdle(wxIdleEvent& event)
|
||||
{
|
||||
static bool inOnIdle = FALSE;
|
||||
|
||||
// Avoid recursion (via ProcessEvent default case)
|
||||
if (inOnIdle)
|
||||
return;
|
||||
|
||||
inOnIdle = TRUE;
|
||||
|
||||
// 'Garbage' collection of windows deleted with Close().
|
||||
DeletePendingObjects();
|
||||
|
||||
// flush the logged messages if any
|
||||
wxLog *pLog = wxLog::GetActiveTarget();
|
||||
if ( pLog != NULL && pLog->HasPendingMessages() )
|
||||
pLog->Flush();
|
||||
|
||||
// Send OnIdle events to all windows
|
||||
bool needMore = SendIdleEvents();
|
||||
|
||||
if (needMore)
|
||||
event.RequestMore(TRUE);
|
||||
|
||||
inOnIdle = FALSE;
|
||||
}
|
||||
|
||||
// Send idle event to all top-level windows
|
||||
bool wxApp::SendIdleEvents()
|
||||
{
|
||||
bool needMore = FALSE;
|
||||
wxNode* node = wxTopLevelWindows.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow* win = (wxWindow*) node->Data();
|
||||
if (SendIdleEvents(win))
|
||||
needMore = TRUE;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
return needMore;
|
||||
}
|
||||
|
||||
// Send idle event to window and all subwindows
|
||||
bool wxApp::SendIdleEvents(wxWindow* win)
|
||||
{
|
||||
bool needMore = FALSE;
|
||||
|
||||
wxIdleEvent event;
|
||||
event.SetEventObject(win);
|
||||
win->ProcessEvent(event);
|
||||
|
||||
if (event.MoreRequested())
|
||||
needMore = TRUE;
|
||||
|
||||
wxNode* node = win->GetChildren()->First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow* win = (wxWindow*) node->Data();
|
||||
if (SendIdleEvents(win))
|
||||
needMore = TRUE;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
return needMore ;
|
||||
}
|
||||
|
||||
void wxApp::DeletePendingObjects()
|
||||
{
|
||||
wxNode *node = wxPendingDelete.First();
|
||||
while (node)
|
||||
{
|
||||
wxObject *obj = (wxObject *)node->Data();
|
||||
|
||||
delete obj;
|
||||
|
||||
if (wxPendingDelete.Member(obj))
|
||||
delete node;
|
||||
|
||||
// Deleting one object may have deleted other pending
|
||||
// objects, so start from beginning of list again.
|
||||
node = wxPendingDelete.First();
|
||||
}
|
||||
}
|
||||
|
||||
wxLog* wxApp::CreateLogTarget()
|
||||
{
|
||||
return new wxLogGui;
|
||||
}
|
||||
|
||||
wxWindow* wxApp::GetTopWindow() const
|
||||
{
|
||||
if (m_topWindow)
|
||||
return m_topWindow;
|
||||
else if (wxTopLevelWindows.Number() > 0)
|
||||
return (wxWindow*) wxTopLevelWindows.First()->Data();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxExit()
|
||||
{
|
||||
wxApp::CommonCleanUp();
|
||||
/*
|
||||
* TODO: Exit in some platform-specific way. Not recommended that the app calls this:
|
||||
* only for emergencies.
|
||||
*/
|
||||
}
|
||||
|
||||
// Yield to other processes
|
||||
bool wxYield()
|
||||
{
|
||||
/*
|
||||
* TODO
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#define bdiag_width 16
|
||||
#define bdiag_height 16
|
||||
static char bdiag_bits[] = {
|
||||
0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04,
|
||||
0x02, 0x02, 0x01, 0x01, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10,
|
||||
0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01};
|
||||
@@ -1,428 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: bitmap.cpp
|
||||
// Purpose: wxBitmap
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "bitmap.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/palette.h"
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
|
||||
|
||||
wxBitmapRefData::wxBitmapRefData()
|
||||
{
|
||||
m_ok = FALSE;
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
m_depth = 0;
|
||||
m_quality = 0;
|
||||
m_numColors = 0;
|
||||
m_bitmapMask = NULL;
|
||||
}
|
||||
|
||||
wxBitmapRefData::~wxBitmapRefData()
|
||||
{
|
||||
/*
|
||||
* TODO: delete the bitmap data here.
|
||||
*/
|
||||
|
||||
if (m_bitmapMask)
|
||||
delete m_bitmapMask;
|
||||
m_bitmapMask = NULL;
|
||||
}
|
||||
|
||||
wxList wxBitmap::sm_handlers;
|
||||
|
||||
wxBitmap::wxBitmap()
|
||||
{
|
||||
m_refData = NULL;
|
||||
|
||||
if ( wxTheBitmapList )
|
||||
wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
wxBitmap::~wxBitmap()
|
||||
{
|
||||
if (wxTheBitmapList)
|
||||
wxTheBitmapList->DeleteObject(this);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits)
|
||||
{
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
M_BITMAPDATA->m_width = the_width ;
|
||||
M_BITMAPDATA->m_height = the_height ;
|
||||
M_BITMAPDATA->m_depth = no_bits ;
|
||||
M_BITMAPDATA->m_numColors = 0;
|
||||
|
||||
/* TODO: create the bitmap from data */
|
||||
|
||||
if ( wxTheBitmapList )
|
||||
wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(int w, int h, int d)
|
||||
{
|
||||
(void)Create(w, h, d);
|
||||
|
||||
if ( wxTheBitmapList )
|
||||
wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(void *data, long type, int width, int height, int depth)
|
||||
{
|
||||
(void) Create(data, type, width, height, depth);
|
||||
|
||||
if ( wxTheBitmapList )
|
||||
wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
wxBitmap::wxBitmap(const wxString& filename, long type)
|
||||
{
|
||||
LoadFile(filename, (int)type);
|
||||
|
||||
if ( wxTheBitmapList )
|
||||
wxTheBitmapList->AddBitmap(this);
|
||||
}
|
||||
|
||||
/* TODO: maybe allow creation from XPM
|
||||
// Create from data
|
||||
wxBitmap::wxBitmap(const char **data)
|
||||
{
|
||||
(void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
|
||||
}
|
||||
*/
|
||||
|
||||
bool wxBitmap::Create(int w, int h, int d)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
M_BITMAPDATA->m_width = w;
|
||||
M_BITMAPDATA->m_height = h;
|
||||
M_BITMAPDATA->m_depth = d;
|
||||
|
||||
/* TODO: create new bitmap */
|
||||
|
||||
return M_BITMAPDATA->m_ok;
|
||||
}
|
||||
|
||||
bool wxBitmap::LoadFile(const wxString& filename, long type)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
wxBitmapHandler *handler = FindHandler(type);
|
||||
|
||||
if ( handler == NULL ) {
|
||||
wxLogWarning("no bitmap handler for type %d defined.", type);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return handler->LoadFile(this, filename, type, -1, -1);
|
||||
}
|
||||
|
||||
bool wxBitmap::Create(void *data, long type, int width, int height, int depth)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
wxBitmapHandler *handler = FindHandler(type);
|
||||
|
||||
if ( handler == NULL ) {
|
||||
wxLogWarning("no bitmap handler for type %d defined.", type);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return handler->Create(this, data, type, width, height, depth);
|
||||
}
|
||||
|
||||
bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *palette)
|
||||
{
|
||||
wxBitmapHandler *handler = FindHandler(type);
|
||||
|
||||
if ( handler == NULL ) {
|
||||
wxLogWarning("no bitmap handler for type %d defined.", type);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return handler->SaveFile(this, filename, type, palette);
|
||||
}
|
||||
|
||||
void wxBitmap::SetWidth(int w)
|
||||
{
|
||||
if (!M_BITMAPDATA)
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
M_BITMAPDATA->m_width = w;
|
||||
}
|
||||
|
||||
void wxBitmap::SetHeight(int h)
|
||||
{
|
||||
if (!M_BITMAPDATA)
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
M_BITMAPDATA->m_height = h;
|
||||
}
|
||||
|
||||
void wxBitmap::SetDepth(int d)
|
||||
{
|
||||
if (!M_BITMAPDATA)
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
M_BITMAPDATA->m_depth = d;
|
||||
}
|
||||
|
||||
void wxBitmap::SetQuality(int q)
|
||||
{
|
||||
if (!M_BITMAPDATA)
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
M_BITMAPDATA->m_quality = q;
|
||||
}
|
||||
|
||||
void wxBitmap::SetOk(bool isOk)
|
||||
{
|
||||
if (!M_BITMAPDATA)
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
M_BITMAPDATA->m_ok = isOk;
|
||||
}
|
||||
|
||||
void wxBitmap::SetPalette(const wxPalette& palette)
|
||||
{
|
||||
if (!M_BITMAPDATA)
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
M_BITMAPDATA->m_bitmapPalette = palette ;
|
||||
}
|
||||
|
||||
void wxBitmap::SetMask(wxMask *mask)
|
||||
{
|
||||
if (!M_BITMAPDATA)
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
M_BITMAPDATA->m_bitmapMask = mask ;
|
||||
}
|
||||
|
||||
void wxBitmap::AddHandler(wxBitmapHandler *handler)
|
||||
{
|
||||
sm_handlers.Append(handler);
|
||||
}
|
||||
|
||||
void wxBitmap::InsertHandler(wxBitmapHandler *handler)
|
||||
{
|
||||
sm_handlers.Insert(handler);
|
||||
}
|
||||
|
||||
bool wxBitmap::RemoveHandler(const wxString& name)
|
||||
{
|
||||
wxBitmapHandler *handler = FindHandler(name);
|
||||
if ( handler )
|
||||
{
|
||||
sm_handlers.DeleteObject(handler);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxBitmapHandler *wxBitmap::FindHandler(const wxString& name)
|
||||
{
|
||||
wxNode *node = sm_handlers.First();
|
||||
while ( node )
|
||||
{
|
||||
wxBitmapHandler *handler = (wxBitmapHandler *)node->Data();
|
||||
if ( handler->GetName() == name )
|
||||
return handler;
|
||||
node = node->Next();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wxBitmapHandler *wxBitmap::FindHandler(const wxString& extension, long bitmapType)
|
||||
{
|
||||
wxNode *node = sm_handlers.First();
|
||||
while ( node )
|
||||
{
|
||||
wxBitmapHandler *handler = (wxBitmapHandler *)node->Data();
|
||||
if ( handler->GetExtension() == extension &&
|
||||
(bitmapType == -1 || handler->GetType() == bitmapType) )
|
||||
return handler;
|
||||
node = node->Next();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wxBitmapHandler *wxBitmap::FindHandler(long bitmapType)
|
||||
{
|
||||
wxNode *node = sm_handlers.First();
|
||||
while ( node )
|
||||
{
|
||||
wxBitmapHandler *handler = (wxBitmapHandler *)node->Data();
|
||||
if (handler->GetType() == bitmapType)
|
||||
return handler;
|
||||
node = node->Next();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* wxMask
|
||||
*/
|
||||
|
||||
wxMask::wxMask()
|
||||
{
|
||||
/* TODO
|
||||
m_maskBitmap = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
// Construct a mask from a bitmap and a colour indicating
|
||||
// the transparent area
|
||||
wxMask::wxMask(const wxBitmap& bitmap, const wxColour& colour)
|
||||
{
|
||||
/* TODO
|
||||
m_maskBitmap = 0;
|
||||
*/
|
||||
Create(bitmap, colour);
|
||||
}
|
||||
|
||||
// Construct a mask from a bitmap and a palette index indicating
|
||||
// the transparent area
|
||||
wxMask::wxMask(const wxBitmap& bitmap, int paletteIndex)
|
||||
{
|
||||
/* TODO
|
||||
m_maskBitmap = 0;
|
||||
*/
|
||||
|
||||
Create(bitmap, paletteIndex);
|
||||
}
|
||||
|
||||
// Construct a mask from a mono bitmap (copies the bitmap).
|
||||
wxMask::wxMask(const wxBitmap& bitmap)
|
||||
{
|
||||
/* TODO
|
||||
m_maskBitmap = 0;
|
||||
*/
|
||||
|
||||
Create(bitmap);
|
||||
}
|
||||
|
||||
wxMask::~wxMask()
|
||||
{
|
||||
// TODO: delete mask bitmap
|
||||
}
|
||||
|
||||
// Create a mask from a mono bitmap (copies the bitmap).
|
||||
bool wxMask::Create(const wxBitmap& bitmap)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Create a mask from a bitmap and a palette index indicating
|
||||
// the transparent area
|
||||
bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Create a mask from a bitmap and a colour indicating
|
||||
// the transparent area
|
||||
bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* wxBitmapHandler
|
||||
*/
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject)
|
||||
|
||||
bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long type,
|
||||
int desiredWidth, int desiredHeight)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxBitmapHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Standard handlers
|
||||
*/
|
||||
|
||||
/* TODO: bitmap handlers, a bit like this:
|
||||
class WXDLLEXPORT wxBMPResourceHandler: public wxBitmapHandler
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBMPResourceHandler)
|
||||
public:
|
||||
inline wxBMPResourceHandler()
|
||||
{
|
||||
m_name = "Windows bitmap resource";
|
||||
m_extension = "";
|
||||
m_type = wxBITMAP_TYPE_BMP_RESOURCE;
|
||||
};
|
||||
|
||||
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
||||
int desiredWidth, int desiredHeight);
|
||||
};
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler)
|
||||
*/
|
||||
|
||||
void wxBitmap::CleanUpHandlers()
|
||||
{
|
||||
wxNode *node = sm_handlers.First();
|
||||
while ( node )
|
||||
{
|
||||
wxBitmapHandler *handler = (wxBitmapHandler *)node->Data();
|
||||
wxNode *next = node->Next();
|
||||
delete handler;
|
||||
delete node;
|
||||
node = next;
|
||||
}
|
||||
}
|
||||
|
||||
void wxBitmap::InitStandardHandlers()
|
||||
{
|
||||
/* TODO: initialize all standard bitmap or derive class handlers here.
|
||||
AddHandler(new wxBMPResourceHandler);
|
||||
AddHandler(new wxBMPFileHandler);
|
||||
AddHandler(new wxXPMFileHandler);
|
||||
AddHandler(new wxXPMDataHandler);
|
||||
AddHandler(new wxICOResourceHandler);
|
||||
AddHandler(new wxICOFileHandler);
|
||||
*/
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: bmpbuttn.cpp
|
||||
// Purpose: wxBitmapButton
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "bmpbuttn.h"
|
||||
#endif
|
||||
|
||||
#include "wx/bmpbuttn.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
|
||||
|
||||
bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
m_buttonBitmap = bitmap;
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
parent->AddChild(this);
|
||||
|
||||
m_backgroundColour = parent->GetDefaultBackgroundColour() ;
|
||||
m_foregroundColour = parent->GetDefaultForegroundColour() ;
|
||||
m_windowStyle = style;
|
||||
m_marginX = 0;
|
||||
m_marginY = 0;
|
||||
|
||||
int x = pos.x;
|
||||
int y = pos.y;
|
||||
int width = size.x;
|
||||
int height = size.y;
|
||||
|
||||
if (id == -1)
|
||||
m_windowId = NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
if ( width == -1 && bitmap.Ok())
|
||||
width = bitmap.GetWidth() + 2*m_marginX;
|
||||
|
||||
if ( height == -1 && bitmap.Ok())
|
||||
height = bitmap.GetHeight() + 2*m_marginY;
|
||||
|
||||
/* TODO: create bitmap button
|
||||
*/
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxBitmapButton::SetBitmapLabel(const wxBitmap& bitmap)
|
||||
{
|
||||
m_buttonBitmap = bitmap;
|
||||
}
|
||||
|
||||
160
src/qt/brush.cpp
160
src/qt/brush.cpp
@@ -1,160 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: brush.cpp
|
||||
// Purpose: wxBrush
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "brush.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/brush.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
|
||||
|
||||
wxBrushRefData::wxBrushRefData()
|
||||
{
|
||||
m_style = wxSOLID;
|
||||
// TODO: null data
|
||||
}
|
||||
|
||||
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
|
||||
{
|
||||
m_style = data.m_style;
|
||||
m_stipple = data.m_stipple;
|
||||
m_colour = data.m_colour;
|
||||
/* TODO: null data
|
||||
m_hBrush = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
wxBrushRefData::~wxBrushRefData()
|
||||
{
|
||||
// TODO: delete data
|
||||
}
|
||||
|
||||
// Brushes
|
||||
wxBrush::wxBrush()
|
||||
{
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->AddBrush(this);
|
||||
}
|
||||
|
||||
wxBrush::~wxBrush()
|
||||
{
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->RemoveBrush(this);
|
||||
}
|
||||
|
||||
wxBrush::wxBrush(const wxColour& col, int Style)
|
||||
{
|
||||
m_refData = new wxBrushRefData;
|
||||
|
||||
M_BRUSHDATA->m_colour = col;
|
||||
M_BRUSHDATA->m_style = Style;
|
||||
|
||||
RealizeResource();
|
||||
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->AddBrush(this);
|
||||
}
|
||||
|
||||
wxBrush::wxBrush(const wxString& col, int Style)
|
||||
{
|
||||
m_refData = new wxBrushRefData;
|
||||
|
||||
// Implicit conversion from string to wxColour via colour database
|
||||
M_BRUSHDATA->m_colour = col;
|
||||
M_BRUSHDATA->m_style = Style;
|
||||
|
||||
RealizeResource();
|
||||
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->AddBrush(this);
|
||||
}
|
||||
|
||||
wxBrush::wxBrush(const wxBitmap& stipple)
|
||||
{
|
||||
m_refData = new wxBrushRefData;
|
||||
|
||||
M_BRUSHDATA->m_style = wxSTIPPLE;
|
||||
M_BRUSHDATA->m_stipple = stipple;
|
||||
|
||||
RealizeResource();
|
||||
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->AddBrush(this);
|
||||
}
|
||||
|
||||
void wxBrush::Unshare()
|
||||
{
|
||||
// Don't change shared data
|
||||
if (!m_refData)
|
||||
{
|
||||
m_refData = new wxBrushRefData();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
|
||||
UnRef();
|
||||
m_refData = ref;
|
||||
}
|
||||
}
|
||||
|
||||
void wxBrush::SetColour(const wxColour& col)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_BRUSHDATA->m_colour = col;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxBrush::SetColour(const wxString& col)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_BRUSHDATA->m_colour = col;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxBrush::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_BRUSHDATA->m_colour.Set(r, g, b);
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxBrush::SetStyle(int Style)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_BRUSHDATA->m_style = Style;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxBrush::SetStipple(const wxBitmap& Stipple)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_BRUSHDATA->m_stipple = Stipple;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxBrush::RealizeResource()
|
||||
{
|
||||
// TODO: create the brush
|
||||
}
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: button.cpp
|
||||
// Purpose: wxButton
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "button.h"
|
||||
#endif
|
||||
|
||||
#include "wx/button.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
|
||||
|
||||
// Button
|
||||
|
||||
bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
m_windowStyle = style;
|
||||
|
||||
parent->AddChild((wxButton *)this);
|
||||
|
||||
if (id == -1)
|
||||
m_windowId = NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
// TODO: create button
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxButton::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxButton::SetDefault()
|
||||
{
|
||||
wxWindow *parent = (wxWindow *)GetParent();
|
||||
if (parent)
|
||||
parent->SetDefaultItem(this);
|
||||
|
||||
// TODO: make button the default
|
||||
}
|
||||
|
||||
wxString wxButton::GetLabel() const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
void wxButton::SetLabel(const wxString& label)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxButton::Command (wxCommandEvent & event)
|
||||
{
|
||||
ProcessCommand (event);
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#define cdiag_width 16
|
||||
#define cdiag_height 16
|
||||
static char cdiag_bits[] = {
|
||||
0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24,
|
||||
0x42, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18,
|
||||
0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x81, 0x81};
|
||||
@@ -1,115 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: checkbox.cpp
|
||||
// Purpose: wxCheckBox
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "checkbox.h"
|
||||
#endif
|
||||
|
||||
#include "wx/checkbox.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
|
||||
|
||||
// Single check box item
|
||||
bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
m_windowStyle = style;
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
// TODO: create checkbox
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxCheckBox::SetLabel(const wxString& label)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxCheckBox::SetValue(bool val)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxCheckBox::GetValue() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxCheckBox::Command (wxCommandEvent & event)
|
||||
{
|
||||
SetValue ((event.GetInt() != 0));
|
||||
ProcessCommand (event);
|
||||
}
|
||||
|
||||
// Bitmap checkbox
|
||||
bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *label,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
m_windowStyle = style;
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
// TODO: Create the bitmap checkbox
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxBitmapCheckBox::SetLabel(const wxBitmap *bitmap)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxBitmapCheckBox::SetValue(bool val)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxBitmapCheckBox::GetValue() const
|
||||
{
|
||||
// TODOD
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: choice.cpp
|
||||
// Purpose: wxChoice
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "choice.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/choice.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
|
||||
|
||||
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
int n, const wxString choices[],
|
||||
long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
m_noStrings = n;
|
||||
m_windowStyle = style;
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
// TODO: create choice control
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxChoice::Append(const wxString& item)
|
||||
{
|
||||
// TODO
|
||||
m_noStrings ++;
|
||||
}
|
||||
|
||||
void wxChoice::Delete(int n)
|
||||
{
|
||||
// TODO
|
||||
m_noStrings --;
|
||||
}
|
||||
|
||||
void wxChoice::Clear()
|
||||
{
|
||||
// TODO
|
||||
m_noStrings = 0;
|
||||
}
|
||||
|
||||
int wxChoice::GetSelection() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wxChoice::SetSelection(int n)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
int wxChoice::FindString(const wxString& s) const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
wxString wxChoice::GetString(int n) const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
wxString wxChoice::GetStringSelection () const
|
||||
{
|
||||
int sel = GetSelection ();
|
||||
if (sel > -1)
|
||||
return wxString(this->GetString (sel));
|
||||
else
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
bool wxChoice::SetStringSelection (const wxString& s)
|
||||
{
|
||||
int sel = FindString (s);
|
||||
if (sel > -1)
|
||||
{
|
||||
SetSelection (sel);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxChoice::Command(wxCommandEvent & event)
|
||||
{
|
||||
SetSelection (event.GetInt());
|
||||
ProcessCommand (event);
|
||||
}
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: colour.cpp
|
||||
// Purpose: wxColour class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "colour.h"
|
||||
#endif
|
||||
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/colour.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
|
||||
|
||||
// Colour
|
||||
|
||||
wxColour::wxColour ()
|
||||
{
|
||||
m_isInit = FALSE;
|
||||
m_red = m_blue = m_green = 0;
|
||||
/* TODO
|
||||
m_pixel = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
|
||||
{
|
||||
m_red = r;
|
||||
m_green = g;
|
||||
m_blue = b;
|
||||
m_isInit = TRUE;
|
||||
/* TODO
|
||||
m_pixel = PALETTERGB (m_red, m_green, m_blue);
|
||||
*/
|
||||
}
|
||||
|
||||
wxColour::wxColour (const wxColour& col)
|
||||
{
|
||||
m_red = col.m_red;
|
||||
m_green = col.m_green;
|
||||
m_blue = col.m_blue;
|
||||
m_isInit = col.m_isInit;
|
||||
/* TODO
|
||||
m_pixel = col.m_pixel;
|
||||
*/
|
||||
}
|
||||
|
||||
wxColour& wxColour::operator =(const wxColour& col)
|
||||
{
|
||||
m_red = col.m_red;
|
||||
m_green = col.m_green;
|
||||
m_blue = col.m_blue;
|
||||
m_isInit = col.m_isInit;
|
||||
/* TODO
|
||||
m_pixel = col.m_pixel;
|
||||
*/
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxColour::wxColour (const wxString& col)
|
||||
{
|
||||
wxColour *the_colour = wxTheColourDatabase->FindColour (col);
|
||||
if (the_colour)
|
||||
{
|
||||
m_red = the_colour->Red ();
|
||||
m_green = the_colour->Green ();
|
||||
m_blue = the_colour->Blue ();
|
||||
m_isInit = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_red = 0;
|
||||
m_green = 0;
|
||||
m_blue = 0;
|
||||
m_isInit = FALSE;
|
||||
}
|
||||
/* TODO
|
||||
m_pixel = PALETTERGB (m_red, m_green, m_blue);
|
||||
*/
|
||||
}
|
||||
|
||||
wxColour::~wxColour ()
|
||||
{
|
||||
}
|
||||
|
||||
wxColour& wxColour::operator = (const wxString& col)
|
||||
{
|
||||
wxColour *the_colour = wxTheColourDatabase->FindColour (col);
|
||||
if (the_colour)
|
||||
{
|
||||
m_red = the_colour->Red ();
|
||||
m_green = the_colour->Green ();
|
||||
m_blue = the_colour->Blue ();
|
||||
m_isInit = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_red = 0;
|
||||
m_green = 0;
|
||||
m_blue = 0;
|
||||
m_isInit = FALSE;
|
||||
}
|
||||
/* TODO
|
||||
m_pixel = PALETTERGB (m_red, m_green, m_blue);
|
||||
*/
|
||||
return (*this);
|
||||
}
|
||||
|
||||
void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
|
||||
{
|
||||
m_red = r;
|
||||
m_green = g;
|
||||
m_blue = b;
|
||||
m_isInit = TRUE;
|
||||
/* TODO
|
||||
m_pixel = PALETTERGB (m_red, m_green, m_blue);
|
||||
*/
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: combobox.cpp
|
||||
// Purpose: wxComboBox class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "combobox.h"
|
||||
#endif
|
||||
|
||||
#include "wx/combobox.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
|
||||
|
||||
bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& value,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
int n, const wxString choices[],
|
||||
long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
m_noStrings = n;
|
||||
m_windowStyle = style;
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
// TODO: create combobox control
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxString wxComboBox::GetValue() const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
void wxComboBox::SetValue(const wxString& value)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Clipboard operations
|
||||
void wxComboBox::Copy()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxComboBox::Cut()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxComboBox::Paste()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxComboBox::SetEditable(bool editable)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxComboBox::SetInsertionPoint(long pos)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxComboBox::SetInsertionPointEnd()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
long wxComboBox::GetInsertionPoint() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
long wxComboBox::GetLastPosition() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wxComboBox::Replace(long from, long to, const wxString& value)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxComboBox::Remove(long from, long to)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxComboBox::SetSelection(long from, long to)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: control.cpp
|
||||
// Purpose: wxControl class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "control.h"
|
||||
#endif
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxControl, wxWindow)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Item members
|
||||
wxControl::wxControl()
|
||||
{
|
||||
m_backgroundColour = *wxWHITE;
|
||||
m_foregroundColour = *wxBLACK;
|
||||
m_callback = 0;
|
||||
}
|
||||
|
||||
wxControl::~wxControl()
|
||||
{
|
||||
// If we delete an item, we should initialize the parent panel,
|
||||
// because it could now be invalid.
|
||||
wxWindow *parent = (wxWindow *)GetParent();
|
||||
if (parent)
|
||||
{
|
||||
if (parent->GetDefaultItem() == this)
|
||||
parent->SetDefaultItem(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void wxControl::SetLabel(const wxString& label)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
wxString wxControl::GetLabel() const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocates control IDs within the appropriate range
|
||||
*/
|
||||
|
||||
int NewControlId()
|
||||
{
|
||||
static int s_controlId = 0;
|
||||
s_controlId ++;
|
||||
return s_controlId;
|
||||
}
|
||||
|
||||
void wxControl::ProcessCommand (wxCommandEvent & event)
|
||||
{
|
||||
// Tries:
|
||||
// 1) A callback function (to become obsolete)
|
||||
// 2) OnCommand, starting at this window and working up parent hierarchy
|
||||
// 3) OnCommand then calls ProcessEvent to search the event tables.
|
||||
if (m_callback)
|
||||
{
|
||||
(void) (*(m_callback)) (*this, event);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetEventHandler()->OnCommand(*this, event);
|
||||
}
|
||||
}
|
||||
|
||||
void wxControl::SetClientSize (int width, int height)
|
||||
{
|
||||
SetSize (-1, -1, width, height);
|
||||
}
|
||||
|
||||
void wxControl::Centre (int direction)
|
||||
{
|
||||
int x, y, width, height, panel_width, panel_height, new_x, new_y;
|
||||
|
||||
wxWindow *parent = (wxWindow *) GetParent ();
|
||||
if (!parent)
|
||||
return;
|
||||
|
||||
parent->GetClientSize (&panel_width, &panel_height);
|
||||
GetSize (&width, &height);
|
||||
GetPosition (&x, &y);
|
||||
|
||||
new_x = x;
|
||||
new_y = y;
|
||||
|
||||
if (direction & wxHORIZONTAL)
|
||||
new_x = (int) ((panel_width - width) / 2);
|
||||
|
||||
if (direction & wxVERTICAL)
|
||||
new_y = (int) ((panel_height - height) / 2);
|
||||
|
||||
SetSize (new_x, new_y, width, height);
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#define cross_width 15
|
||||
#define cross_height 15
|
||||
static char cross_bits[] = {
|
||||
0x84, 0x10, 0x84, 0x10, 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10,
|
||||
0x84, 0x10, 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10,
|
||||
0xff, 0x7f, 0x84, 0x10, 0x84, 0x10};
|
||||
@@ -1,184 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: cursor.cpp
|
||||
// Purpose: wxCursor class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "cursor.h"
|
||||
#endif
|
||||
|
||||
#include "wx/cursor.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
|
||||
|
||||
wxCursorRefData::wxCursorRefData()
|
||||
{
|
||||
m_width = 32; m_height = 32;
|
||||
|
||||
/* TODO
|
||||
m_hCursor = 0 ;
|
||||
*/
|
||||
}
|
||||
|
||||
wxCursorRefData::~wxCursorRefData()
|
||||
{
|
||||
// TODO: destroy cursor
|
||||
}
|
||||
|
||||
// Cursors
|
||||
wxCursor::wxCursor()
|
||||
{
|
||||
}
|
||||
|
||||
wxCursor::wxCursor(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSED(height),
|
||||
int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY), const char WXUNUSED(maskBits)[])
|
||||
{
|
||||
}
|
||||
|
||||
wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int hotSpotY)
|
||||
{
|
||||
m_refData = new wxIconRefData;
|
||||
|
||||
// TODO: create cursor from a file
|
||||
}
|
||||
|
||||
// Cursors by stock number
|
||||
wxCursor::wxCursor(int cursor_type)
|
||||
{
|
||||
m_refData = new wxIconRefData;
|
||||
|
||||
/* TODO
|
||||
switch (cursor_type)
|
||||
{
|
||||
case wxCURSOR_WAIT:
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_WAIT);
|
||||
break;
|
||||
case wxCURSOR_IBEAM:
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_IBEAM);
|
||||
break;
|
||||
case wxCURSOR_CROSS:
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_CROSS);
|
||||
break;
|
||||
case wxCURSOR_SIZENWSE:
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZENWSE);
|
||||
break;
|
||||
case wxCURSOR_SIZENESW:
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZENESW);
|
||||
break;
|
||||
case wxCURSOR_SIZEWE:
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZEWE);
|
||||
break;
|
||||
case wxCURSOR_SIZENS:
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZENS);
|
||||
break;
|
||||
case wxCURSOR_CHAR:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_HAND:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_HAND");
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_BULLSEYE:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_BULLSEYE");
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_PENCIL:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PENCIL");
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_MAGNIFIER:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_MAGNIFIER");
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_NO_ENTRY:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_NO_ENTRY");
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_LEFT_BUTTON:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_RIGHT_BUTTON:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_MIDDLE_BUTTON:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_SIZING:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_SIZING");
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_WATCH:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_WATCH");
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_SPRAYCAN:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_ROLLER");
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_PAINT_BRUSH:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PBRUSH");
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_POINT_LEFT:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PLEFT");
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_POINT_RIGHT:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PRIGHT");
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_QUESTION_ARROW:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_QARROW");
|
||||
break;
|
||||
}
|
||||
case wxCURSOR_BLANK:
|
||||
{
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_BLANK");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case wxCURSOR_ARROW:
|
||||
M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW);
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
wxCursor::~wxCursor()
|
||||
{
|
||||
}
|
||||
|
||||
// Global cursor setting
|
||||
void wxSetCursor(const wxCursor& cursor)
|
||||
{
|
||||
// TODO (optional on platforms with no global cursor)
|
||||
}
|
||||
|
||||
|
||||
145
src/qt/data.cpp
145
src/qt/data.cpp
@@ -1,145 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: data.cpp
|
||||
// Purpose: Various data
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "wx/wx.h"
|
||||
|
||||
#define _MAXPATHLEN 500
|
||||
|
||||
// Useful buffer, initialized in CommonInit
|
||||
char *wxBuffer = NULL;
|
||||
|
||||
// Windows List
|
||||
wxList wxTopLevelWindows;
|
||||
|
||||
// List of windows pending deletion
|
||||
wxList wxPendingDelete;
|
||||
|
||||
int wxPageNumber;
|
||||
|
||||
// GDI Object Lists
|
||||
wxBrushList *wxTheBrushList = NULL;
|
||||
wxPenList *wxThePenList = NULL;
|
||||
wxFontList *wxTheFontList = NULL;
|
||||
wxBitmapList *wxTheBitmapList = NULL;
|
||||
|
||||
wxColourDatabase *wxTheColourDatabase = NULL;
|
||||
|
||||
// Stock objects
|
||||
wxFont *wxNORMAL_FONT;
|
||||
wxFont *wxSMALL_FONT;
|
||||
wxFont *wxITALIC_FONT;
|
||||
wxFont *wxSWISS_FONT;
|
||||
wxPen *wxRED_PEN;
|
||||
|
||||
wxPen *wxCYAN_PEN;
|
||||
wxPen *wxGREEN_PEN;
|
||||
wxPen *wxBLACK_PEN;
|
||||
wxPen *wxWHITE_PEN;
|
||||
wxPen *wxTRANSPARENT_PEN;
|
||||
wxPen *wxBLACK_DASHED_PEN;
|
||||
wxPen *wxGREY_PEN;
|
||||
wxPen *wxMEDIUM_GREY_PEN;
|
||||
wxPen *wxLIGHT_GREY_PEN;
|
||||
|
||||
wxBrush *wxBLUE_BRUSH;
|
||||
wxBrush *wxGREEN_BRUSH;
|
||||
wxBrush *wxWHITE_BRUSH;
|
||||
wxBrush *wxBLACK_BRUSH;
|
||||
wxBrush *wxTRANSPARENT_BRUSH;
|
||||
wxBrush *wxCYAN_BRUSH;
|
||||
wxBrush *wxRED_BRUSH;
|
||||
wxBrush *wxGREY_BRUSH;
|
||||
wxBrush *wxMEDIUM_GREY_BRUSH;
|
||||
wxBrush *wxLIGHT_GREY_BRUSH;
|
||||
|
||||
wxColour *wxBLACK;
|
||||
wxColour *wxWHITE;
|
||||
wxColour *wxRED;
|
||||
wxColour *wxBLUE;
|
||||
wxColour *wxGREEN;
|
||||
wxColour *wxCYAN;
|
||||
wxColour *wxLIGHT_GREY;
|
||||
|
||||
wxCursor *wxSTANDARD_CURSOR = NULL;
|
||||
wxCursor *wxHOURGLASS_CURSOR = NULL;
|
||||
wxCursor *wxCROSS_CURSOR = NULL;
|
||||
|
||||
// 'Null' objects
|
||||
wxAcceleratorTable wxNullAcceleratorTable;
|
||||
wxBitmap wxNullBitmap;
|
||||
wxIcon wxNullIcon;
|
||||
wxCursor wxNullCursor;
|
||||
wxPen wxNullPen;
|
||||
wxBrush wxNullBrush;
|
||||
wxPalette wxNullPalette;
|
||||
wxFont wxNullFont;
|
||||
wxColour wxNullColour;
|
||||
|
||||
// Default window names
|
||||
const char *wxButtonNameStr = "button";
|
||||
const char *wxCanvasNameStr = "canvas";
|
||||
const char *wxCheckBoxNameStr = "check";
|
||||
const char *wxChoiceNameStr = "choice";
|
||||
const char *wxComboBoxNameStr = "comboBox";
|
||||
const char *wxDialogNameStr = "dialog";
|
||||
const char *wxFrameNameStr = "frame";
|
||||
const char *wxGaugeNameStr = "gauge";
|
||||
const char *wxStaticBoxNameStr = "groupBox";
|
||||
const char *wxListBoxNameStr = "listBox";
|
||||
const char *wxStaticTextNameStr = "message";
|
||||
const char *wxStaticBitmapNameStr = "message";
|
||||
const char *wxMultiTextNameStr = "multitext";
|
||||
const char *wxPanelNameStr = "panel";
|
||||
const char *wxRadioBoxNameStr = "radioBox";
|
||||
const char *wxRadioButtonNameStr = "radioButton";
|
||||
const char *wxBitmapRadioButtonNameStr = "radioButton";
|
||||
const char *wxScrollBarNameStr = "scrollBar";
|
||||
const char *wxSliderNameStr = "slider";
|
||||
const char *wxStaticNameStr = "static";
|
||||
const char *wxTextCtrlWindowNameStr = "textWindow";
|
||||
const char *wxTextCtrlNameStr = "text";
|
||||
const char *wxVirtListBoxNameStr = "virtListBox";
|
||||
const char *wxButtonBarNameStr = "buttonbar";
|
||||
const char *wxEnhDialogNameStr = "Shell";
|
||||
const char *wxToolBarNameStr = "toolbar";
|
||||
const char *wxStatusLineNameStr = "status_line";
|
||||
const char *wxEmptyString = "";
|
||||
const char *wxGetTextFromUserPromptStr = "Input Text";
|
||||
const char *wxMessageBoxCaptionStr = "Message";
|
||||
const char *wxFileSelectorPromptStr = "Select a file";
|
||||
const char *wxFileSelectorDefaultWildcardStr = "*.*";
|
||||
const char *wxInternalErrorStr = "wxWindows Internal Error";
|
||||
const char *wxFatalErrorStr = "wxWindows Fatal Error";
|
||||
|
||||
// See wx/utils.h
|
||||
const char *wxFloatToStringStr = "%.2f";
|
||||
const char *wxDoubleToStringStr = "%.2f";
|
||||
|
||||
#if wxUSE_POSTSCRIPT
|
||||
wxPrintPaperDatabase* wxThePrintPaperDatabase = NULL;
|
||||
#endif
|
||||
|
||||
///// Event tables (also must be in one, statically-linked file for shared libraries)
|
||||
|
||||
// This is the base, wxEvtHandler 'bootstrap' code which is expanded manually here
|
||||
const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; }
|
||||
|
||||
const wxEventTable wxEvtHandler::sm_eventTable =
|
||||
{ NULL, &wxEvtHandler::sm_eventTableEntries[0] };
|
||||
|
||||
const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } };
|
||||
|
||||
const wxSize wxDefaultSize(-1, -1);
|
||||
const wxPoint wxDefaultPosition(-1, -1);
|
||||
390
src/qt/dc.cpp
390
src/qt/dc.cpp
@@ -1,390 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dc.cpp
|
||||
// Purpose: wxDC class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "dc.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dc.h"
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// constants
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define mm2inches 0.0393700787402
|
||||
#define inches2mm 25.4
|
||||
#define mm2twips 56.6929133859
|
||||
#define twips2mm 0.0176388888889
|
||||
#define mm2pt 2.83464566929
|
||||
#define pt2mm 0.352777777778
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDC,wxObject)
|
||||
|
||||
wxDC::wxDC(void)
|
||||
{
|
||||
m_ok = FALSE;
|
||||
m_optimize = FALSE;
|
||||
m_autoSetting = FALSE;
|
||||
m_colour = TRUE;
|
||||
m_clipping = FALSE;
|
||||
|
||||
m_mm_to_pix_x = 1.0;
|
||||
m_mm_to_pix_y = 1.0;
|
||||
|
||||
m_logicalOriginX = 0;
|
||||
m_logicalOriginY = 0;
|
||||
m_deviceOriginX = 0;
|
||||
m_deviceOriginY = 0;
|
||||
m_internalDeviceOriginX = 0;
|
||||
m_internalDeviceOriginY = 0;
|
||||
m_externalDeviceOriginX = 0;
|
||||
m_externalDeviceOriginY = 0;
|
||||
|
||||
m_logicalScaleX = 1.0;
|
||||
m_logicalScaleY = 1.0;
|
||||
m_userScaleX = 1.0;
|
||||
m_userScaleY = 1.0;
|
||||
m_scaleX = 1.0;
|
||||
m_scaleY = 1.0;
|
||||
|
||||
m_mappingMode = wxMM_TEXT;
|
||||
m_needComputeScaleX = FALSE;
|
||||
m_needComputeScaleY = FALSE;
|
||||
|
||||
m_signX = 1; // default x-axis left to right
|
||||
m_signY = 1; // default y-axis top down
|
||||
|
||||
m_maxX = m_maxY = -100000;
|
||||
m_minY = m_minY = 100000;
|
||||
|
||||
m_logicalFunction = wxCOPY;
|
||||
// m_textAlignment = wxALIGN_TOP_LEFT;
|
||||
m_backgroundMode = wxTRANSPARENT;
|
||||
|
||||
m_textForegroundColour = *wxBLACK;
|
||||
m_textBackgroundColour = *wxWHITE;
|
||||
m_pen = *wxBLACK_PEN;
|
||||
m_font = *wxNORMAL_FONT;
|
||||
m_brush = *wxTRANSPARENT_BRUSH;
|
||||
m_backgroundBrush = *wxWHITE_BRUSH;
|
||||
|
||||
// m_palette = wxAPP_COLOURMAP;
|
||||
};
|
||||
|
||||
wxDC::~wxDC(void)
|
||||
{
|
||||
};
|
||||
|
||||
void wxDC::DrawIcon( const wxIcon &WXUNUSED(icon), long WXUNUSED(x), long WXUNUSED(y), bool WXUNUSED(useMask) )
|
||||
{
|
||||
};
|
||||
|
||||
void wxDC::DrawPoint( wxPoint& point )
|
||||
{
|
||||
DrawPoint( point.x, point.y );
|
||||
};
|
||||
|
||||
void wxDC::DrawPolygon( wxList *list, long xoffset, long yoffset, int fillStyle )
|
||||
{
|
||||
int n = list->Number();
|
||||
wxPoint *points = new wxPoint[n];
|
||||
|
||||
int i = 0;
|
||||
for( wxNode *node = list->First(); node; node = node->Next() )
|
||||
{
|
||||
wxPoint *point = (wxPoint *)node->Data();
|
||||
points[i].x = point->x;
|
||||
points[i++].y = point->y;
|
||||
};
|
||||
DrawPolygon( n, points, xoffset, yoffset, fillStyle );
|
||||
delete[] points;
|
||||
};
|
||||
|
||||
void wxDC::DrawLines( wxList *list, long xoffset, long yoffset )
|
||||
{
|
||||
int n = list->Number();
|
||||
wxPoint *points = new wxPoint[n];
|
||||
|
||||
int i = 0;
|
||||
for( wxNode *node = list->First(); node; node = node->Next() )
|
||||
{
|
||||
wxPoint *point = (wxPoint *)node->Data();
|
||||
points[i].x = point->x;
|
||||
points[i++].y = point->y;
|
||||
};
|
||||
DrawLines( n, points, xoffset, yoffset );
|
||||
delete []points;
|
||||
};
|
||||
|
||||
void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 )
|
||||
{
|
||||
wxList list;
|
||||
list.Append( (wxObject*)new wxPoint(x1, y1) );
|
||||
list.Append( (wxObject*)new wxPoint(x2, y2) );
|
||||
list.Append( (wxObject*)new wxPoint(x3, y3) );
|
||||
DrawSpline(&list);
|
||||
wxNode *node = list.First();
|
||||
while (node)
|
||||
{
|
||||
wxPoint *p = (wxPoint*)node->Data();
|
||||
delete p;
|
||||
node = node->Next();
|
||||
};
|
||||
};
|
||||
|
||||
void wxDC::DrawSpline( wxList *points )
|
||||
{
|
||||
DrawOpenSpline( points );
|
||||
};
|
||||
|
||||
void wxDC::DrawSpline( int n, wxPoint points[] )
|
||||
{
|
||||
wxList list;
|
||||
for (int i = 0; i < n; i++) list.Append( (wxObject*)&points[i] );
|
||||
DrawSpline( &list );
|
||||
};
|
||||
|
||||
void wxDC::SetClippingRegion( long x, long y, long width, long height )
|
||||
{
|
||||
m_clipping = TRUE;
|
||||
m_clipX1 = x;
|
||||
m_clipY1 = y;
|
||||
m_clipX2 = x + width;
|
||||
m_clipY2 = y + height;
|
||||
};
|
||||
|
||||
void wxDC::DestroyClippingRegion(void)
|
||||
{
|
||||
m_clipping = FALSE;
|
||||
};
|
||||
|
||||
void wxDC::GetClippingBox( long *x, long *y, long *width, long *height ) const
|
||||
{
|
||||
if (m_clipping)
|
||||
{
|
||||
if (x) *x = m_clipX1;
|
||||
if (y) *y = m_clipY1;
|
||||
if (width) *width = (m_clipX2 - m_clipX1);
|
||||
if (height) *height = (m_clipY2 - m_clipY1);
|
||||
}
|
||||
else
|
||||
*x = *y = *width = *height = 0;
|
||||
};
|
||||
|
||||
void wxDC::GetSize( int* width, int* height ) const
|
||||
{
|
||||
*width = m_maxX-m_minX;
|
||||
*height = m_maxY-m_minY;
|
||||
};
|
||||
|
||||
void wxDC::GetSizeMM( long* width, long* height ) const
|
||||
{
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
GetSize( &w, &h );
|
||||
*width = long( double(w) / (m_scaleX*m_mm_to_pix_x) );
|
||||
*height = long( double(h) / (m_scaleY*m_mm_to_pix_y) );
|
||||
};
|
||||
|
||||
void wxDC::SetTextForeground( const wxColour &col )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
m_textForegroundColour = col;
|
||||
};
|
||||
|
||||
void wxDC::SetTextBackground( const wxColour &col )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
m_textBackgroundColour = col;
|
||||
};
|
||||
|
||||
void wxDC::SetMapMode( int mode )
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case wxMM_TWIPS:
|
||||
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
|
||||
break;
|
||||
case wxMM_POINTS:
|
||||
SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
|
||||
break;
|
||||
case wxMM_METRIC:
|
||||
SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
|
||||
break;
|
||||
case wxMM_LOMETRIC:
|
||||
SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
|
||||
break;
|
||||
default:
|
||||
case wxMM_TEXT:
|
||||
SetLogicalScale( 1.0, 1.0 );
|
||||
break;
|
||||
};
|
||||
if (mode != wxMM_TEXT)
|
||||
{
|
||||
m_needComputeScaleX = TRUE;
|
||||
m_needComputeScaleY = TRUE;
|
||||
};
|
||||
};
|
||||
|
||||
void wxDC::SetUserScale( double x, double y )
|
||||
{
|
||||
// allow negative ? -> no
|
||||
m_userScaleX = x;
|
||||
m_userScaleY = y;
|
||||
ComputeScaleAndOrigin();
|
||||
};
|
||||
|
||||
void wxDC::GetUserScale( double *x, double *y )
|
||||
{
|
||||
if (x) *x = m_userScaleX;
|
||||
if (y) *y = m_userScaleY;
|
||||
};
|
||||
|
||||
void wxDC::SetLogicalScale( double x, double y )
|
||||
{
|
||||
// allow negative ?
|
||||
m_logicalScaleX = x;
|
||||
m_logicalScaleY = y;
|
||||
ComputeScaleAndOrigin();
|
||||
};
|
||||
|
||||
void wxDC::GetLogicalScale( double *x, double *y )
|
||||
{
|
||||
if (x) *x = m_logicalScaleX;
|
||||
if (y) *y = m_logicalScaleY;
|
||||
};
|
||||
|
||||
void wxDC::SetLogicalOrigin( long x, long y )
|
||||
{
|
||||
m_logicalOriginX = x * m_signX; // is this still correct ?
|
||||
m_logicalOriginY = y * m_signY;
|
||||
ComputeScaleAndOrigin();
|
||||
};
|
||||
|
||||
void wxDC::GetLogicalOrigin( long *x, long *y )
|
||||
{
|
||||
if (x) *x = m_logicalOriginX;
|
||||
if (y) *y = m_logicalOriginY;
|
||||
};
|
||||
|
||||
void wxDC::SetDeviceOrigin( long x, long y )
|
||||
{
|
||||
m_externalDeviceOriginX = x;
|
||||
m_externalDeviceOriginY = y;
|
||||
ComputeScaleAndOrigin();
|
||||
};
|
||||
|
||||
void wxDC::GetDeviceOrigin( long *x, long *y )
|
||||
{
|
||||
// if (x) *x = m_externalDeviceOriginX;
|
||||
// if (y) *y = m_externalDeviceOriginY;
|
||||
if (x) *x = m_deviceOriginX;
|
||||
if (y) *y = m_deviceOriginY;
|
||||
};
|
||||
|
||||
void wxDC::SetInternalDeviceOrigin( long x, long y )
|
||||
{
|
||||
m_internalDeviceOriginX = x;
|
||||
m_internalDeviceOriginY = y;
|
||||
ComputeScaleAndOrigin();
|
||||
};
|
||||
|
||||
void wxDC::GetInternalDeviceOrigin( long *x, long *y )
|
||||
{
|
||||
if (x) *x = m_internalDeviceOriginX;
|
||||
if (y) *y = m_internalDeviceOriginY;
|
||||
};
|
||||
|
||||
void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
|
||||
{
|
||||
m_signX = (xLeftRight ? 1 : -1);
|
||||
m_signY = (yBottomUp ? -1 : 1);
|
||||
ComputeScaleAndOrigin();
|
||||
};
|
||||
|
||||
long wxDC::DeviceToLogicalX(long x) const
|
||||
{
|
||||
return XDEV2LOG(x);
|
||||
};
|
||||
|
||||
long wxDC::DeviceToLogicalY(long y) const
|
||||
{
|
||||
return YDEV2LOG(y);
|
||||
};
|
||||
|
||||
long wxDC::DeviceToLogicalXRel(long x) const
|
||||
{
|
||||
return XDEV2LOGREL(x);
|
||||
};
|
||||
|
||||
long wxDC::DeviceToLogicalYRel(long y) const
|
||||
{
|
||||
return YDEV2LOGREL(y);
|
||||
};
|
||||
|
||||
long wxDC::LogicalToDeviceX(long x) const
|
||||
{
|
||||
return XLOG2DEV(x);
|
||||
};
|
||||
|
||||
long wxDC::LogicalToDeviceY(long y) const
|
||||
{
|
||||
return YLOG2DEV(y);
|
||||
};
|
||||
|
||||
long wxDC::LogicalToDeviceXRel(long x) const
|
||||
{
|
||||
return XLOG2DEVREL(x);
|
||||
};
|
||||
|
||||
long wxDC::LogicalToDeviceYRel(long y) const
|
||||
{
|
||||
return YLOG2DEVREL(y);
|
||||
};
|
||||
|
||||
void wxDC::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;
|
||||
};
|
||||
|
||||
void wxDC::ComputeScaleAndOrigin(void)
|
||||
{
|
||||
// CMB: copy scale to see if it changes
|
||||
double origScaleX = m_scaleX;
|
||||
double origScaleY = m_scaleY;
|
||||
|
||||
m_scaleX = m_logicalScaleX * m_userScaleX;
|
||||
m_scaleY = m_logicalScaleY * m_userScaleY;
|
||||
|
||||
m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX;
|
||||
m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY;
|
||||
|
||||
// CMB: if scale has changed call SetPen to recalulate the line width
|
||||
if (m_scaleX != origScaleX || m_scaleY != origScaleY)
|
||||
{
|
||||
// this is a bit artificial, but we need to force wxDC to think
|
||||
// the pen has changed
|
||||
wxPen* pen = GetPen();
|
||||
wxPen tempPen;
|
||||
m_pen = tempPen;
|
||||
SetPen(pen);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,618 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dcclient.cpp
|
||||
// Purpose: wxClientDC class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "dcclient.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dcclient.h"
|
||||
#include "wx/dcmemory.h"
|
||||
#include <math.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// constants
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define RAD2DEG 57.2957795131
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxPaintDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxDC)
|
||||
//IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxDC)
|
||||
|
||||
|
||||
wxPaintDC::wxPaintDC(void)
|
||||
{
|
||||
};
|
||||
|
||||
wxPaintDC::wxPaintDC( wxWindow *window )
|
||||
{
|
||||
};
|
||||
|
||||
wxPaintDC::~wxPaintDC(void)
|
||||
{
|
||||
};
|
||||
|
||||
void wxPaintDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1),
|
||||
wxColour *WXUNUSED(col), int WXUNUSED(style) )
|
||||
{
|
||||
};
|
||||
|
||||
bool wxPaintDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
|
||||
{
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
};
|
||||
|
||||
void wxPaintDC::CrossHair( long x, long y )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
};
|
||||
|
||||
void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double yc )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
long xx1 = XLOG2DEV(x1);
|
||||
long yy1 = YLOG2DEV(y1);
|
||||
long xx2 = XLOG2DEV(x2);
|
||||
long yy2 = YLOG2DEV(y2);
|
||||
long xxc = XLOG2DEV((long)xc);
|
||||
long yyc = YLOG2DEV((long)yc);
|
||||
double dx = xx1 - xxc;
|
||||
double dy = yy1 - yyc;
|
||||
double radius = sqrt(dx*dx+dy*dy);
|
||||
long r = (long)radius;
|
||||
double radius1, radius2;
|
||||
|
||||
if (xx1 == xx2 && yy1 == yy2)
|
||||
{
|
||||
radius1 = 0.0;
|
||||
radius2 = 360.0;
|
||||
}
|
||||
else
|
||||
if (radius == 0.0)
|
||||
{
|
||||
radius1 = radius2 = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
radius1 = (xx1 - xxc == 0) ?
|
||||
(yy1 - yyc < 0) ? 90.0 : -90.0 :
|
||||
-atan2(double(yy1-yyc), double(xx1-xxc)) * RAD2DEG;
|
||||
radius2 = (xx2 - xxc == 0) ?
|
||||
(yy2 - yyc < 0) ? 90.0 : -90.0 :
|
||||
-atan2(double(yy2-yyc), double(xx2-xxc)) * RAD2DEG;
|
||||
};
|
||||
long alpha1 = long(radius1 * 64.0);
|
||||
long alpha2 = long((radius2 - radius1) * 64.0);
|
||||
while (alpha2 <= 0) alpha2 += 360*64;
|
||||
while (alpha1 > 360*64) alpha1 -= 360*64;
|
||||
|
||||
if (m_brush.GetStyle() != wxTRANSPARENT) {};
|
||||
|
||||
if (m_pen.GetStyle() != wxTRANSPARENT) {};
|
||||
|
||||
};
|
||||
|
||||
void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
long xx = XLOG2DEV(x);
|
||||
long yy = YLOG2DEV(y);
|
||||
long ww = m_signX * XLOG2DEVREL(width);
|
||||
long hh = m_signY * YLOG2DEVREL(height);
|
||||
|
||||
// CMB: handle -ve width and/or height
|
||||
if (ww < 0) { ww = -ww; xx = xx - ww; }
|
||||
if (hh < 0) { hh = -hh; yy = yy - hh; }
|
||||
|
||||
long start = long(sa * 64.0);
|
||||
long end = long(ea * 64.0);
|
||||
if (m_brush.GetStyle() != wxTRANSPARENT) {};
|
||||
|
||||
if (m_pen.GetStyle() != wxTRANSPARENT) {};
|
||||
};
|
||||
|
||||
void wxPaintDC::DrawPoint( long x, long y )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
if (m_pen.GetStyle() != wxTRANSPARENT) {};
|
||||
};
|
||||
|
||||
void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
||||
|
||||
for (int i = 0; i < n-1; i++)
|
||||
{
|
||||
long x1 = XLOG2DEV(points[i].x + xoffset);
|
||||
long x2 = XLOG2DEV(points[i+1].x + xoffset);
|
||||
long y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste
|
||||
long y2 = YLOG2DEV(points[i+1].y + yoffset);
|
||||
};
|
||||
};
|
||||
|
||||
void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
||||
|
||||
wxNode *node = points->First();
|
||||
while (node->Next())
|
||||
{
|
||||
wxPoint *point = (wxPoint*)node->Data();
|
||||
wxPoint *npoint = (wxPoint*)node->Next()->Data();
|
||||
long x1 = XLOG2DEV(point->x + xoffset);
|
||||
long x2 = XLOG2DEV(npoint->x + xoffset);
|
||||
long y1 = YLOG2DEV(point->y + yoffset); // and again...
|
||||
long y2 = YLOG2DEV(npoint->y + yoffset);
|
||||
node = node->Next();
|
||||
};
|
||||
};
|
||||
|
||||
void wxPaintDC::DrawPolygon( int WXUNUSED(n), wxPoint WXUNUSED(points)[],
|
||||
long WXUNUSED(xoffset), long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
};
|
||||
|
||||
void wxPaintDC::DrawPolygon( wxList *WXUNUSED(lines), long WXUNUSED(xoffset),
|
||||
long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
};
|
||||
|
||||
void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
long xx = XLOG2DEV(x);
|
||||
long yy = YLOG2DEV(y);
|
||||
long ww = m_signX * XLOG2DEVREL(width);
|
||||
long hh = m_signY * YLOG2DEVREL(height);
|
||||
|
||||
// CMB: draw nothing if transformed w or h is 0
|
||||
if (ww == 0 || hh == 0) return;
|
||||
|
||||
// CMB: handle -ve width and/or height
|
||||
if (ww < 0) { ww = -ww; xx = xx - ww; }
|
||||
if (hh < 0) { hh = -hh; yy = yy - hh; }
|
||||
|
||||
if (m_brush.GetStyle() != wxTRANSPARENT) {};
|
||||
|
||||
if (m_pen.GetStyle() != wxTRANSPARENT) {};
|
||||
};
|
||||
|
||||
void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
if (radius < 0.0) radius = - radius * ((width < height) ? width : height);
|
||||
|
||||
long xx = XLOG2DEV(x);
|
||||
long yy = YLOG2DEV(y);
|
||||
long ww = m_signX * XLOG2DEVREL(width);
|
||||
long hh = m_signY * YLOG2DEVREL(height);
|
||||
long rr = XLOG2DEVREL((long)radius);
|
||||
|
||||
// CMB: handle -ve width and/or height
|
||||
if (ww < 0) { ww = -ww; xx = xx - ww; }
|
||||
if (hh < 0) { hh = -hh; yy = yy - hh; }
|
||||
|
||||
// CMB: if radius is zero use DrawRectangle() instead to avoid
|
||||
// X drawing errors with small radii
|
||||
if (rr == 0)
|
||||
{
|
||||
DrawRectangle( x, y, width, height );
|
||||
return;
|
||||
}
|
||||
|
||||
// CMB: draw nothing if transformed w or h is 0
|
||||
if (ww == 0 || hh == 0) return;
|
||||
|
||||
// CMB: adjust size if outline is drawn otherwise the result is
|
||||
// 1 pixel too wide and high
|
||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||
{
|
||||
ww--;
|
||||
hh--;
|
||||
}
|
||||
|
||||
// CMB: ensure dd is not larger than rectangle otherwise we
|
||||
// get an hour glass shape
|
||||
long dd = 2 * rr;
|
||||
if (dd > ww) dd = ww;
|
||||
if (dd > hh) dd = hh;
|
||||
rr = dd / 2;
|
||||
|
||||
if (m_brush.GetStyle() != wxTRANSPARENT)
|
||||
{
|
||||
};
|
||||
|
||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
long xx = XLOG2DEV(x);
|
||||
long yy = YLOG2DEV(y);
|
||||
long ww = m_signX * XLOG2DEVREL(width);
|
||||
long hh = m_signY * YLOG2DEVREL(height);
|
||||
|
||||
// CMB: handle -ve width and/or height
|
||||
if (ww < 0) { ww = -ww; xx = xx - ww; }
|
||||
if (hh < 0) { hh = -hh; yy = yy - hh; }
|
||||
|
||||
if (m_brush.GetStyle() != wxTRANSPARENT) {};
|
||||
|
||||
if (m_pen.GetStyle() != wxTRANSPARENT) {};
|
||||
};
|
||||
|
||||
bool wxPaintDC::CanDrawBitmap(void) const
|
||||
{
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
if (!icon.Ok()) return;
|
||||
|
||||
int xx = XLOG2DEV(x);
|
||||
int yy = YLOG2DEV(y);
|
||||
|
||||
};
|
||||
|
||||
bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
|
||||
wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool WXUNUSED(useMask) )
|
||||
{
|
||||
if (!Ok()) return FALSE;
|
||||
|
||||
// CMB 20/5/98: add blitting of bitmaps
|
||||
if (source->IsKindOf(CLASSINFO(wxMemoryDC)))
|
||||
{
|
||||
wxMemoryDC* srcDC = (wxMemoryDC*)source;
|
||||
/*
|
||||
GdkBitmap* bmap = srcDC->m_selected.GetBitmap();
|
||||
if (bmap)
|
||||
{
|
||||
gdk_draw_bitmap (
|
||||
m_window,
|
||||
m_textGC,
|
||||
bmap,
|
||||
source->DeviceToLogicalX(xsrc), source->DeviceToLogicalY(ysrc),
|
||||
XLOG2DEV(xdest), YLOG2DEV(ydest),
|
||||
source->DeviceToLogicalXRel(width), source->DeviceToLogicalYRel(height)
|
||||
);
|
||||
return TRUE;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void wxPaintDC::DrawText( const wxString &text, long x, long y, bool
|
||||
WXUNUSED(use16) )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
bool wxPaintDC::CanGetTextExtent(void) const
|
||||
{
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height,
|
||||
long *WXUNUSED(descent), long *WXUNUSED(externalLeading),
|
||||
wxFont *WXUNUSED(theFont), bool WXUNUSED(use16) )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
};
|
||||
|
||||
long wxPaintDC::GetCharWidth(void)
|
||||
{
|
||||
if (!Ok()) return 0;
|
||||
|
||||
};
|
||||
|
||||
long wxPaintDC::GetCharHeight(void)
|
||||
{
|
||||
if (!Ok()) return 0;
|
||||
|
||||
};
|
||||
|
||||
void wxPaintDC::Clear(void)
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
};
|
||||
|
||||
void wxPaintDC::SetFont( const wxFont &font )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
m_font = font;
|
||||
};
|
||||
|
||||
void wxPaintDC::SetPen( const wxPen &pen )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
if (m_pen == pen) return;
|
||||
|
||||
m_pen = pen;
|
||||
|
||||
if (!m_pen.Ok()) return;
|
||||
};
|
||||
|
||||
void wxPaintDC::SetBrush( const wxBrush &brush )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
if (m_brush == brush) return;
|
||||
|
||||
m_brush = brush;
|
||||
|
||||
if (!m_brush.Ok()) return;
|
||||
|
||||
};
|
||||
|
||||
void wxPaintDC::SetBackground( const wxBrush &brush )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
if (m_backgroundBrush == brush) return;
|
||||
|
||||
m_backgroundBrush = brush;
|
||||
|
||||
if (!m_backgroundBrush.Ok()) return;
|
||||
|
||||
};
|
||||
|
||||
void wxPaintDC::SetLogicalFunction( int function )
|
||||
{
|
||||
if (m_logicalFunction == function) return;
|
||||
};
|
||||
|
||||
void wxPaintDC::SetTextForeground( const wxColour &col )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
if (m_textForegroundColour == col) return;
|
||||
|
||||
m_textForegroundColour = col;
|
||||
if (!m_textForegroundColour.Ok()) return;
|
||||
};
|
||||
|
||||
void wxPaintDC::SetTextBackground( const wxColour &col )
|
||||
{
|
||||
if (!Ok()) return;
|
||||
|
||||
if (m_textBackgroundColour == col) return;
|
||||
|
||||
m_textBackgroundColour = col;
|
||||
if (!m_textBackgroundColour.Ok()) return;
|
||||
};
|
||||
|
||||
void wxPaintDC::SetBackgroundMode( int mode )
|
||||
{
|
||||
m_backgroundMode = mode;
|
||||
|
||||
if (m_brush.GetStyle() != wxSOLID && m_brush.GetStyle() != wxTRANSPARENT)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
void wxPaintDC::SetPalette( const wxPalette& WXUNUSED(palette) )
|
||||
{
|
||||
};
|
||||
|
||||
void wxPaintDC::SetClippingRegion( long x, long y, long width, long height )
|
||||
{
|
||||
wxDC::SetClippingRegion( x, y, width, height );
|
||||
|
||||
};
|
||||
|
||||
void wxPaintDC::DestroyClippingRegion(void)
|
||||
{
|
||||
wxDC::DestroyClippingRegion();
|
||||
|
||||
};
|
||||
|
||||
// ----------------------------------- spline code ----------------------------------------
|
||||
|
||||
void wx_quadratic_spline(double a1, double b1, double a2, double b2,
|
||||
double a3, double b3, double a4, double b4);
|
||||
void wx_clear_stack(void);
|
||||
int wx_spline_pop(double *x1, double *y1, double *x2, double *y2, double *x3,
|
||||
double *y3, double *x4, double *y4);
|
||||
void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3,
|
||||
double x4, double y4);
|
||||
static bool wx_spline_add_point(double x, double y);
|
||||
static void wx_spline_draw_point_array(wxDC *dc);
|
||||
|
||||
wxList wx_spline_point_list;
|
||||
|
||||
#define half(z1, z2) ((z1+z2)/2.0)
|
||||
#define THRESHOLD 5
|
||||
|
||||
/* iterative version */
|
||||
|
||||
void wx_quadratic_spline(double a1, double b1, double a2, double b2, double a3, double b3, double a4,
|
||||
double b4)
|
||||
{
|
||||
register double xmid, ymid;
|
||||
double x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
|
||||
wx_clear_stack();
|
||||
wx_spline_push(a1, b1, a2, b2, a3, b3, a4, b4);
|
||||
|
||||
while (wx_spline_pop(&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)) {
|
||||
xmid = (double)half(x2, x3);
|
||||
ymid = (double)half(y2, y3);
|
||||
if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD &&
|
||||
fabs(xmid - x4) < THRESHOLD && fabs(ymid - y4) < THRESHOLD) {
|
||||
wx_spline_add_point( x1, y1 );
|
||||
wx_spline_add_point( xmid, ymid );
|
||||
} else {
|
||||
wx_spline_push(xmid, ymid, (double)half(xmid, x3), (double)half(ymid, y3),
|
||||
(double)half(x3, x4), (double)half(y3, y4), x4, y4);
|
||||
wx_spline_push(x1, y1, (double)half(x1, x2), (double)half(y1, y2),
|
||||
(double)half(x2, xmid), (double)half(y2, ymid), xmid, ymid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* utilities used by spline drawing routines */
|
||||
|
||||
typedef struct wx_spline_stack_struct {
|
||||
double x1, y1, x2, y2, x3, y3, x4, y4;
|
||||
} Stack;
|
||||
|
||||
#define SPLINE_STACK_DEPTH 20
|
||||
static Stack wx_spline_stack[SPLINE_STACK_DEPTH];
|
||||
static Stack *wx_stack_top;
|
||||
static int wx_stack_count;
|
||||
|
||||
void wx_clear_stack(void)
|
||||
{
|
||||
wx_stack_top = wx_spline_stack;
|
||||
wx_stack_count = 0;
|
||||
}
|
||||
|
||||
void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
|
||||
{
|
||||
wx_stack_top->x1 = x1;
|
||||
wx_stack_top->y1 = y1;
|
||||
wx_stack_top->x2 = x2;
|
||||
wx_stack_top->y2 = y2;
|
||||
wx_stack_top->x3 = x3;
|
||||
wx_stack_top->y3 = y3;
|
||||
wx_stack_top->x4 = x4;
|
||||
wx_stack_top->y4 = y4;
|
||||
wx_stack_top++;
|
||||
wx_stack_count++;
|
||||
}
|
||||
|
||||
int wx_spline_pop(double *x1, double *y1, double *x2, double *y2,
|
||||
double *x3, double *y3, double *x4, double *y4)
|
||||
{
|
||||
if (wx_stack_count == 0)
|
||||
return (0);
|
||||
wx_stack_top--;
|
||||
wx_stack_count--;
|
||||
*x1 = wx_stack_top->x1;
|
||||
*y1 = wx_stack_top->y1;
|
||||
*x2 = wx_stack_top->x2;
|
||||
*y2 = wx_stack_top->y2;
|
||||
*x3 = wx_stack_top->x3;
|
||||
*y3 = wx_stack_top->y3;
|
||||
*x4 = wx_stack_top->x4;
|
||||
*y4 = wx_stack_top->y4;
|
||||
return (1);
|
||||
}
|
||||
|
||||
static bool wx_spline_add_point(double x, double y)
|
||||
{
|
||||
wxPoint *point = new wxPoint ;
|
||||
point->x = (int) x;
|
||||
point->y = (int) y;
|
||||
wx_spline_point_list.Append((wxObject*)point);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void wx_spline_draw_point_array(wxDC *dc)
|
||||
{
|
||||
dc->DrawLines(&wx_spline_point_list, 0, 0 );
|
||||
wxNode *node = wx_spline_point_list.First();
|
||||
while (node)
|
||||
{
|
||||
wxPoint *point = (wxPoint *)node->Data();
|
||||
delete point;
|
||||
delete node;
|
||||
node = wx_spline_point_list.First();
|
||||
}
|
||||
}
|
||||
|
||||
void wxPaintDC::DrawOpenSpline( wxList *points )
|
||||
{
|
||||
wxPoint *p;
|
||||
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
|
||||
double x1, y1, x2, y2;
|
||||
|
||||
wxNode *node = points->First();
|
||||
p = (wxPoint *)node->Data();
|
||||
|
||||
x1 = p->x;
|
||||
y1 = p->y;
|
||||
|
||||
node = node->Next();
|
||||
p = (wxPoint *)node->Data();
|
||||
|
||||
x2 = p->x;
|
||||
y2 = p->y;
|
||||
cx1 = (double)((x1 + x2) / 2);
|
||||
cy1 = (double)((y1 + y2) / 2);
|
||||
cx2 = (double)((cx1 + x2) / 2);
|
||||
cy2 = (double)((cy1 + y2) / 2);
|
||||
|
||||
wx_spline_add_point(x1, y1);
|
||||
|
||||
while ((node = node->Next()) != NULL)
|
||||
{
|
||||
p = (wxPoint *)node->Data();
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
x2 = p->x;
|
||||
y2 = p->y;
|
||||
cx4 = (double)(x1 + x2) / 2;
|
||||
cy4 = (double)(y1 + y2) / 2;
|
||||
cx3 = (double)(x1 + cx4) / 2;
|
||||
cy3 = (double)(y1 + cy4) / 2;
|
||||
|
||||
wx_quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4);
|
||||
|
||||
cx1 = cx4;
|
||||
cy1 = cy4;
|
||||
cx2 = (double)(cx1 + x2) / 2;
|
||||
cy2 = (double)(cy1 + y2) / 2;
|
||||
}
|
||||
|
||||
wx_spline_add_point( cx1, cy1 );
|
||||
wx_spline_add_point( x2, y2 );
|
||||
|
||||
wx_spline_draw_point_array( this );
|
||||
};
|
||||
@@ -1,66 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dcmemory.cpp
|
||||
// Purpose: wxMemoryDC class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "dcmemory.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dcmemory.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMemoryDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
|
||||
|
||||
wxMemoryDC::wxMemoryDC(void)
|
||||
{
|
||||
m_ok = FALSE;
|
||||
};
|
||||
|
||||
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
|
||||
{
|
||||
m_ok = FALSE;
|
||||
};
|
||||
|
||||
wxMemoryDC::~wxMemoryDC(void)
|
||||
{
|
||||
};
|
||||
|
||||
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
||||
{
|
||||
m_selected = bitmap;
|
||||
if (m_selected.Ok())
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ok = FALSE;
|
||||
};
|
||||
};
|
||||
|
||||
void wxMemoryDC::GetSize( int *width, int *height ) const
|
||||
{
|
||||
if (m_selected.Ok())
|
||||
{
|
||||
if (width) (*width) = m_selected.GetWidth();
|
||||
if (height) (*height) = m_selected.GetHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (width) (*width) = 0;
|
||||
if (height) (*height) = 0;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dcscreen.cpp
|
||||
// Purpose: wxScreenDC class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "dcscreen.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dcscreen.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxPaintDC)
|
||||
|
||||
// Create a DC representing the whole screen
|
||||
wxScreenDC::wxScreenDC()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
wxScreenDC::~wxScreenDC()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
@@ -1,291 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dialog.cpp
|
||||
// Purpose: wxDialog class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "dialog.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/settings.h"
|
||||
|
||||
// Lists to keep track of windows, so we can disable/enable them
|
||||
// for modal dialogs
|
||||
wxList wxModalDialogs;
|
||||
wxList wxModelessWindows; // Frames and modeless dialogs
|
||||
extern wxList wxPendingDelete;
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxDialog, wxPanel)
|
||||
EVT_BUTTON(wxID_OK, wxDialog::OnOK)
|
||||
EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
|
||||
EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
|
||||
EVT_CHAR_HOOK(wxDialog::OnCharHook)
|
||||
EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
|
||||
EVT_CLOSE(wxDialog::OnCloseWindow)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
wxDialog::wxDialog()
|
||||
{
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
||||
}
|
||||
|
||||
bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
m_windowStyle = style;
|
||||
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
||||
SetName(name);
|
||||
|
||||
if (!parent)
|
||||
wxTopLevelWindows.Append(this);
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
// TODO: create dialog
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxDialog::SetModal(bool flag)
|
||||
{
|
||||
if ( flag )
|
||||
m_windowStyle |= wxDIALOG_MODAL ;
|
||||
else
|
||||
if ( m_windowStyle & wxDIALOG_MODAL )
|
||||
m_windowStyle -= wxDIALOG_MODAL ;
|
||||
|
||||
wxModelessWindows.DeleteObject(this);
|
||||
if (!flag)
|
||||
wxModelessWindows.Append(this);
|
||||
}
|
||||
|
||||
wxDialog::~wxDialog()
|
||||
{
|
||||
// TODO
|
||||
wxTopLevelWindows.DeleteObject(this);
|
||||
|
||||
if ( (GetWindowStyleFlag() & wxDIALOG_MODAL) != wxDIALOG_MODAL )
|
||||
wxModelessWindows.DeleteObject(this);
|
||||
|
||||
// If this is the last top-level window, exit.
|
||||
if (wxTheApp && (wxTopLevelWindows.Number() == 0))
|
||||
{
|
||||
wxTheApp->SetTopWindow(NULL);
|
||||
|
||||
if (wxTheApp->GetExitOnFrameDelete())
|
||||
{
|
||||
// TODO: exit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// By default, pressing escape cancels the dialog
|
||||
void wxDialog::OnCharHook(wxKeyEvent& event)
|
||||
{
|
||||
if (GetHWND())
|
||||
{
|
||||
if (event.m_keyCode == WXK_ESCAPE)
|
||||
{
|
||||
// Behaviour changed in 2.0: we'll send a Cancel message
|
||||
// to the dialog instead of Close.
|
||||
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
|
||||
cancelEvent.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent(cancelEvent);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
// We didn't process this event.
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxDialog::Iconize(bool WXUNUSED(iconize))
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxDialog::IsIconized() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxDialog::SetClientSize(int width, int height)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxDialog::GetPosition(int *x, int *y) const
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxDialog::Show(bool show)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxDialog::SetTitle(const wxString& title)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
wxString wxDialog::GetTitle() const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
void wxDialog::Centre(int direction)
|
||||
{
|
||||
int x_offset,y_offset ;
|
||||
int display_width, display_height;
|
||||
int width, height, x, y;
|
||||
wxFrame *frame ;
|
||||
if (direction & wxCENTER_FRAME)
|
||||
{
|
||||
frame = (wxFrame*)GetParent() ;
|
||||
if (frame)
|
||||
{
|
||||
frame->GetPosition(&x_offset,&y_offset) ;
|
||||
frame->GetSize(&display_width,&display_height) ;
|
||||
}
|
||||
}
|
||||
else
|
||||
frame = NULL ;
|
||||
|
||||
if (frame==NULL)
|
||||
{
|
||||
wxDisplaySize(&display_width, &display_height);
|
||||
x_offset = 0 ;
|
||||
y_offset = 0 ;
|
||||
}
|
||||
|
||||
GetSize(&width, &height);
|
||||
GetPosition(&x, &y);
|
||||
|
||||
if (direction & wxHORIZONTAL)
|
||||
x = (int)((display_width - width)/2);
|
||||
if (direction & wxVERTICAL)
|
||||
y = (int)((display_height - height)/2);
|
||||
|
||||
SetSize(x+x_offset, y+y_offset, width, height);
|
||||
}
|
||||
|
||||
// Replacement for Show(TRUE) for modal dialogs - returns return code
|
||||
int wxDialog::ShowModal()
|
||||
{
|
||||
m_windowStyle |= wxDIALOG_MODAL;
|
||||
// TODO: modal showing
|
||||
Show(TRUE);
|
||||
return GetReturnCode();
|
||||
}
|
||||
|
||||
void wxDialog::EndModal(int retCode)
|
||||
{
|
||||
SetReturnCode(retCode);
|
||||
// TODO modal un-showing
|
||||
Show(FALSE);
|
||||
}
|
||||
|
||||
// Standard buttons
|
||||
void wxDialog::OnOK(wxCommandEvent& event)
|
||||
{
|
||||
if ( Validate() && TransferDataFromWindow() )
|
||||
{
|
||||
if ( IsModal() )
|
||||
EndModal(wxID_OK);
|
||||
else
|
||||
{
|
||||
SetReturnCode(wxID_OK);
|
||||
this->Show(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxDialog::OnApply(wxCommandEvent& event)
|
||||
{
|
||||
if (Validate())
|
||||
TransferDataFromWindow();
|
||||
// TODO probably need to disable the Apply button until things change again
|
||||
}
|
||||
|
||||
void wxDialog::OnCancel(wxCommandEvent& event)
|
||||
{
|
||||
if ( IsModal() )
|
||||
EndModal(wxID_CANCEL);
|
||||
else
|
||||
{
|
||||
SetReturnCode(wxID_CANCEL);
|
||||
this->Show(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void wxDialog::OnCloseWindow(wxCloseEvent& event)
|
||||
{
|
||||
// We'll send a Cancel message by default,
|
||||
// which may close the dialog.
|
||||
// Check for looping if the Cancel event handler calls Close().
|
||||
|
||||
// Note that if a cancel button and handler aren't present in the dialog,
|
||||
// nothing will happen when you close the dialog via the window manager, or
|
||||
// via Close().
|
||||
// We wouldn't want to destroy the dialog by default, since the dialog may have been
|
||||
// created on the stack.
|
||||
// However, this does mean that calling dialog->Close() won't delete the dialog
|
||||
// unless the handler for wxID_CANCEL does so. So use Destroy() if you want to be
|
||||
// sure to destroy the dialog.
|
||||
// The default OnCancel (above) simply ends a modal dialog, and hides a modeless dialog.
|
||||
|
||||
static wxList closing;
|
||||
|
||||
if ( closing.Member(this) )
|
||||
return;
|
||||
|
||||
closing.Append(this);
|
||||
|
||||
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
|
||||
cancelEvent.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent(cancelEvent); // This may close the dialog
|
||||
|
||||
closing.DeleteObject(this);
|
||||
}
|
||||
|
||||
// Destroy the window (delayed, if a managed window)
|
||||
bool wxDialog::Destroy()
|
||||
{
|
||||
if (!wxPendingDelete.Member(this))
|
||||
wxPendingDelete.Append(this);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
{
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
|
||||
Refresh();
|
||||
}
|
||||
|
||||
133
src/qt/dnd.cpp
133
src/qt/dnd.cpp
@@ -1,133 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dnd.cpp
|
||||
// Purpose: wxDropTarget, wxDropSource, wxDataObject implementation
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "dnd.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dnd.h"
|
||||
#include "wx/window.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// global
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDropTarget
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDropTarget::wxDropTarget()
|
||||
{
|
||||
};
|
||||
|
||||
wxDropTarget::~wxDropTarget()
|
||||
{
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextDropTarget
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxTextDropTarget::OnDrop( long x, long y, const void *pData )
|
||||
{
|
||||
OnDropText( x, y, (const char*)pData );
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
bool wxTextDropTarget::OnDropText( long x, long y, const char *psz )
|
||||
{
|
||||
printf( "Got dropped text: %s.\n", psz );
|
||||
printf( "At x: %d, y: %d.\n", (int)x, (int)y );
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
size_t wxTextDropTarget::GetFormatCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const
|
||||
{
|
||||
return wxDF_TEXT;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFileDropTarget
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
|
||||
{
|
||||
printf( "Got %d dropped files.\n", (int)nFiles );
|
||||
printf( "At x: %d, y: %d.\n", (int)x, (int)y );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxFileDropTarget::OnDrop(long x, long y, const void *WXUNUSED(pData) )
|
||||
{
|
||||
char *str = "/this/is/a/path.txt";
|
||||
|
||||
return OnDropFiles(x, y, 1, &str );
|
||||
}
|
||||
|
||||
size_t wxFileDropTarget::GetFormatCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
|
||||
{
|
||||
return wxDF_FILENAME;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxDropSource
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// drag request
|
||||
|
||||
wxDropSource::wxDropSource( wxWindow *win )
|
||||
{
|
||||
// TODO
|
||||
m_window = win;
|
||||
m_data = NULL;
|
||||
|
||||
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
|
||||
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
|
||||
};
|
||||
|
||||
wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win )
|
||||
{
|
||||
// TODO
|
||||
m_window = win;
|
||||
m_data = &data;
|
||||
|
||||
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
|
||||
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
|
||||
};
|
||||
|
||||
void wxDropSource::SetData( wxDataObject &data )
|
||||
{
|
||||
m_data = &data;
|
||||
};
|
||||
|
||||
wxDropSource::~wxDropSource(void)
|
||||
{
|
||||
};
|
||||
|
||||
wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
|
||||
{
|
||||
// TODO
|
||||
return Error;
|
||||
};
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#define fdiag_width 16
|
||||
#define fdiag_height 16
|
||||
static char fdiag_bits[] = {
|
||||
0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20,
|
||||
0x40, 0x40, 0x80, 0x80, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08,
|
||||
0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80};
|
||||
@@ -1,140 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: filedlg.cpp
|
||||
// Purpose: wxFileDialog
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "filedlg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/filedlg.h"
|
||||
|
||||
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
|
||||
|
||||
char *wxFileSelector(const char *title,
|
||||
const char *defaultDir, const char *defaultFileName,
|
||||
const char *defaultExtension, const char *filter, int flags,
|
||||
wxWindow *parent, int x, int y)
|
||||
{
|
||||
// If there's a default extension specified but no filter, we create a suitable
|
||||
// filter.
|
||||
|
||||
wxString filter2("");
|
||||
if ( defaultExtension && !filter )
|
||||
filter2 = wxString("*.") + wxString(defaultExtension) ;
|
||||
else if ( filter )
|
||||
filter2 = filter;
|
||||
|
||||
wxString defaultDirString;
|
||||
if (defaultDir)
|
||||
defaultDirString = defaultDir;
|
||||
else
|
||||
defaultDirString = "";
|
||||
|
||||
wxString defaultFilenameString;
|
||||
if (defaultFileName)
|
||||
defaultFilenameString = defaultFileName;
|
||||
else
|
||||
defaultFilenameString = "";
|
||||
|
||||
wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y));
|
||||
|
||||
if ( fileDialog.ShowModal() == wxID_OK )
|
||||
{
|
||||
strcpy(wxBuffer, (const char *)fileDialog.GetPath());
|
||||
return wxBuffer;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *wxFileSelectorEx(const char *title,
|
||||
const char *defaultDir,
|
||||
const char *defaultFileName,
|
||||
int* defaultFilterIndex,
|
||||
const char *filter,
|
||||
int flags,
|
||||
wxWindow* parent,
|
||||
int x,
|
||||
int y)
|
||||
|
||||
{
|
||||
wxFileDialog fileDialog(parent, title ? title : "", defaultDir ? defaultDir : "",
|
||||
defaultFileName ? defaultFileName : "", filter ? filter : "", flags, wxPoint(x, y));
|
||||
|
||||
if ( fileDialog.ShowModal() == wxID_OK )
|
||||
{
|
||||
*defaultFilterIndex = fileDialog.GetFilterIndex();
|
||||
strcpy(wxBuffer, (const char *)fileDialog.GetPath());
|
||||
return wxBuffer;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
||||
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
|
||||
long style, const wxPoint& pos)
|
||||
{
|
||||
m_message = message;
|
||||
m_dialogStyle = style;
|
||||
m_parent = parent;
|
||||
m_path = "";
|
||||
m_fileName = defaultFileName;
|
||||
m_dir = defaultDir;
|
||||
m_wildCard = wildCard;
|
||||
m_filterIndex = 1;
|
||||
}
|
||||
|
||||
int wxFileDialog::ShowModal()
|
||||
{
|
||||
// TODO
|
||||
wxID_CANCEL;
|
||||
}
|
||||
|
||||
// Generic file load/save dialog
|
||||
static char *
|
||||
wxDefaultFileSelector(bool load, const char *what, const char *extension, const char *default_name, wxWindow *parent)
|
||||
{
|
||||
char *ext = (char *)extension;
|
||||
|
||||
char prompt[50];
|
||||
wxString str;
|
||||
if (load)
|
||||
str = "Load %s file";
|
||||
else
|
||||
str = "Save %s file";
|
||||
sprintf(prompt, wxGetTranslation(str), what);
|
||||
|
||||
if (*ext == '.') ext++;
|
||||
char wild[60];
|
||||
sprintf(wild, "*.%s", ext);
|
||||
|
||||
return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent);
|
||||
}
|
||||
|
||||
// Generic file load dialog
|
||||
char *
|
||||
wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
|
||||
{
|
||||
return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
|
||||
}
|
||||
|
||||
|
||||
// Generic file save dialog
|
||||
char *
|
||||
wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
|
||||
{
|
||||
return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
|
||||
}
|
||||
|
||||
|
||||
239
src/qt/font.cpp
239
src/qt/font.cpp
@@ -1,239 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: font.cpp
|
||||
// Purpose: wxFont class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "font.h"
|
||||
#endif
|
||||
|
||||
#include "wx/font.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
|
||||
|
||||
wxFontRefData::wxFontRefData()
|
||||
{
|
||||
m_style = 0;
|
||||
m_pointSize = 0;
|
||||
m_family = 0;
|
||||
m_style = 0;
|
||||
m_weight = 0;
|
||||
m_underlined = 0;
|
||||
m_faceName = "";
|
||||
/* TODO
|
||||
m_hFont = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
wxFontRefData::wxFontRefData(const wxFontRefData& data)
|
||||
{
|
||||
m_style = data.m_style;
|
||||
m_pointSize = data.m_pointSize;
|
||||
m_family = data.m_family;
|
||||
m_style = data.m_style;
|
||||
m_weight = data.m_weight;
|
||||
m_underlined = data.m_underlined;
|
||||
m_faceName = data.m_faceName;
|
||||
/* TODO
|
||||
m_hFont = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
wxFontRefData::~wxFontRefData()
|
||||
{
|
||||
// TODO: delete font data
|
||||
}
|
||||
|
||||
wxFont::wxFont()
|
||||
{
|
||||
if ( wxTheFontList )
|
||||
wxTheFontList->Append(this);
|
||||
}
|
||||
|
||||
wxFont::wxFont(int pointSize, int family, int style, int weight, bool underlined, const wxString& faceName)
|
||||
{
|
||||
Create(pointSize, family, style, weight, underlined, faceName);
|
||||
|
||||
if ( wxTheFontList )
|
||||
wxTheFontList->Append(this);
|
||||
}
|
||||
|
||||
bool wxFont::Create(int pointSize, int family, int style, int weight, bool underlined, const wxString& faceName)
|
||||
{
|
||||
UnRef();
|
||||
m_refData = new wxFontRefData;
|
||||
|
||||
M_FONTDATA->m_family = family;
|
||||
M_FONTDATA->m_style = style;
|
||||
M_FONTDATA->m_weight = weight;
|
||||
M_FONTDATA->m_pointSize = pointSize;
|
||||
M_FONTDATA->m_underlined = underlined;
|
||||
M_FONTDATA->m_faceName = faceName;
|
||||
|
||||
RealizeResource();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxFont::~wxFont()
|
||||
{
|
||||
if (wxTheFontList)
|
||||
wxTheFontList->DeleteObject(this);
|
||||
}
|
||||
|
||||
bool wxFont::RealizeResource()
|
||||
{
|
||||
// TODO: create the font (if there is a native font object)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxFont::Unshare()
|
||||
{
|
||||
// Don't change shared data
|
||||
if (!m_refData)
|
||||
{
|
||||
m_refData = new wxFontRefData();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
|
||||
UnRef();
|
||||
m_refData = ref;
|
||||
}
|
||||
}
|
||||
|
||||
void wxFont::SetPointSize(int pointSize)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_FONTDATA->m_pointSize = pointSize;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxFont::SetFamily(int family)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_FONTDATA->m_family = family;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxFont::SetStyle(int style)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_FONTDATA->m_style = style;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxFont::SetWeight(int weight)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_FONTDATA->m_weight = weight;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxFont::SetFaceName(const wxString& faceName)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_FONTDATA->m_faceName = faceName;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxFont::SetUnderlined(bool underlined)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_FONTDATA->m_underlined = underlined;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
wxString wxFont::GetFamilyString() const
|
||||
{
|
||||
wxString fam("");
|
||||
switch (GetFamily())
|
||||
{
|
||||
case wxDECORATIVE:
|
||||
fam = "wxDECORATIVE";
|
||||
break;
|
||||
case wxROMAN:
|
||||
fam = "wxROMAN";
|
||||
break;
|
||||
case wxSCRIPT:
|
||||
fam = "wxSCRIPT";
|
||||
break;
|
||||
case wxSWISS:
|
||||
fam = "wxSWISS";
|
||||
break;
|
||||
case wxMODERN:
|
||||
fam = "wxMODERN";
|
||||
break;
|
||||
case wxTELETYPE:
|
||||
fam = "wxTELETYPE";
|
||||
break;
|
||||
default:
|
||||
fam = "wxDEFAULT";
|
||||
break;
|
||||
}
|
||||
return fam;
|
||||
}
|
||||
|
||||
/* New font system */
|
||||
wxString wxFont::GetFaceName() const
|
||||
{
|
||||
wxString str("");
|
||||
if (M_FONTDATA)
|
||||
str = M_FONTDATA->m_faceName ;
|
||||
return str;
|
||||
}
|
||||
|
||||
wxString wxFont::GetStyleString() const
|
||||
{
|
||||
wxString styl("");
|
||||
switch (GetStyle())
|
||||
{
|
||||
case wxITALIC:
|
||||
styl = "wxITALIC";
|
||||
break;
|
||||
case wxSLANT:
|
||||
styl = "wxSLANT";
|
||||
break;
|
||||
default:
|
||||
styl = "wxNORMAL";
|
||||
break;
|
||||
}
|
||||
return styl;
|
||||
}
|
||||
|
||||
wxString wxFont::GetWeightString() const
|
||||
{
|
||||
wxString w("");
|
||||
switch (GetWeight())
|
||||
{
|
||||
case wxBOLD:
|
||||
w = "wxBOLD";
|
||||
break;
|
||||
case wxLIGHT:
|
||||
w = "wxLIGHT";
|
||||
break;
|
||||
default:
|
||||
w = "wxNORMAL";
|
||||
break;
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
533
src/qt/frame.cpp
533
src/qt/frame.cpp
@@ -1,533 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: frame.cpp
|
||||
// Purpose: wxFrame
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "frame.h"
|
||||
#endif
|
||||
|
||||
#include "wx/frame.h"
|
||||
#include "wx/statusbr.h"
|
||||
#include "wx/toolbar.h"
|
||||
#include "wx/menuitem.h"
|
||||
|
||||
extern wxList wxModelessWindows;
|
||||
extern wxList wxPendingDelete;
|
||||
|
||||
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
|
||||
EVT_SIZE(wxFrame::OnSize)
|
||||
EVT_ACTIVATE(wxFrame::OnActivate)
|
||||
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
|
||||
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
|
||||
EVT_IDLE(wxFrame::OnIdle)
|
||||
EVT_CLOSE(wxFrame::OnCloseWindow)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
|
||||
|
||||
#if wxUSE_NATIVE_STATUSBAR
|
||||
bool wxFrame::m_useNativeStatusBar = TRUE;
|
||||
#else
|
||||
bool wxFrame::m_useNativeStatusBar = FALSE;
|
||||
#endif
|
||||
|
||||
wxFrame::wxFrame()
|
||||
{
|
||||
m_frameToolBar = NULL ;
|
||||
m_frameMenuBar = NULL;
|
||||
m_frameStatusBar = NULL;
|
||||
|
||||
m_windowParent = NULL;
|
||||
m_iconized = FALSE;
|
||||
}
|
||||
|
||||
bool wxFrame::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
if (!parent)
|
||||
wxTopLevelWindows.Append(this);
|
||||
|
||||
SetName(name);
|
||||
m_windowStyle = style;
|
||||
m_frameMenuBar = NULL;
|
||||
m_frameToolBar = NULL ;
|
||||
m_frameStatusBar = NULL;
|
||||
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
|
||||
|
||||
if ( id > -1 )
|
||||
m_windowId = id;
|
||||
else
|
||||
m_windowId = (int)NewControlId();
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
wxModelessWindows.Append(this);
|
||||
|
||||
// TODO: create frame.
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxFrame::~wxFrame()
|
||||
{
|
||||
wxTopLevelWindows.DeleteObject(this);
|
||||
|
||||
if (m_frameStatusBar)
|
||||
delete m_frameStatusBar;
|
||||
if (m_frameMenuBar)
|
||||
delete m_frameMenuBar;
|
||||
|
||||
/* Check if it's the last top-level window */
|
||||
|
||||
if (wxTheApp && (wxTopLevelWindows.Number() == 0))
|
||||
{
|
||||
wxTheApp->SetTopWindow(NULL);
|
||||
|
||||
if (wxTheApp->GetExitOnFrameDelete())
|
||||
{
|
||||
// TODO signal to the app that we're going to close
|
||||
}
|
||||
}
|
||||
|
||||
wxModelessWindows.DeleteObject(this);
|
||||
}
|
||||
|
||||
// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
|
||||
void wxFrame::GetClientSize(int *x, int *y) const
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Set the client size (i.e. leave the calculation of borders etc.
|
||||
// to wxWindows)
|
||||
void wxFrame::SetClientSize(int width, int height)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxFrame::GetSize(int *width, int *height) const
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxFrame::GetPosition(int *x, int *y) const
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxFrame::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxFrame::Show(bool show)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxFrame::Iconize(bool iconize)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Equivalent to maximize/restore in Windows
|
||||
void wxFrame::Maximize(bool maximize)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxFrame::IsIconized() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxFrame::SetTitle(const wxString& title)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
wxString wxFrame::GetTitle() const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
void wxFrame::SetIcon(const wxIcon& icon)
|
||||
{
|
||||
m_icon = icon;
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxFrame::SetAcceleratorTable(const wxAcceleratorTable& accel)
|
||||
{
|
||||
m_acceleratorTable = accel;
|
||||
}
|
||||
|
||||
wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
|
||||
const wxString& name)
|
||||
{
|
||||
wxStatusBar *statusBar = NULL;
|
||||
|
||||
statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20),
|
||||
style, name);
|
||||
|
||||
// Set the height according to the font and the border size
|
||||
wxClientDC dc(statusBar);
|
||||
dc.SetFont(* statusBar->GetFont());
|
||||
|
||||
long x, y;
|
||||
dc.GetTextExtent("X", &x, &y);
|
||||
|
||||
int height = (int)( (y * 1.1) + 2* statusBar->GetBorderY());
|
||||
|
||||
statusBar->SetSize(-1, -1, 100, height);
|
||||
|
||||
statusBar->SetFieldsCount(number);
|
||||
return statusBar;
|
||||
}
|
||||
|
||||
wxStatusBar* wxFrame::CreateStatusBar(int number, long style, wxWindowID id,
|
||||
const wxString& name)
|
||||
{
|
||||
// Calling CreateStatusBar twice is an error.
|
||||
wxCHECK_MSG( m_frameStatusBar == NULL, FALSE,
|
||||
"recreating status bar in wxFrame" );
|
||||
|
||||
m_frameStatusBar = OnCreateStatusBar(number, style, id,
|
||||
name);
|
||||
if ( m_frameStatusBar )
|
||||
{
|
||||
PositionStatusBar();
|
||||
return m_frameStatusBar;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxFrame::SetStatusText(const wxString& text, int number)
|
||||
{
|
||||
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
|
||||
|
||||
m_frameStatusBar->SetStatusText(text, number);
|
||||
}
|
||||
|
||||
void wxFrame::SetStatusWidths(int n, const int widths_field[])
|
||||
{
|
||||
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
|
||||
|
||||
m_frameStatusBar->SetStatusWidths(n, widths_field);
|
||||
PositionStatusBar();
|
||||
}
|
||||
|
||||
void wxFrame::PositionStatusBar()
|
||||
{
|
||||
int w, h;
|
||||
GetClientSize(&w, &h);
|
||||
int sw, sh;
|
||||
m_frameStatusBar->GetSize(&sw, &sh);
|
||||
|
||||
// Since we wish the status bar to be directly under the client area,
|
||||
// we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
|
||||
m_frameStatusBar->SetSize(0, h, w, sh);
|
||||
}
|
||||
|
||||
void wxFrame::SetMenuBar(wxMenuBar *menuBar)
|
||||
{
|
||||
if (!menuBar)
|
||||
{
|
||||
m_frameMenuBar = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
m_frameMenuBar = menuBar;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxFrame::Fit()
|
||||
{
|
||||
// Work out max. size
|
||||
wxNode *node = GetChildren()->First();
|
||||
int max_width = 0;
|
||||
int max_height = 0;
|
||||
while (node)
|
||||
{
|
||||
// Find a child that's a subwindow, but not a dialog box.
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
|
||||
if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
|
||||
!win->IsKindOf(CLASSINFO(wxDialog)))
|
||||
{
|
||||
int width, height;
|
||||
int x, y;
|
||||
win->GetSize(&width, &height);
|
||||
win->GetPosition(&x, &y);
|
||||
|
||||
if ((x + width) > max_width)
|
||||
max_width = x + width;
|
||||
if ((y + height) > max_height)
|
||||
max_height = y + height;
|
||||
}
|
||||
node = node->Next();
|
||||
}
|
||||
SetClientSize(max_width, max_height);
|
||||
}
|
||||
|
||||
// Responds to colour changes, and passes event on to children.
|
||||
void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
{
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
|
||||
Refresh();
|
||||
|
||||
if ( m_frameStatusBar )
|
||||
{
|
||||
wxSysColourChangedEvent event2;
|
||||
event2.SetEventObject( m_frameStatusBar );
|
||||
m_frameStatusBar->ProcessEvent(event2);
|
||||
}
|
||||
|
||||
// Propagate the event to the non-top-level children
|
||||
wxWindow::OnSysColourChanged(event);
|
||||
}
|
||||
|
||||
// Default resizing behaviour - if only ONE subwindow,
|
||||
// resize to client rectangle size
|
||||
void wxFrame::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
// if we're using constraints - do use them
|
||||
#if wxUSE_CONSTRAINTS
|
||||
if ( GetAutoLayout() ) {
|
||||
Layout();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// do we have _exactly_ one child?
|
||||
wxWindow *child = NULL;
|
||||
for ( wxNode *node = GetChildren()->First(); node; node = node->Next() )
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
|
||||
!win->IsKindOf(CLASSINFO(wxDialog)) &&
|
||||
(win != GetStatusBar()) &&
|
||||
(win != GetToolBar()) )
|
||||
{
|
||||
if ( child )
|
||||
return; // it's our second subwindow - nothing to do
|
||||
child = win;
|
||||
}
|
||||
}
|
||||
|
||||
if ( child ) {
|
||||
// we have exactly one child - set it's size to fill the whole frame
|
||||
int clientW, clientH;
|
||||
GetClientSize(&clientW, &clientH);
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
||||
child->SetSize(x, y, clientW, clientH);
|
||||
}
|
||||
}
|
||||
|
||||
// Default activation behaviour - set the focus for the first child
|
||||
// subwindow found.
|
||||
void wxFrame::OnActivate(wxActivateEvent& event)
|
||||
{
|
||||
for(wxNode *node = GetChildren()->First(); node; node = node->Next())
|
||||
{
|
||||
// Find a child that's a subwindow, but not a dialog box.
|
||||
wxWindow *child = (wxWindow *)node->Data();
|
||||
if (!child->IsKindOf(CLASSINFO(wxFrame)) &&
|
||||
!child->IsKindOf(CLASSINFO(wxDialog)))
|
||||
{
|
||||
#if WXDEBUG > 1
|
||||
wxDebugMsg("wxFrame::OnActivate: about to set the child's focus.\n");
|
||||
#endif
|
||||
child->SetFocus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The default implementation for the close window event.
|
||||
void wxFrame::OnCloseWindow(wxCloseEvent& event)
|
||||
{
|
||||
this->Destroy();
|
||||
}
|
||||
|
||||
// Destroy the window (delayed, if a managed window)
|
||||
bool wxFrame::Destroy()
|
||||
{
|
||||
if (!wxPendingDelete.Member(this))
|
||||
wxPendingDelete.Append(this);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Default menu selection behaviour - display a help string
|
||||
void wxFrame::OnMenuHighlight(wxMenuEvent& event)
|
||||
{
|
||||
if (GetStatusBar())
|
||||
{
|
||||
if (event.GetMenuId() == -1)
|
||||
SetStatusText("");
|
||||
else
|
||||
{
|
||||
wxMenuBar *menuBar = GetMenuBar();
|
||||
if (menuBar)
|
||||
{
|
||||
wxString helpString(menuBar->GetHelpString(event.GetMenuId()));
|
||||
if (helpString != "")
|
||||
SetStatusText(helpString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxMenuBar *wxFrame::GetMenuBar() const
|
||||
{
|
||||
return m_frameMenuBar;
|
||||
}
|
||||
|
||||
void wxFrame::Centre(int direction)
|
||||
{
|
||||
int display_width, display_height, width, height, x, y;
|
||||
wxDisplaySize(&display_width, &display_height);
|
||||
|
||||
GetSize(&width, &height);
|
||||
GetPosition(&x, &y);
|
||||
|
||||
if (direction & wxHORIZONTAL)
|
||||
x = (int)((display_width - width)/2);
|
||||
if (direction & wxVERTICAL)
|
||||
y = (int)((display_height - height)/2);
|
||||
|
||||
SetSize(x, y, width, height);
|
||||
}
|
||||
|
||||
// Call this to simulate a menu command
|
||||
void wxFrame::Command(int id)
|
||||
{
|
||||
ProcessCommand(id);
|
||||
}
|
||||
|
||||
void wxFrame::ProcessCommand(int id)
|
||||
{
|
||||
wxCommandEvent commandEvent(wxEVENT_TYPE_MENU_COMMAND, id);
|
||||
commandEvent.SetInt( id );
|
||||
commandEvent.SetEventObject( this );
|
||||
|
||||
wxMenuBar *bar = GetMenuBar() ;
|
||||
if (!bar)
|
||||
return;
|
||||
|
||||
/* TODO: check the menu item if required
|
||||
wxMenuItem *item = bar->FindItemForId(id) ;
|
||||
if (item && item->IsCheckable())
|
||||
{
|
||||
bar->Check(id,!bar->Checked(id)) ;
|
||||
}
|
||||
*/
|
||||
|
||||
GetEventHandler()->ProcessEvent(commandEvent);
|
||||
}
|
||||
|
||||
// Checks if there is a toolbar, and returns the first free client position
|
||||
wxPoint wxFrame::GetClientAreaOrigin() const
|
||||
{
|
||||
wxPoint pt(0, 0);
|
||||
if (GetToolBar())
|
||||
{
|
||||
int w, h;
|
||||
GetToolBar()->GetSize(& w, & h);
|
||||
|
||||
if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
|
||||
{
|
||||
pt.x += w;
|
||||
}
|
||||
else
|
||||
{
|
||||
pt.y += h;
|
||||
}
|
||||
}
|
||||
return pt;
|
||||
}
|
||||
|
||||
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
|
||||
{
|
||||
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
|
||||
"recreating toolbar in wxFrame" );
|
||||
|
||||
wxToolBar* toolBar = OnCreateToolBar(style, id, name);
|
||||
if (toolBar)
|
||||
{
|
||||
SetToolBar(toolBar);
|
||||
PositionToolBar();
|
||||
return toolBar;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
wxToolBar* wxFrame::OnCreateToolBar(long style, wxWindowID id, const wxString& name)
|
||||
{
|
||||
return new wxToolBar(this, id, wxDefaultPosition, wxDefaultSize, style, name);
|
||||
}
|
||||
|
||||
void wxFrame::PositionToolBar()
|
||||
{
|
||||
int cw, ch;
|
||||
|
||||
// TODO: we actually need to use the low-level client size, before
|
||||
// the toolbar/status bar were added.
|
||||
// So DEFINITELY replace the line below with something appropriate.
|
||||
|
||||
wxCHECK_MSG( TRUE, FALSE,
|
||||
"PositionToolBar not implemented properly, see frame.cpp" );
|
||||
|
||||
GetClientSize(& cw, &ch);
|
||||
|
||||
if ( GetStatusBar() )
|
||||
{
|
||||
int statusX, statusY;
|
||||
GetStatusBar()->GetClientSize(&statusX, &statusY);
|
||||
ch -= statusY;
|
||||
}
|
||||
|
||||
if (GetToolBar())
|
||||
{
|
||||
int tw, th;
|
||||
GetToolBar()->GetSize(& tw, & th);
|
||||
|
||||
if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
|
||||
{
|
||||
// Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
|
||||
// means, pretend we don't have toolbar/status bar, so we
|
||||
// have the original client size.
|
||||
GetToolBar()->SetSize(0, 0, tw, ch, wxSIZE_NO_ADJUSTMENTS);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the 'real' position
|
||||
GetToolBar()->SetSize(0, 0, cw, th, wxSIZE_NO_ADJUSTMENTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
103
src/qt/gauge.cpp
103
src/qt/gauge.cpp
@@ -1,103 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: gauge.cpp
|
||||
// Purpose: wxGauge class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "gauge.h"
|
||||
#endif
|
||||
|
||||
#include "wx/gauge.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
|
||||
|
||||
bool wxGauge::Create(wxWindow *parent, wxWindowID id,
|
||||
int range,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
m_rangeMax = range;
|
||||
m_windowStyle = style;
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxGauge::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxGauge::SetShadowWidth(int w)
|
||||
{
|
||||
// TODO optional
|
||||
}
|
||||
|
||||
void wxGauge::SetBezelFace(int w)
|
||||
{
|
||||
// TODO optional
|
||||
}
|
||||
|
||||
void wxGauge::SetRange(int r)
|
||||
{
|
||||
m_rangeMax = r;
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxGauge::SetValue(int pos)
|
||||
{
|
||||
m_gaugePos = pos;
|
||||
// TODO
|
||||
}
|
||||
|
||||
int wxGauge::GetShadowWidth() const
|
||||
{
|
||||
// TODO optional
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxGauge::GetBezelFace() const
|
||||
{
|
||||
// TODO optional
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxGauge::GetRange() const
|
||||
{
|
||||
return m_rangeMax;
|
||||
}
|
||||
|
||||
int wxGauge::GetValue() const
|
||||
{
|
||||
return m_gaugePos;
|
||||
}
|
||||
|
||||
void wxGauge::SetForegroundColour(const wxColour& col)
|
||||
{
|
||||
m_foregroundColour = col ;
|
||||
}
|
||||
|
||||
void wxGauge::SetBackgroundColour(const wxColour& col)
|
||||
{
|
||||
m_backgroundColour = col ;
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: gdiobj.cpp
|
||||
// Purpose: wxGDIObject class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "gdiobj.h"
|
||||
#endif
|
||||
|
||||
#include "wx/gdiobj.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
|
||||
|
||||
// TODO: Nothing to do, unless you want to.
|
||||
@@ -1,6 +0,0 @@
|
||||
#define horiz_width 15
|
||||
#define horiz_height 15
|
||||
static char horiz_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0x7f, 0x00, 0x00, 0x00, 0x00};
|
||||
@@ -1,68 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: icon.cpp
|
||||
// Purpose: wxIcon class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "icon.h"
|
||||
#endif
|
||||
|
||||
#include "wx/icon.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
|
||||
|
||||
/*
|
||||
* Icons
|
||||
*/
|
||||
|
||||
|
||||
wxIconRefData::wxIconRefData()
|
||||
{
|
||||
// TODO: init icon handle
|
||||
}
|
||||
|
||||
wxIconRefData::~wxIconRefData()
|
||||
{
|
||||
// TODO: destroy icon handle
|
||||
}
|
||||
|
||||
wxIcon::wxIcon()
|
||||
{
|
||||
}
|
||||
|
||||
wxIcon::wxIcon(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSED(height))
|
||||
{
|
||||
}
|
||||
|
||||
wxIcon::wxIcon(const wxString& icon_file, long flags,
|
||||
int desiredWidth, int desiredHeight)
|
||||
|
||||
{
|
||||
LoadFile(icon_file, flags, desiredWidth, desiredHeight);
|
||||
}
|
||||
|
||||
wxIcon::~wxIcon()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxIcon::LoadFile(const wxString& filename, long type,
|
||||
int desiredWidth, int desiredHeight)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
m_refData = new wxIconRefData;
|
||||
|
||||
wxBitmapHandler *handler = FindHandler(type);
|
||||
|
||||
if ( handler )
|
||||
return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1,279 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: joystick.cpp
|
||||
// Purpose: wxJoystick class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "joystick.h"
|
||||
#endif
|
||||
|
||||
#include <wx/joystick.h>
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject)
|
||||
|
||||
// Attributes
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxPoint wxJoystick::GetPosition() const
|
||||
{
|
||||
// TODO
|
||||
return wxPoint(0, 0);
|
||||
}
|
||||
|
||||
int wxJoystick::GetZPosition() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetButtonState() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetPOVPosition() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetPOVCTSPosition() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetRudderPosition() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetUPosition() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetVPosition() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetMovementThreshold() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wxJoystick::SetMovementThreshold(int threshold)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Capabilities
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool wxJoystick::IsOk() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int wxJoystick::GetNumberJoysticks() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetManufacturerId() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetProductId() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
wxString wxJoystick::GetProductName() const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
int wxJoystick::GetXMin() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetYMin() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetZMin() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetXMax() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetYMax() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetZMax() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetNumberButtons() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetNumberAxes() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetMaxButtons() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetMaxAxes() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetPollingMin() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetPollingMax() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetRudderMin() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetRudderMax() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetUMin() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetUMax() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetVMin() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxJoystick::GetVMax() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wxJoystick::HasRudder() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxJoystick::HasZ() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxJoystick::HasU() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxJoystick::HasV() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxJoystick::HasPOV() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxJoystick::HasPOV4Dir() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxJoystick::HasPOVCTS() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Operations
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool wxJoystick::SetCapture(wxWindow* win, int pollingFreq)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxJoystick::ReleaseCapture()
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1,238 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: listbox.cpp
|
||||
// Purpose: wxListBox
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "listbox.h"
|
||||
#endif
|
||||
|
||||
#include "wx/listbox.h"
|
||||
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
|
||||
|
||||
// ============================================================================
|
||||
// list box control implementation
|
||||
// ============================================================================
|
||||
|
||||
// Listbox item
|
||||
wxListBox::wxListBox()
|
||||
{
|
||||
m_noItems = 0;
|
||||
m_selected = 0;
|
||||
}
|
||||
|
||||
bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
int n, const wxString choices[],
|
||||
long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
m_noItems = n;
|
||||
m_selected = 0;
|
||||
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
wxSystemSettings settings;
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
|
||||
|
||||
m_windowId = ( id == -1 ) ? (int)NewControlId() : id;
|
||||
|
||||
// TODO create listbox
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxListBox::~wxListBox()
|
||||
{
|
||||
}
|
||||
|
||||
void wxListBox::SetupColours()
|
||||
{
|
||||
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
|
||||
}
|
||||
|
||||
void wxListBox::SetFirstItem(int N)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxListBox::SetFirstItem(const wxString& s)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxListBox::Delete(int N)
|
||||
{
|
||||
m_noItems --;
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxListBox::Append(const wxString& item)
|
||||
{
|
||||
m_noItems ++;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxListBox::Append(const wxString& item, char *Client_data)
|
||||
{
|
||||
m_noItems ++;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxListBox::Set(int n, const wxString *choices, char** clientData)
|
||||
{
|
||||
m_noItems = n;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
int wxListBox::FindString(const wxString& s) const
|
||||
{
|
||||
// TODO
|
||||
return -1;
|
||||
}
|
||||
|
||||
void wxListBox::Clear()
|
||||
{
|
||||
m_noItems = 0;
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxListBox::SetSelection(int N, bool select)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxListBox::Selected(int N) const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxListBox::Deselect(int N)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
char *wxListBox::GetClientData(int N) const
|
||||
{
|
||||
// TODO
|
||||
return (char *)NULL;
|
||||
}
|
||||
|
||||
void wxListBox::SetClientData(int N, char *Client_data)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Return number of selections and an array of selected integers
|
||||
int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
||||
{
|
||||
aSelections.Empty();
|
||||
|
||||
/* TODO
|
||||
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
|
||||
{
|
||||
int no_sel = ??
|
||||
for ( int n = 0; n < no_sel; n++ )
|
||||
aSelections.Add(??);
|
||||
|
||||
return no_sel;
|
||||
}
|
||||
else // single-selection listbox
|
||||
{
|
||||
aSelections.Add(??);
|
||||
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get single selection, for single choice list items
|
||||
int wxListBox::GetSelection() const
|
||||
{
|
||||
// TODO
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Find string for position
|
||||
wxString wxListBox::GetString(int N) const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
void wxListBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxListBox::InsertItems(int nItems, const wxString items[], int pos)
|
||||
{
|
||||
m_noItems += nItems;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxListBox::SetString(int N, const wxString& s)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
int wxListBox::Number () const
|
||||
{
|
||||
return m_noItems;
|
||||
}
|
||||
|
||||
// For single selection items only
|
||||
wxString wxListBox::GetStringSelection () const
|
||||
{
|
||||
int sel = GetSelection ();
|
||||
if (sel > -1)
|
||||
return this->GetString (sel);
|
||||
else
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
bool wxListBox::SetStringSelection (const wxString& s, bool flag)
|
||||
{
|
||||
int sel = FindString (s);
|
||||
if (sel > -1)
|
||||
{
|
||||
SetSelection (sel, flag);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxListBox::Command (wxCommandEvent & event)
|
||||
{
|
||||
if (event.m_extraLong)
|
||||
SetSelection (event.m_commandInt);
|
||||
else
|
||||
{
|
||||
Deselect (event.m_commandInt);
|
||||
return;
|
||||
}
|
||||
ProcessCommand (event);
|
||||
}
|
||||
|
||||
261
src/qt/mdi.cpp
261
src/qt/mdi.cpp
@@ -1,261 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: mdi.cpp
|
||||
// Purpose: MDI classes
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "mdi.h"
|
||||
#endif
|
||||
|
||||
#include "wx/mdi.h"
|
||||
|
||||
extern wxList wxModelessWindows;
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
|
||||
EVT_SIZE(wxMDIParentFrame::OnSize)
|
||||
EVT_ACTIVATE(wxMDIParentFrame::OnActivate)
|
||||
EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
|
||||
EVT_SCROLL(wxMDIClientWindow::OnScroll)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
// Parent frame
|
||||
|
||||
wxMDIParentFrame::wxMDIParentFrame()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
if (!parent)
|
||||
wxTopLevelWindows.Append(this);
|
||||
|
||||
SetName(name);
|
||||
m_windowStyle = style;
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
if ( id > -1 )
|
||||
m_windowId = id;
|
||||
else
|
||||
m_windowId = (int)NewControlId();
|
||||
|
||||
// TODO: create MDI parent frame
|
||||
|
||||
wxModelessWindows.Append(this);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxMDIParentFrame::~wxMDIParentFrame()
|
||||
{
|
||||
}
|
||||
|
||||
// Get size *available for subwindows* i.e. excluding menu bar.
|
||||
void wxMDIParentFrame::GetClientSize(int *x, int *y) const
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||
{
|
||||
// TODO
|
||||
if (!menu_bar)
|
||||
{
|
||||
m_frameMenuBar = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (menu_bar->m_menuBarFrame)
|
||||
return;
|
||||
|
||||
m_frameMenuBar = menu_bar;
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
#if wxUSE_CONSTRAINTS
|
||||
if (GetAutoLayout())
|
||||
Layout();
|
||||
#endif
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int width, height;
|
||||
GetClientSize(&width, &height);
|
||||
|
||||
if ( GetClientWindow() )
|
||||
GetClientWindow()->SetSize(x, y, width, height);
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
// Returns the active MDI child window
|
||||
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||
{
|
||||
// TODO
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create the client window class (don't Create the window,
|
||||
// just return a new class)
|
||||
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
||||
{
|
||||
return new wxMDIClientWindow ;
|
||||
}
|
||||
|
||||
// Responds to colour changes, and passes event on to children.
|
||||
void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
{
|
||||
// TODO
|
||||
|
||||
// Propagate the event to the non-top-level children
|
||||
wxFrame::OnSysColourChanged(event);
|
||||
}
|
||||
|
||||
// MDI operations
|
||||
void wxMDIParentFrame::Cascade()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::Tile()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ArrangeIcons()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ActivateNext()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ActivatePrevious()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Child frame
|
||||
|
||||
wxMDIChildFrame::wxMDIChildFrame()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
SetName(name);
|
||||
|
||||
if ( id > -1 )
|
||||
m_windowId = id;
|
||||
else
|
||||
m_windowId = (int)NewControlId();
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
// TODO: create child frame
|
||||
|
||||
wxModelessWindows.Append(this);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxMDIChildFrame::~wxMDIChildFrame()
|
||||
{
|
||||
}
|
||||
|
||||
// Set the client size (i.e. leave the calculation of borders etc.
|
||||
// to wxWindows)
|
||||
void wxMDIChildFrame::SetClientSize(int width, int height)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::GetPosition(int *x, int *y) const
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||
{
|
||||
// TODO
|
||||
if (!menu_bar)
|
||||
{
|
||||
m_frameMenuBar = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (menu_bar->m_menuBarFrame)
|
||||
return;
|
||||
m_frameMenuBar = menu_bar;
|
||||
}
|
||||
|
||||
// MDI operations
|
||||
void wxMDIChildFrame::Maximize()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::Restore()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::Activate()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Client window
|
||||
|
||||
wxMDIClientWindow::wxMDIClientWindow()
|
||||
{
|
||||
}
|
||||
|
||||
wxMDIClientWindow::~wxMDIClientWindow()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
|
||||
{
|
||||
// TODO create client window
|
||||
m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Explicitly call default scroll behaviour
|
||||
void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
|
||||
{
|
||||
Default(); // Default processing
|
||||
}
|
||||
|
||||
566
src/qt/menu.cpp
566
src/qt/menu.cpp
@@ -1,566 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: menu.cpp
|
||||
// Purpose: wxMenu, wxMenuBar, wxMenuItem
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// headers & declarations
|
||||
// ============================================================================
|
||||
|
||||
// wxWindows headers
|
||||
// -----------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "menu.h"
|
||||
#pragma implementation "menuitem.h"
|
||||
#endif
|
||||
|
||||
#include "wx/menu.h"
|
||||
#include "wx/menuitem.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
// other standard headers
|
||||
// ----------------------
|
||||
#include <string.h>
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// Menus
|
||||
|
||||
// Construct a menu with optional title (then use append)
|
||||
wxMenu::wxMenu(const wxString& title, const wxFunction func)
|
||||
{
|
||||
m_title = title;
|
||||
m_parent = NULL;
|
||||
m_eventHandler = this;
|
||||
m_noItems = 0;
|
||||
m_menuBar = NULL;
|
||||
if (m_title != "")
|
||||
{
|
||||
Append(-2, m_title) ;
|
||||
AppendSeparator() ;
|
||||
}
|
||||
|
||||
Callback(func);
|
||||
|
||||
// TODO create menu
|
||||
}
|
||||
|
||||
// The wxWindow destructor will take care of deleting the submenus.
|
||||
wxMenu::~wxMenu()
|
||||
{
|
||||
// TODO destroy menu and children
|
||||
|
||||
wxNode *node = m_menuItems.First();
|
||||
while (node)
|
||||
{
|
||||
wxMenuItem *item = (wxMenuItem *)node->Data();
|
||||
|
||||
// Delete child menus.
|
||||
// Beware: they must not be appended to children list!!!
|
||||
// (because order of delete is significant)
|
||||
if (item->GetSubMenu())
|
||||
item->DeleteSubMenu();
|
||||
|
||||
wxNode *next = node->Next();
|
||||
delete item;
|
||||
delete node;
|
||||
node = next;
|
||||
}
|
||||
}
|
||||
|
||||
void wxMenu::Break()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// function appends a new item or submenu to the menu
|
||||
void wxMenu::Append(wxMenuItem *pItem)
|
||||
{
|
||||
// TODO
|
||||
|
||||
wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" );
|
||||
|
||||
m_menuItems.Append(pItem);
|
||||
|
||||
m_noItems++;
|
||||
}
|
||||
|
||||
void wxMenu::AppendSeparator()
|
||||
{
|
||||
// TODO
|
||||
Append(new wxMenuItem(this, ID_SEPARATOR));
|
||||
}
|
||||
|
||||
// Pullright item
|
||||
void wxMenu::Append(int Id, const wxString& label, wxMenu *SubMenu,
|
||||
const wxString& helpString)
|
||||
{
|
||||
Append(new wxMenuItem(this, Id, label, helpString, FALSE, SubMenu));
|
||||
}
|
||||
|
||||
// Ordinary menu item
|
||||
void wxMenu::Append(int Id, const wxString& label,
|
||||
const wxString& helpString, bool checkable)
|
||||
{
|
||||
// 'checkable' parameter is useless for Windows.
|
||||
Append(new wxMenuItem(this, Id, label, helpString, checkable));
|
||||
}
|
||||
|
||||
void wxMenu::Delete(int id)
|
||||
{
|
||||
wxNode *node;
|
||||
wxMenuItem *item;
|
||||
int pos;
|
||||
|
||||
for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++) {
|
||||
item = (wxMenuItem *)node->Data();
|
||||
if (item->GetId() == id)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
m_menuItems.DeleteNode(node);
|
||||
delete item;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMenu::Enable(int Id, bool Flag)
|
||||
{
|
||||
wxMenuItem *item = FindItemForId(Id);
|
||||
wxCHECK_RET( item != NULL, "can't enable non-existing menu item" );
|
||||
|
||||
item->Enable(Flag);
|
||||
}
|
||||
|
||||
bool wxMenu::Enabled(int Id) const
|
||||
{
|
||||
wxMenuItem *item = FindItemForId(Id);
|
||||
wxCHECK( item != NULL, FALSE );
|
||||
|
||||
return item->IsEnabled();
|
||||
}
|
||||
|
||||
void wxMenu::Check(int Id, bool Flag)
|
||||
{
|
||||
wxMenuItem *item = FindItemForId(Id);
|
||||
wxCHECK_RET( item != NULL, "can't get status of non-existing menu item" );
|
||||
|
||||
item->Check(Flag);
|
||||
}
|
||||
|
||||
bool wxMenu::Checked(int Id) const
|
||||
{
|
||||
wxMenuItem *item = FindItemForId(Id);
|
||||
wxCHECK( item != NULL, FALSE );
|
||||
|
||||
return item->IsChecked();
|
||||
}
|
||||
|
||||
void wxMenu::SetTitle(const wxString& label)
|
||||
{
|
||||
m_title = label ;
|
||||
// TODO
|
||||
}
|
||||
|
||||
const wxString& wxMenu::GetTitle() const
|
||||
{
|
||||
return m_title;
|
||||
}
|
||||
|
||||
void wxMenu::SetLabel(int id, const wxString& label)
|
||||
{
|
||||
wxMenuItem *item = FindItemForId(id) ;
|
||||
if (item==NULL)
|
||||
return;
|
||||
|
||||
if (item->GetSubMenu()==NULL)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
item->SetName(label);
|
||||
}
|
||||
|
||||
wxString wxMenu::GetLabel(int Id) const
|
||||
{
|
||||
// TODO
|
||||
return wxString("") ;
|
||||
}
|
||||
|
||||
// Finds the item id matching the given string, -1 if not found.
|
||||
int wxMenu::FindItem (const wxString& itemString) const
|
||||
{
|
||||
char buf1[200];
|
||||
char buf2[200];
|
||||
wxStripMenuCodes ((char *)(const char *)itemString, buf1);
|
||||
|
||||
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
|
||||
{
|
||||
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
||||
if (item->GetSubMenu())
|
||||
{
|
||||
int ans = item->GetSubMenu()->FindItem(itemString);
|
||||
if (ans > -1)
|
||||
return ans;
|
||||
}
|
||||
if ( !item->IsSeparator() )
|
||||
{
|
||||
wxStripMenuCodes((char *)item->GetName().c_str(), buf2);
|
||||
if (strcmp(buf1, buf2) == 0)
|
||||
return item->GetId();
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
wxMenuItem *wxMenu::FindItemForId(int itemId, wxMenu ** itemMenu) const
|
||||
{
|
||||
if (itemMenu)
|
||||
*itemMenu = NULL;
|
||||
for (wxNode * node = m_menuItems.First (); node; node = node->Next ())
|
||||
{
|
||||
wxMenuItem *item = (wxMenuItem *) node->Data ();
|
||||
|
||||
if (item->GetId() == itemId)
|
||||
{
|
||||
if (itemMenu)
|
||||
*itemMenu = (wxMenu *) this;
|
||||
return item;
|
||||
}
|
||||
|
||||
if (item->GetSubMenu())
|
||||
{
|
||||
wxMenuItem *ans = item->GetSubMenu()->FindItemForId (itemId, itemMenu);
|
||||
if (ans)
|
||||
return ans;
|
||||
}
|
||||
}
|
||||
|
||||
if (itemMenu)
|
||||
*itemMenu = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxMenu::SetHelpString(int itemId, const wxString& helpString)
|
||||
{
|
||||
wxMenuItem *item = FindItemForId (itemId);
|
||||
if (item)
|
||||
item->SetHelp(helpString);
|
||||
}
|
||||
|
||||
wxString wxMenu::GetHelpString (int itemId) const
|
||||
{
|
||||
wxMenuItem *item = FindItemForId (itemId);
|
||||
wxString str("");
|
||||
return (item == NULL) ? str : item->GetHelp();
|
||||
}
|
||||
|
||||
void wxMenu::ProcessCommand(wxCommandEvent & event)
|
||||
{
|
||||
bool processed = FALSE;
|
||||
|
||||
// Try a callback
|
||||
if (m_callback)
|
||||
{
|
||||
(void) (*(m_callback)) (*this, event);
|
||||
processed = TRUE;
|
||||
}
|
||||
|
||||
// Try the menu's event handler
|
||||
if ( !processed && GetEventHandler())
|
||||
{
|
||||
processed = GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
// Try the window the menu was popped up from (and up
|
||||
// through the hierarchy)
|
||||
if ( !processed && GetInvokingWindow())
|
||||
processed = GetInvokingWindow()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Menu Bar
|
||||
wxMenuBar::wxMenuBar()
|
||||
{
|
||||
m_eventHandler = this;
|
||||
m_menuCount = 0;
|
||||
m_menus = NULL;
|
||||
m_titles = NULL;
|
||||
m_menuBarFrame = NULL;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar(int n, wxMenu *Mmnus[], const wxString titles[])
|
||||
{
|
||||
m_eventHandler = this;
|
||||
m_menuCount = n;
|
||||
m_menus = menus;
|
||||
m_titles = new wxString[n];
|
||||
int i;
|
||||
for ( i = 0; i < n; i++ )
|
||||
m_titles[i] = titles[i];
|
||||
m_menuBarFrame = NULL;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
wxMenuBar::~wxMenuBar()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_menuCount; i++)
|
||||
{
|
||||
delete m_menus[i];
|
||||
}
|
||||
delete[] m_menus;
|
||||
delete[] m_titles;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Must only be used AFTER menu has been attached to frame,
|
||||
// otherwise use individual menus to enable/disable items
|
||||
void wxMenuBar::Enable(int id, bool flag)
|
||||
{
|
||||
wxMenu *itemMenu = NULL;
|
||||
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMenuBar::EnableTop(int pos, bool flag)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Must only be used AFTER menu has been attached to frame,
|
||||
// otherwise use individual menus
|
||||
void wxMenuBar::Check(int id, bool flag)
|
||||
{
|
||||
wxMenu *itemMenu = NULL;
|
||||
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
if (!item->IsCheckable())
|
||||
return ;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxMenuBar::Checked(int id) const
|
||||
{
|
||||
wxMenu *itemMenu = NULL;
|
||||
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
||||
if (!item)
|
||||
return FALSE;
|
||||
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxMenuBar::Enabled(int id) const
|
||||
{
|
||||
wxMenu *itemMenu = NULL;
|
||||
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
||||
if (!item)
|
||||
return FALSE;
|
||||
|
||||
// TODO
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
void wxMenuBar::SetLabel(int id, const wxString& label)
|
||||
{
|
||||
wxMenu *itemMenu = NULL;
|
||||
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
||||
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
wxString wxMenuBar::GetLabel(int id) const
|
||||
{
|
||||
wxMenu *itemMenu = NULL;
|
||||
wxMenuItem *item = FindItemForId(id, &itemMenu) ;
|
||||
|
||||
if (!item)
|
||||
return wxString("");
|
||||
|
||||
// TODO
|
||||
return wxString("") ;
|
||||
}
|
||||
|
||||
void wxMenuBar::SetLabelTop(int pos, const wxString& label)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
wxString wxMenuBar::GetLabelTop(int pos) const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
bool wxMenuBar::OnDelete(wxMenu *a_menu, int pos)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxMenuBar::OnAppend(wxMenu *a_menu, const char *title)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxMenuBar::Append (wxMenu * menu, const wxString& title)
|
||||
{
|
||||
if (!OnAppend(menu, title))
|
||||
return;
|
||||
|
||||
m_menuCount ++;
|
||||
wxMenu **new_menus = new wxMenu *[m_menuCount];
|
||||
wxString *new_titles = new wxString[m_menuCount];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < m_menuCount - 1; i++)
|
||||
{
|
||||
new_menus[i] = m_menus[i];
|
||||
m_menus[i] = NULL;
|
||||
new_titles[i] = m_titles[i];
|
||||
m_titles[i] = "";
|
||||
}
|
||||
if (m_menus)
|
||||
{
|
||||
delete[]m_menus;
|
||||
delete[]m_titles;
|
||||
}
|
||||
m_menus = new_menus;
|
||||
m_titles = new_titles;
|
||||
|
||||
m_menus[m_menuCount - 1] = (wxMenu *)menu;
|
||||
m_titles[m_menuCount - 1] = title;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxMenuBar::Delete(wxMenu * menu, int i)
|
||||
{
|
||||
int j;
|
||||
int ii = (int) i;
|
||||
|
||||
if (menu != 0)
|
||||
{
|
||||
for (ii = 0; ii < m_menuCount; ii++)
|
||||
{
|
||||
if (m_menus[ii] == menu)
|
||||
break;
|
||||
}
|
||||
if (ii >= m_menuCount)
|
||||
return;
|
||||
} else
|
||||
{
|
||||
if (ii < 0 || ii >= m_menuCount)
|
||||
return;
|
||||
menu = m_menus[ii];
|
||||
}
|
||||
|
||||
if (!OnDelete(menu, ii))
|
||||
return;
|
||||
|
||||
menu->SetParent(NULL);
|
||||
|
||||
-- m_menuCount;
|
||||
for (j = ii; j < m_menuCount; j++)
|
||||
{
|
||||
m_menus[j] = m_menus[j + 1];
|
||||
m_titles[j] = m_titles[j + 1];
|
||||
}
|
||||
}
|
||||
|
||||
// Find the menu menuString, item itemString, and return the item id.
|
||||
// Returns -1 if none found.
|
||||
int wxMenuBar::FindMenuItem (const wxString& menuString, const wxString& itemString) const
|
||||
{
|
||||
char buf1[200];
|
||||
char buf2[200];
|
||||
wxStripMenuCodes ((char *)(const char *)menuString, buf1);
|
||||
int i;
|
||||
for (i = 0; i < m_menuCount; i++)
|
||||
{
|
||||
wxStripMenuCodes ((char *)(const char *)m_titles[i], buf2);
|
||||
if (strcmp (buf1, buf2) == 0)
|
||||
return m_menus[i]->FindItem (itemString);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
wxMenuItem *wxMenuBar::FindItemForId (int Id, wxMenu ** itemMenu) const
|
||||
{
|
||||
if (itemMenu)
|
||||
*itemMenu = NULL;
|
||||
|
||||
wxMenuItem *item = NULL;
|
||||
int i;
|
||||
for (i = 0; i < m_menuCount; i++)
|
||||
if ((item = m_menus[i]->FindItemForId (Id, itemMenu)))
|
||||
return item;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxMenuBar::SetHelpString (int Id, const wxString& helpString)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_menuCount; i++)
|
||||
{
|
||||
if (m_menus[i]->FindItemForId (Id))
|
||||
{
|
||||
m_menus[i]->SetHelpString (Id, helpString);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxString wxMenuBar::GetHelpString (int Id) const
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_menuCount; i++)
|
||||
{
|
||||
if (m_menus[i]->FindItemForId (Id))
|
||||
eturn wxString(m_menus[i]->GetHelpString (Id));
|
||||
}
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,369 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: notebook.cpp
|
||||
// Purpose: implementation of wxNotebook
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "notebook.h"
|
||||
#endif
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/imaglist.h>
|
||||
#include <wx/notebook.h>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// check that the page index is valid
|
||||
#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((nPage) < GetPageCount()))
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event table
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
|
||||
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
|
||||
|
||||
EVT_SIZE(wxNotebook::OnSize)
|
||||
EVT_SET_FOCUS(wxNotebook::OnSetFocus)
|
||||
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook construction
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// common part of all ctors
|
||||
void wxNotebook::Init()
|
||||
{
|
||||
m_pImageList = NULL;
|
||||
m_nSelection = -1;
|
||||
}
|
||||
|
||||
// default for dynamic class
|
||||
wxNotebook::wxNotebook()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
// the same arguments as for wxControl
|
||||
wxNotebook::wxNotebook(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
// Create() function
|
||||
bool wxNotebook::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
// base init
|
||||
SetName(name);
|
||||
SetParent(parent);
|
||||
|
||||
m_windowId = id == -1 ? NewControlId() : id;
|
||||
|
||||
// colors and font
|
||||
m_backgroundColour = wxColour(GetSysColor(COLOR_BTNFACE));
|
||||
m_foregroundColour = *wxBLACK ;
|
||||
|
||||
// style
|
||||
m_windowStyle = style;
|
||||
|
||||
if ( parent != NULL )
|
||||
parent->AddChild(this);
|
||||
|
||||
// TODO
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// dtor
|
||||
wxNotebook::~wxNotebook()
|
||||
{
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook accessors
|
||||
// ----------------------------------------------------------------------------
|
||||
int wxNotebook::GetPageCount() const
|
||||
{
|
||||
return m_aPages.Count();
|
||||
}
|
||||
|
||||
int wxNotebook::GetRowCount() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxNotebook::SetSelection(int nPage)
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
ChangePage(m_nSelection, nPage);
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wxNotebook::AdvanceSelection(bool bForward)
|
||||
{
|
||||
int nSel = GetSelection();
|
||||
int nMax = GetPageCount() - 1;
|
||||
if ( bForward )
|
||||
SetSelection(nSel == nMax ? 0 : nSel + 1);
|
||||
else
|
||||
SetSelection(nSel == 0 ? nMax : nSel - 1);
|
||||
}
|
||||
|
||||
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxString wxNotebook::GetPageText(int nPage) const
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
int wxNotebook::GetPageImage(int nPage) const
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wxNotebook::SetPageImage(int nPage, int nImage)
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxNotebook::SetImageList(wxImageList* imageList)
|
||||
{
|
||||
m_pImageList = imageList;
|
||||
// TODO
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// remove one page from the notebook
|
||||
bool wxNotebook::DeletePage(int nPage)
|
||||
{
|
||||
wxCHECK( IS_VALID_PAGE(nPage), FALSE );
|
||||
|
||||
// TODO: delete native widget page
|
||||
|
||||
delete m_aPages[nPage];
|
||||
m_aPages.Remove(nPage);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// remove all pages
|
||||
bool wxNotebook::DeleteAllPages()
|
||||
{
|
||||
// TODO: delete native widget pages
|
||||
|
||||
int nPageCount = GetPageCount();
|
||||
int nPage;
|
||||
for ( nPage = 0; nPage < nPageCount; nPage++ )
|
||||
delete m_aPages[nPage];
|
||||
|
||||
m_aPages.Clear();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// add a page to the notebook
|
||||
bool wxNotebook::AddPage(wxNotebookPage *pPage,
|
||||
const wxString& strText,
|
||||
bool bSelect,
|
||||
int imageId)
|
||||
{
|
||||
return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId);
|
||||
}
|
||||
|
||||
// same as AddPage() but does it at given position
|
||||
bool wxNotebook::InsertPage(int nPage,
|
||||
wxNotebookPage *pPage,
|
||||
const wxString& strText,
|
||||
bool bSelect,
|
||||
int imageId)
|
||||
{
|
||||
wxASSERT( pPage != NULL );
|
||||
wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
|
||||
|
||||
// TODO: insert native widget page
|
||||
|
||||
// save the pointer to the page
|
||||
m_aPages.Insert(pPage, nPage);
|
||||
|
||||
// some page must be selected: either this one or the first one if there is
|
||||
// still no selection
|
||||
if ( bSelect )
|
||||
m_nSelection = nPage;
|
||||
else if ( m_nSelection == -1 )
|
||||
m_nSelection = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook callbacks
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// @@@ OnSize() is used for setting the font when it's called for the first
|
||||
// time because doing it in ::Create() doesn't work (for unknown reasons)
|
||||
void wxNotebook::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
static bool s_bFirstTime = TRUE;
|
||||
if ( s_bFirstTime ) {
|
||||
// TODO: any first-time-size processing.
|
||||
s_bFirstTime = FALSE;
|
||||
}
|
||||
|
||||
// TODO: all this may or may not be necessary for your platform
|
||||
|
||||
// emulate page change (it's esp. important to do it first time because
|
||||
// otherwise our page would stay invisible)
|
||||
int nSel = m_nSelection;
|
||||
m_nSelection = -1;
|
||||
SetSelection(nSel);
|
||||
|
||||
// fit the notebook page to the tab control's display area
|
||||
int w, hl
|
||||
GetSize(&w, &h);
|
||||
|
||||
uint nCount = m_aPages.Count();
|
||||
for ( uint nPage = 0; nPage < nCount; nPage++ ) {
|
||||
wxNotebookPage *pPage = m_aPages[nPage];
|
||||
pPage->SetSize(0, 0, w, h);
|
||||
if ( pPage->GetAutoLayout() )
|
||||
pPage->Layout();
|
||||
}
|
||||
|
||||
// Processing continues to next OnSize
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxNotebook::OnSelChange(wxNotebookEvent& event)
|
||||
{
|
||||
// is it our tab control?
|
||||
if ( event.GetEventObject() == this )
|
||||
ChangePage(event.GetOldSelection(), event.GetSelection());
|
||||
|
||||
// we want to give others a chance to process this message as well
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxNotebook::OnSetFocus(wxFocusEvent& event)
|
||||
{
|
||||
// set focus to the currently selected page if any
|
||||
if ( m_nSelection != -1 )
|
||||
m_aPages[m_nSelection]->SetFocus();
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
|
||||
{
|
||||
if ( event.IsWindowChange() ) {
|
||||
// change pages
|
||||
AdvanceSelection(event.GetDirection());
|
||||
}
|
||||
else {
|
||||
// pass to the parent
|
||||
if ( GetParent() ) {
|
||||
event.SetCurrentFocus(this);
|
||||
GetParent()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook base class virtuals
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// override these 2 functions to do nothing: everything is done in OnSize
|
||||
|
||||
void wxNotebook::SetConstraintSizes(bool /* recurse */)
|
||||
{
|
||||
// don't set the sizes of the pages - their correct size is not yet known
|
||||
wxControl::SetConstraintSizes(FALSE);
|
||||
}
|
||||
|
||||
bool wxNotebook::DoPhase(int /* nPhase */)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxNotebook::Command(wxCommandEvent& event)
|
||||
{
|
||||
wxFAIL_MSG("wxNotebook::Command not implemented");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook helper functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// hide the currently active panel and show the new one
|
||||
void wxNotebook::ChangePage(int nOldSel, int nSel)
|
||||
{
|
||||
wxASSERT( nOldSel != nSel ); // impossible
|
||||
|
||||
if ( nOldSel != -1 ) {
|
||||
m_aPages[nOldSel]->Show(FALSE);
|
||||
}
|
||||
|
||||
wxNotebookPage *pPage = m_aPages[nSel];
|
||||
pPage->Show(TRUE);
|
||||
pPage->SetFocus();
|
||||
|
||||
m_nSelection = nSel;
|
||||
}
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: palette.cpp
|
||||
// Purpose: wxPalette
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "palette.h"
|
||||
#endif
|
||||
|
||||
#include "wx/palette.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
|
||||
|
||||
/*
|
||||
* Palette
|
||||
*
|
||||
*/
|
||||
|
||||
wxPaletteRefData::wxPaletteRefData()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
wxPaletteRefData::~wxPaletteRefData()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
wxPalette::wxPalette()
|
||||
{
|
||||
}
|
||||
|
||||
wxPalette::wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
|
||||
{
|
||||
Create(n, red, green, blue);
|
||||
}
|
||||
|
||||
wxPalette::~wxPalette()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxPalette::FreeResource(bool force)
|
||||
{
|
||||
if ( M_PALETTEDATA && M_PALETTEDATA->m_hPalette)
|
||||
{
|
||||
DeleteObject((HPALETTE)M_PALETTEDATA->m_hPalette);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
m_refData = new wxPaletteRefData;
|
||||
|
||||
// TODO
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
|
||||
{
|
||||
if ( !m_refData )
|
||||
return FALSE;
|
||||
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
|
||||
{
|
||||
if ( !m_refData )
|
||||
return FALSE;
|
||||
|
||||
if (index < 0 || index > 255)
|
||||
return FALSE;
|
||||
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
227
src/qt/pen.cpp
227
src/qt/pen.cpp
@@ -1,227 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: pen.cpp
|
||||
// Purpose: wxPen
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "pen.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/pen.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
|
||||
|
||||
wxPenRefData::wxPenRefData()
|
||||
{
|
||||
m_style = wxSOLID;
|
||||
m_width = 1;
|
||||
m_join = wxJOIN_ROUND ;
|
||||
m_cap = wxCAP_ROUND ;
|
||||
m_nbDash = 0 ;
|
||||
m_dash = (wxQTDash*)NULL;
|
||||
/* TODO: null data
|
||||
m_hPen = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
wxPenRefData::wxPenRefData(const wxPenRefData& data)
|
||||
{
|
||||
m_style = data.m_style;
|
||||
m_width = data.m_width;
|
||||
m_join = data.m_join;
|
||||
m_cap = data.m_cap;
|
||||
m_nbDash = data.m_nbDash;
|
||||
m_dash = data.m_dash;
|
||||
m_colour = data.m_colour;
|
||||
/* TODO: null data
|
||||
m_hPen = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
wxPenRefData::~wxPenRefData()
|
||||
{
|
||||
// TODO: delete data
|
||||
}
|
||||
|
||||
// Pens
|
||||
|
||||
wxPen::wxPen()
|
||||
{
|
||||
if ( wxThePenList )
|
||||
wxThePenList->AddPen(this);
|
||||
}
|
||||
|
||||
wxPen::~wxPen()
|
||||
{
|
||||
if (wxThePenList)
|
||||
wxThePenList->RemovePen(this);
|
||||
}
|
||||
|
||||
// Should implement Create
|
||||
wxPen::wxPen(const wxColour& col, int Width, int Style)
|
||||
{
|
||||
m_refData = new wxPenRefData;
|
||||
|
||||
M_PENDATA->m_colour = col;
|
||||
M_PENDATA->m_width = Width;
|
||||
M_PENDATA->m_style = Style;
|
||||
M_PENDATA->m_join = wxJOIN_ROUND ;
|
||||
M_PENDATA->m_cap = wxCAP_ROUND ;
|
||||
M_PENDATA->m_nbDash = 0 ;
|
||||
M_PENDATA->m_dash = (wxQTDash*)NULL;
|
||||
|
||||
RealizeResource();
|
||||
|
||||
if ( wxThePenList )
|
||||
wxThePenList->AddPen(this);
|
||||
}
|
||||
|
||||
wxPen::wxPen(const wxBitmap& stipple, int Width)
|
||||
{
|
||||
m_refData = new wxPenRefData;
|
||||
|
||||
M_PENDATA->m_stipple = stipple;
|
||||
M_PENDATA->m_width = Width;
|
||||
M_PENDATA->m_style = wxSTIPPLE;
|
||||
M_PENDATA->m_join = wxJOIN_ROUND ;
|
||||
M_PENDATA->m_cap = wxCAP_ROUND ;
|
||||
M_PENDATA->m_nbDash = 0 ;
|
||||
M_PENDATA->m_dash = (wxQTDash*)NULL;
|
||||
|
||||
RealizeResource();
|
||||
|
||||
if ( wxThePenList )
|
||||
wxThePenList->AddPen(this);
|
||||
}
|
||||
|
||||
wxPen::wxPen(const wxString& col, int Width, int Style)
|
||||
{
|
||||
m_refData = new wxPenRefData;
|
||||
|
||||
M_PENDATA->m_colour = col;
|
||||
M_PENDATA->m_width = Width;
|
||||
M_PENDATA->m_style = Style;
|
||||
M_PENDATA->m_join = wxJOIN_ROUND ;
|
||||
M_PENDATA->m_cap = wxCAP_ROUND ;
|
||||
M_PENDATA->m_nbDash = 0 ;
|
||||
M_PENDATA->m_dash = (wxQTDash*)NULL;
|
||||
|
||||
RealizeResource();
|
||||
|
||||
if ( wxThePenList )
|
||||
wxThePenList->AddPen(this);
|
||||
}
|
||||
|
||||
void wxPen::Unshare()
|
||||
{
|
||||
// Don't change shared data
|
||||
if (!m_refData)
|
||||
{
|
||||
m_refData = new wxPenRefData();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData);
|
||||
UnRef();
|
||||
m_refData = ref;
|
||||
}
|
||||
}
|
||||
|
||||
void wxPen::SetColour(const wxColour& col)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_PENDATA->m_colour = col;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxPen::SetColour(const wxString& col)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_PENDATA->m_colour = col;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxPen::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_PENDATA->m_colour.Set(r, g, b);
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxPen::SetWidth(int Width)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_PENDATA->m_width = Width;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxPen::SetStyle(int Style)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_PENDATA->m_style = Style;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxPen::SetStipple(const wxBitmap& Stipple)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_PENDATA->m_stipple = Stipple;
|
||||
M_PENDATA->m_style = wxSTIPPLE;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_PENDATA->m_nbDash = nb_dashes;
|
||||
M_PENDATA->m_dash = (wxQTDash *)Dash;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxPen::SetJoin(int Join)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_PENDATA->m_join = Join;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
void wxPen::SetCap(int Cap)
|
||||
{
|
||||
Unshare();
|
||||
|
||||
M_PENDATA->m_cap = Cap;
|
||||
|
||||
RealizeResource();
|
||||
}
|
||||
|
||||
bool wxPen::RealizeResource()
|
||||
{
|
||||
// TODO: create actual pen
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: radiobox.cpp
|
||||
// Purpose: wxRadioBox
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "radiobox.h"
|
||||
#endif
|
||||
|
||||
#include "wx/radiobox.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
|
||||
|
||||
// Radio box item
|
||||
wxRadioBox::wxRadioBox()
|
||||
{
|
||||
m_selectedButton = -1;
|
||||
m_noItems = 0;
|
||||
m_noRowsOrCols = 0;
|
||||
m_majorDim = 0 ;
|
||||
}
|
||||
|
||||
bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
int n, const wxString choices[],
|
||||
int majorDim, long style,
|
||||
const wxValidator& val, const wxString& name)
|
||||
{
|
||||
m_selectedButton = -1;
|
||||
m_noItems = n;
|
||||
|
||||
SetName(name);
|
||||
SetValidator(val);
|
||||
|
||||
parent->AddChild(this);
|
||||
|
||||
m_windowStyle = (long&)style;
|
||||
|
||||
if (id == -1)
|
||||
m_windowId = NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
m_noRowsOrCols = majorDim;
|
||||
|
||||
if (majorDim==0)
|
||||
m_majorDim = n ;
|
||||
else
|
||||
m_majorDim = majorDim ;
|
||||
|
||||
|
||||
// TODO create radiobox
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
wxRadioBox::~wxRadioBox()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
wxString wxRadioBox::GetLabel(int item) const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
void wxRadioBox::SetLabel(int item, const wxString& label)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
int wxRadioBox::FindString(const wxString& s) const
|
||||
{
|
||||
// TODO
|
||||
return -1;
|
||||
}
|
||||
|
||||
void wxRadioBox::SetSelection(int n)
|
||||
{
|
||||
if ((n < 0) || (n >= m_noItems))
|
||||
return;
|
||||
// TODO
|
||||
|
||||
m_selectedButton = n;
|
||||
}
|
||||
|
||||
// Get single selection, for single choice list items
|
||||
int wxRadioBox::GetSelection() const
|
||||
{
|
||||
return m_selectedButton;
|
||||
}
|
||||
|
||||
// Find string for position
|
||||
wxString wxRadioBox::GetString(int n) const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxRadioBox::GetSize(int *width, int *height) const
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxRadioBox::GetPosition(int *x, int *y) const
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
wxString wxRadioBox::GetLabel() const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
void wxRadioBox::SetLabel(const wxString& label)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxRadioBox::SetFocus()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxRadioBox::Show(bool show)
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Enable a specific button
|
||||
void wxRadioBox::Enable(int item, bool enable)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Enable all controls
|
||||
void wxRadioBox::Enable(bool enable)
|
||||
{
|
||||
wxControl::Enable(enable);
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Show a specific button
|
||||
void wxRadioBox::Show(int item, bool show)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// For single selection items only
|
||||
wxString wxRadioBox::GetStringSelection () const
|
||||
{
|
||||
int sel = GetSelection ();
|
||||
if (sel > -1)
|
||||
return this->GetString (sel);
|
||||
else
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
bool wxRadioBox::SetStringSelection (const wxString& s)
|
||||
{
|
||||
int sel = FindString (s);
|
||||
if (sel > -1)
|
||||
{
|
||||
SetSelection (sel);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxRadioBox::Command (wxCommandEvent & event)
|
||||
{
|
||||
SetSelection (event.m_commandInt);
|
||||
ProcessCommand (event);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: radiobut.cpp
|
||||
// Purpose: wxRadioButton
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "radiobut.h"
|
||||
#endif
|
||||
|
||||
#include "wx/radiobut.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
|
||||
|
||||
bool wxRadioButton::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
m_windowStyle = style ;
|
||||
|
||||
// TODO create radiobutton
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxRadioButton::SetLabel(const wxString& label)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxRadioButton::SetValue(bool value)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Get single selection, for single choice list items
|
||||
bool wxRadioButton::GetValue() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxRadioButton::Command (wxCommandEvent & event)
|
||||
{
|
||||
SetValue ( (event.m_commandInt != 0) );
|
||||
ProcessCommand (event);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,371 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// File: region.cpp
|
||||
// Purpose: Region class
|
||||
// Author: Markus Holzem/Julian Smart/AUTHOR
|
||||
// Created: Fri Oct 24 10:46:34 MET 1997
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1997 Markus Holzem/Julian Smart/AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "region.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/msw/region.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxRegionRefData implementation
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxRegionRefData : public wxGDIRefData {
|
||||
public:
|
||||
wxRegionRefData()
|
||||
{
|
||||
}
|
||||
|
||||
wxRegionRefData(const wxRegionRefData& data)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
~wxRegionRefData()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
HRGN m_region;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxRegion
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
* Create an empty region.
|
||||
*/
|
||||
wxRegion::wxRegion()
|
||||
{
|
||||
m_refData = new wxRegionRefData;
|
||||
// TODO create empty region
|
||||
}
|
||||
|
||||
wxRegion::wxRegion(long x, long y, long w, long h)
|
||||
{
|
||||
m_refData = new wxRegionRefData;
|
||||
// TODO create rect region
|
||||
}
|
||||
|
||||
wxRegion::wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight)
|
||||
{
|
||||
m_refData = new wxRegionRefData;
|
||||
// TODO create rect region
|
||||
}
|
||||
|
||||
wxRegion::wxRegion(const wxRect& rect)
|
||||
{
|
||||
m_refData = new wxRegionRefData;
|
||||
// TODO create rect region
|
||||
}
|
||||
|
||||
/*!
|
||||
* Destroy the region.
|
||||
*/
|
||||
wxRegion::~wxRegion()
|
||||
{
|
||||
// m_refData unrefed in ~wxObject
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//# Modify region
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//! Clear current region
|
||||
void wxRegion::Clear()
|
||||
{
|
||||
UnRef();
|
||||
}
|
||||
|
||||
//! Combine rectangle (x, y, w, h) with this.
|
||||
bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
|
||||
{
|
||||
// Don't change shared data
|
||||
if (!m_refData) {
|
||||
m_refData = new wxRegionRefData();
|
||||
} else if (m_refData->GetRefCount() > 1) {
|
||||
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
||||
UnRef();
|
||||
m_refData = new wxRegionRefData(*ref);
|
||||
}
|
||||
// If ref count is 1, that means it's 'ours' anyway so no action.
|
||||
|
||||
// TODO create rect region
|
||||
|
||||
int mode = 0; // TODO platform-specific code
|
||||
switch (op)
|
||||
{
|
||||
case wxRGN_AND:
|
||||
// TODO
|
||||
break ;
|
||||
case wxRGN_OR:
|
||||
// TODO
|
||||
break ;
|
||||
case wxRGN_XOR:
|
||||
// TODO
|
||||
break ;
|
||||
case wxRGN_DIFF:
|
||||
// TODO
|
||||
break ;
|
||||
case wxRGN_COPY:
|
||||
default:
|
||||
// TODO
|
||||
break ;
|
||||
}
|
||||
|
||||
// TODO do combine region
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//! Union /e region with this.
|
||||
bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
|
||||
{
|
||||
if (region.Empty())
|
||||
return FALSE;
|
||||
|
||||
// Don't change shared data
|
||||
if (!m_refData) {
|
||||
m_refData = new wxRegionRefData();
|
||||
} else if (m_refData->GetRefCount() > 1) {
|
||||
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
||||
UnRef();
|
||||
m_refData = new wxRegionRefData(*ref);
|
||||
}
|
||||
|
||||
int mode = 0; // TODO platform-specific code
|
||||
switch (op)
|
||||
{
|
||||
case wxRGN_AND:
|
||||
// TODO
|
||||
break ;
|
||||
case wxRGN_OR:
|
||||
// TODO
|
||||
break ;
|
||||
case wxRGN_XOR:
|
||||
// TODO
|
||||
break ;
|
||||
case wxRGN_DIFF:
|
||||
// TODO
|
||||
break ;
|
||||
case wxRGN_COPY:
|
||||
default:
|
||||
// TODO
|
||||
break ;
|
||||
}
|
||||
|
||||
// TODO combine region
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxRegion::Combine(const wxRect& rect, wxRegionOp op)
|
||||
{
|
||||
return Combine(rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight(), op);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//# Information on region
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Outer bounds of region
|
||||
void wxRegion::GetBox(long& x, long& y, long&w, long &h) const
|
||||
{
|
||||
if (m_refData) {
|
||||
// TODO get box
|
||||
} else {
|
||||
x = y = w = h = 0;
|
||||
}
|
||||
}
|
||||
|
||||
wxRect wxRegion::GetBox() const
|
||||
{
|
||||
long x, y, w, h;
|
||||
GetBox(x, y, w, h);
|
||||
return wxRect(x, y, w, h);
|
||||
}
|
||||
|
||||
// Is region empty?
|
||||
bool wxRegion::Empty() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//# Tests
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Does the region contain the point (x,y)?
|
||||
wxRegionContain wxRegion::Contains(long x, long y) const
|
||||
{
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
// TODO. Return wxInRegion if within region.
|
||||
if (0)
|
||||
return wxInRegion;
|
||||
return wxOutRegion;
|
||||
}
|
||||
|
||||
// Does the region contain the point pt?
|
||||
wxRegionContain wxRegion::Contains(const wxPoint& pt) const
|
||||
{
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
// TODO. Return wxInRegion if within region.
|
||||
if (0)
|
||||
return wxInRegion;
|
||||
else
|
||||
return wxOutRegion;
|
||||
}
|
||||
|
||||
// Does the region contain the rectangle (x, y, w, h)?
|
||||
wxRegionContain wxRegion::Contains(long x, long y, long w, long h) const
|
||||
{
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
// TODO. Return wxInRegion if within region.
|
||||
if (0)
|
||||
return wxInRegion;
|
||||
else
|
||||
return wxOutRegion;
|
||||
}
|
||||
|
||||
// Does the region contain the rectangle rect
|
||||
wxRegionContain wxRegion::Contains(const wxRect& rect) const
|
||||
{
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
long x, y, w, h;
|
||||
x = rect.x;
|
||||
y = rect.y;
|
||||
w = rect.GetWidth();
|
||||
h = rect.GetHeight();
|
||||
return Contains(x, y, w, h);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// wxRegionIterator //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*!
|
||||
* Initialize empty iterator
|
||||
*/
|
||||
wxRegionIterator::wxRegionIterator() : m_current(0), m_numRects(0), m_rects(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
wxRegionIterator::~wxRegionIterator()
|
||||
{
|
||||
if (m_rects)
|
||||
delete[] m_rects;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Initialize iterator for region
|
||||
*/
|
||||
wxRegionIterator::wxRegionIterator(const wxRegion& region)
|
||||
{
|
||||
m_rects = NULL;
|
||||
|
||||
Reset(region);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Reset iterator for a new /e region.
|
||||
*/
|
||||
void wxRegionIterator::Reset(const wxRegion& region)
|
||||
{
|
||||
m_current = 0;
|
||||
m_region = region;
|
||||
|
||||
if (m_rects)
|
||||
delete[] m_rects;
|
||||
|
||||
m_rects = NULL;
|
||||
|
||||
if (m_region.Empty())
|
||||
m_numRects = 0;
|
||||
else
|
||||
{
|
||||
// TODO create m_rects and fill with rectangles for this region
|
||||
m_numRects = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Increment iterator. The rectangle returned is the one after the
|
||||
* incrementation.
|
||||
*/
|
||||
void wxRegionIterator::operator ++ ()
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
++m_current;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Increment iterator. The rectangle returned is the one before the
|
||||
* incrementation.
|
||||
*/
|
||||
void wxRegionIterator::operator ++ (int)
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
++m_current;
|
||||
}
|
||||
|
||||
long wxRegionIterator::GetX() const
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].x;
|
||||
return 0;
|
||||
}
|
||||
|
||||
long wxRegionIterator::GetY() const
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].y;
|
||||
return 0;
|
||||
}
|
||||
|
||||
long wxRegionIterator::GetW() const
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].width ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
long wxRegionIterator::GetH() const
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].height;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: scrolbar.cpp
|
||||
// Purpose: wxScrollBar
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "scrolbar.h"
|
||||
#endif
|
||||
|
||||
#include "wx/scrolbar.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
|
||||
|
||||
|
||||
// Scrollbar
|
||||
bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
if (!parent)
|
||||
return FALSE;
|
||||
parent->AddChild(this);
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
// TODO create scrollbar
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxScrollBar::~wxScrollBar()
|
||||
{
|
||||
}
|
||||
|
||||
void wxScrollBar::SetPosition(int viewStart)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
int wxScrollBar::GetPosition() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize,
|
||||
bool refresh)
|
||||
{
|
||||
m_viewSize = pageSize;
|
||||
m_pageSize = thumbSize;
|
||||
m_objectSize = range;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
void wxScrollBar::Command(wxCommandEvent& event)
|
||||
{
|
||||
SetValue(event.m_commandInt);
|
||||
ProcessCommand(event);
|
||||
}
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: settings.cpp
|
||||
// Purpose: wxSettings
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "settings.h"
|
||||
#endif
|
||||
|
||||
#include "wx/settings.h"
|
||||
|
||||
wxColour wxSystemSettings::GetSystemColour(int index)
|
||||
{
|
||||
// TODO
|
||||
return col;
|
||||
}
|
||||
|
||||
wxFont wxSystemSettings::GetSystemFont(int index)
|
||||
{
|
||||
// TODO
|
||||
return wxFont;
|
||||
}
|
||||
|
||||
// Get a system metric, e.g. scrollbar size
|
||||
int wxSystemSettings::GetSystemMetric(int index)
|
||||
{
|
||||
switch ( index)
|
||||
{
|
||||
case wxSYS_MOUSE_BUTTONS:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_BORDER_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_BORDER_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_CURSOR_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_CURSOR_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_DCLICK_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_DCLICK_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_DRAG_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_DRAG_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_EDGE_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_EDGE_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_HSCROLL_ARROW_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_HSCROLL_ARROW_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_HTHUMB_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_ICON_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_ICON_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_ICONSPACING_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_ICONSPACING_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_WINDOWMIN_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_WINDOWMIN_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_SCREEN_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_SCREEN_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_FRAMESIZE_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_FRAMESIZE_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_SMALLICON_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_SMALLICON_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_HSCROLL_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_VSCROLL_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_VSCROLL_ARROW_X:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_VSCROLL_ARROW_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_VTHUMB_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_CAPTION_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_MENU_Y:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_NETWORK_PRESENT:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_PENWINDOWS_PRESENT:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_SHOW_SOUNDS:
|
||||
// TODO
|
||||
return 0;
|
||||
case wxSYS_SWAP_BUTTONS:
|
||||
// TODO
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: slider.cpp
|
||||
// Purpose: wxSlider
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "slider.h"
|
||||
#endif
|
||||
|
||||
#include "wx/msw/slider.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
|
||||
|
||||
// Slider
|
||||
wxSlider::wxSlider()
|
||||
{
|
||||
m_pageSize = 1;
|
||||
m_lineSize = 1;
|
||||
m_rangeMax = 0;
|
||||
m_rangeMin = 0;
|
||||
m_tickFreq = 0;
|
||||
}
|
||||
|
||||
bool wxSlider::Create(wxWindow *parent, wxWindowID id,
|
||||
int value, int minValue, int maxValue,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
m_lineSize = 1;
|
||||
m_windowStyle = style;
|
||||
m_tickFreq = 0;
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
m_rangeMax = maxValue;
|
||||
m_rangeMin = minValue;
|
||||
|
||||
m_pageSize = (int)((maxValue-minValue)/10);
|
||||
|
||||
// TODO create slider
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxSlider::~wxSlider()
|
||||
{
|
||||
}
|
||||
|
||||
int wxSlider::GetValue() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wxSlider::SetValue(int value)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxSlider::GetSize(int *width, int *height) const
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxSlider::GetPosition(int *x, int *y) const
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxSlider::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxSlider::SetRange(int minValue, int maxValue)
|
||||
{
|
||||
m_rangeMin = minValue;
|
||||
m_rangeMax = maxValue;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
// For trackbars only
|
||||
void wxSlider::SetTickFreq(int n, int pos)
|
||||
{
|
||||
// TODO
|
||||
m_tickFreq = n;
|
||||
}
|
||||
|
||||
void wxSlider::SetPageSize(int pageSize)
|
||||
{
|
||||
// TODO
|
||||
m_pageSize = pageSize;
|
||||
}
|
||||
|
||||
int wxSlider::GetPageSize() const
|
||||
{
|
||||
return m_pageSize;
|
||||
}
|
||||
|
||||
void wxSlider::ClearSel()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxSlider::ClearTicks()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxSlider::SetLineSize(int lineSize)
|
||||
{
|
||||
m_lineSize = lineSize;
|
||||
// TODO
|
||||
}
|
||||
|
||||
int wxSlider::GetLineSize() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxSlider::GetSelEnd() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wxSlider::GetSelStart() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wxSlider::SetSelection(int minPos, int maxPos)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxSlider::SetThumbLength(int len)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
int wxSlider::GetThumbLength() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wxSlider::SetTick(int tickPos)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxSlider::Command (wxCommandEvent & event)
|
||||
{
|
||||
SetValue (event.GetInt());
|
||||
ProcessCommand (event);
|
||||
}
|
||||
|
||||
bool wxSlider::Show(bool show)
|
||||
{
|
||||
// TODO
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: statbmp.cpp
|
||||
// Purpose: wxStaticBitmap
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "statbmp.h"
|
||||
#endif
|
||||
|
||||
#include "wx/statbmp.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
|
||||
|
||||
/*
|
||||
* wxStaticBitmap
|
||||
*/
|
||||
|
||||
bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxBitmap& bitmap,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
m_messageBitmap = bitmap;
|
||||
SetName(name);
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
// TODO: create static bitmap control
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxStaticBitmap::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
|
||||
{
|
||||
m_messageBitmap = bitmap;
|
||||
|
||||
// TODO: redraw bitmap
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: statbox.cpp
|
||||
// Purpose: wxStaticBox
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "statbox.h"
|
||||
#endif
|
||||
|
||||
#include "wx/statbox.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
|
||||
EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
/*
|
||||
* Static box
|
||||
*/
|
||||
|
||||
bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
SetName(name);
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
// TODO: create static box
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxStaticBox::SetLabel(const wxString& label)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxStaticBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
@@ -1,209 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: stattext.cpp
|
||||
// Purpose: wxStaticText
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "stattext.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/app.h"
|
||||
#endif
|
||||
|
||||
#include "wx/stattext.h"
|
||||
#include "wx/msw/private.h"
|
||||
#include <stdio.h>
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
|
||||
|
||||
bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
SetName(name);
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetDefaultForegroundColour()) ;
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
int x = pos.x;
|
||||
int y = pos.y;
|
||||
int width = size.x;
|
||||
int height = size.y;
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
long msStyle = WS_CHILD|WS_VISIBLE;
|
||||
if (m_windowStyle & wxALIGN_CENTRE)
|
||||
msStyle |= SS_CENTER;
|
||||
else if (m_windowStyle & wxALIGN_RIGHT)
|
||||
msStyle |= SS_RIGHT;
|
||||
else
|
||||
msStyle |= SS_LEFT;
|
||||
|
||||
// Even with extended styles, need to combine with WS_BORDER
|
||||
// for them to look right.
|
||||
if ((m_windowStyle & wxSIMPLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) ||
|
||||
(m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER))
|
||||
msStyle |= WS_BORDER;
|
||||
|
||||
HWND static_item = CreateWindowEx(MakeExtendedStyle(m_windowStyle), "STATIC", (const char *)label,
|
||||
msStyle,
|
||||
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
||||
wxGetInstance(), NULL);
|
||||
|
||||
#if CTL3D
|
||||
/*
|
||||
if (!(GetParent()->GetWindowStyleFlag() & wxUSER_COLOURS))
|
||||
Ctl3dSubclassCtl(static_item);
|
||||
*/
|
||||
#endif
|
||||
|
||||
m_hWnd = (WXHWND)static_item;
|
||||
|
||||
SubclassWin((WXHWND)static_item);
|
||||
|
||||
SetFont(* parent->GetFont());
|
||||
SetSize(x, y, width, height);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
int currentX, currentY;
|
||||
GetPosition(¤tX, ¤tY);
|
||||
int x1 = x;
|
||||
int y1 = y;
|
||||
|
||||
if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
x1 = currentX;
|
||||
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||
y1 = currentY;
|
||||
|
||||
AdjustForParentClientOrigin(x1, y1, sizeFlags);
|
||||
|
||||
int actualWidth = width;
|
||||
int actualHeight = height;
|
||||
|
||||
char buf[300];
|
||||
int current_width;
|
||||
int cyf;
|
||||
|
||||
::GetWindowText((HWND) GetHWND(), buf, 300);
|
||||
GetTextExtent(buf, ¤t_width, &cyf, NULL, NULL,GetFont());
|
||||
|
||||
int ww, hh;
|
||||
GetSize(&ww, &hh);
|
||||
|
||||
// If we're prepared to use the existing width, then...
|
||||
if (width == -1 && ((sizeFlags & wxSIZE_AUTO_WIDTH) != wxSIZE_AUTO_WIDTH))
|
||||
actualWidth = ww;
|
||||
else if (width == -1)
|
||||
{
|
||||
int cx;
|
||||
int cy;
|
||||
wxGetCharSize(GetHWND(), &cx, &cy,GetFont());
|
||||
actualWidth = (int)(current_width + cx) ;
|
||||
}
|
||||
|
||||
// If we're prepared to use the existing height, then...
|
||||
if (height == -1 && ((sizeFlags & wxSIZE_AUTO_HEIGHT) != wxSIZE_AUTO_HEIGHT))
|
||||
actualHeight = hh;
|
||||
else if (height == -1)
|
||||
{
|
||||
actualHeight = (int)(cyf) ;
|
||||
}
|
||||
|
||||
MoveWindow((HWND) GetHWND(), x1, y1, actualWidth, actualHeight, TRUE);
|
||||
}
|
||||
|
||||
void wxStaticText::SetLabel(const wxString& label)
|
||||
{
|
||||
int w, h;
|
||||
RECT rect;
|
||||
|
||||
wxWindow *parent = GetParent();
|
||||
GetWindowRect((HWND) GetHWND(), &rect);
|
||||
|
||||
// Since we now have the absolute screen coords,
|
||||
// if there's a parent we must subtract its top left corner
|
||||
POINT point;
|
||||
point.x = rect.left;
|
||||
point.y = rect.top;
|
||||
if (parent)
|
||||
{
|
||||
::ScreenToClient((HWND) parent->GetHWND(), &point);
|
||||
}
|
||||
|
||||
GetTextExtent(label, &w, &h, NULL, NULL, GetFont());
|
||||
MoveWindow((HWND) GetHWND(), point.x, point.y, (int)(w + 10), (int)h,
|
||||
TRUE);
|
||||
SetWindowText((HWND) GetHWND(), (const char *)label);
|
||||
}
|
||||
|
||||
WXHBRUSH wxStaticText::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
/*
|
||||
#if CTL3D
|
||||
if ( m_useCtl3D )
|
||||
{
|
||||
HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
|
||||
|
||||
if (hbrush != (HBRUSH) 0)
|
||||
return hbrush;
|
||||
else
|
||||
return (HBRUSH)MSWDefWindowProc(message, wParam, lParam);
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
if (GetParent()->GetTransparentBackground())
|
||||
SetBkMode((HDC) pDC, TRANSPARENT);
|
||||
else
|
||||
SetBkMode((HDC) pDC, OPAQUE);
|
||||
|
||||
::SetBkColor((HDC) pDC, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
|
||||
::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
|
||||
|
||||
wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID);
|
||||
|
||||
// Note that this will be cleaned up in wxApp::OnIdle, if backgroundBrush
|
||||
// has a zero usage count.
|
||||
// backgroundBrush->RealizeResource();
|
||||
return (WXHBRUSH) backgroundBrush->GetResourceHandle();
|
||||
}
|
||||
|
||||
long wxStaticText::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
// Ensure that static items get messages. Some controls don't like this
|
||||
// message to be intercepted (e.g. RichEdit), hence the tests.
|
||||
if (nMsg == WM_NCHITTEST)
|
||||
return (long)HTCLIENT;
|
||||
|
||||
return wxWindow::MSWWindowProc(nMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,193 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tbargtk.cpp
|
||||
// Purpose: GTK toolbar
|
||||
// Author: Robert Roebling
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID:
|
||||
// Copyright: (c) Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "tbargtk.h"
|
||||
#endif
|
||||
|
||||
#include "wx/toolbar.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToolBarTool
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject)
|
||||
|
||||
wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
|
||||
const wxBitmap& bitmap1, const wxBitmap& bitmap2,
|
||||
bool toggle, wxObject *clientData,
|
||||
const wxString& shortHelpString, const wxString& longHelpString )
|
||||
{
|
||||
m_owner = owner;
|
||||
m_index = theIndex;
|
||||
m_bitmap1 = bitmap1;
|
||||
m_bitmap2 = bitmap2;
|
||||
m_isToggle = toggle;
|
||||
m_enabled = TRUE;
|
||||
m_toggleState = FALSE;
|
||||
m_shortHelpString = shortHelpString;
|
||||
m_longHelpString = longHelpString;
|
||||
m_isMenuCommand = TRUE;
|
||||
m_clientData = clientData;
|
||||
m_deleteSecondBitmap = FALSE;
|
||||
};
|
||||
|
||||
wxToolBarTool::~wxToolBarTool(void)
|
||||
{
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToolBar
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBar,wxControl)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxToolBar, wxControl)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxToolBar::wxToolBar(void)
|
||||
{
|
||||
};
|
||||
|
||||
wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxString& name )
|
||||
{
|
||||
Create( parent, id, pos, size, style, name );
|
||||
};
|
||||
|
||||
wxToolBar::~wxToolBar(void)
|
||||
{
|
||||
};
|
||||
|
||||
bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxString& name )
|
||||
{
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
|
||||
{
|
||||
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, toolIndex );
|
||||
event.SetEventObject(this);
|
||||
event.SetInt( toolIndex );
|
||||
event.SetExtraLong((long) toggleDown);
|
||||
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) )
|
||||
{
|
||||
wxCommandEvent event( wxEVT_COMMAND_TOOL_RCLICKED, toolIndex );
|
||||
event.SetEventObject( this );
|
||||
event.SetInt( toolIndex );
|
||||
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
void wxToolBar::OnMouseEnter( int toolIndex )
|
||||
{
|
||||
wxCommandEvent event( wxEVT_COMMAND_TOOL_ENTER, toolIndex );
|
||||
event.SetEventObject(this);
|
||||
event.SetInt( toolIndex );
|
||||
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
};
|
||||
|
||||
wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
|
||||
const wxBitmap& pushedBitmap, bool toggle,
|
||||
float WXUNUSED(xPos), float WXUNUSED(yPos), wxObject *clientData,
|
||||
const wxString& helpString1, const wxString& helpString2 )
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBar::AddSeparator(void)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBar::ClearTools(void)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBar::Realize(void)
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBar::EnableTool(int toolIndex, bool enable)
|
||||
{
|
||||
wxNode *node = m_tools.First();
|
||||
while (node)
|
||||
{
|
||||
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||
if (tool->m_index == toolIndex)
|
||||
{
|
||||
tool->m_enabled = enable;
|
||||
return;
|
||||
}
|
||||
node = node->Next();
|
||||
};
|
||||
};
|
||||
|
||||
void wxToolBar::ToggleTool(int WXUNUSED(toolIndex), bool WXUNUSED(toggle) )
|
||||
{
|
||||
};
|
||||
|
||||
wxObject *wxToolBar::GetToolClientData(int index) const
|
||||
{
|
||||
wxNode *node = m_tools.First();
|
||||
while (node)
|
||||
{
|
||||
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||
if (tool->m_index == index) return tool->m_clientData;;
|
||||
node = node->Next();
|
||||
};
|
||||
return (wxObject*)NULL;
|
||||
};
|
||||
|
||||
bool wxToolBar::GetToolState(int toolIndex) const
|
||||
{
|
||||
wxNode *node = m_tools.First();
|
||||
while (node)
|
||||
{
|
||||
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||
if (tool->m_index == toolIndex) return tool->m_toggleState;
|
||||
node = node->Next();
|
||||
};
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
bool wxToolBar::GetToolEnabled(int toolIndex) const
|
||||
{
|
||||
wxNode *node = m_tools.First();
|
||||
while (node)
|
||||
{
|
||||
wxToolBarTool *tool = (wxToolBarTool*)node->Data();
|
||||
if (tool->m_index == toolIndex) return tool->m_enabled;
|
||||
node = node->Next();
|
||||
};
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
void wxToolBar::SetMargins( int WXUNUSED(x), int WXUNUSED(y) )
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBar::SetToolPacking( int WXUNUSED(packing) )
|
||||
{
|
||||
};
|
||||
|
||||
void wxToolBar::SetToolSeparation( int separation )
|
||||
{
|
||||
};
|
||||
|
||||
@@ -1,442 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: textctrl.cpp
|
||||
// Purpose: wxTextCtrl
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "textctrl.h"
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fstream.h>
|
||||
|
||||
#include "wx/textctrl.h"
|
||||
#include "wx/settings.h"
|
||||
|
||||
#if defined(__BORLANDC__) && !defined(__WIN32__)
|
||||
#include <alloc.h>
|
||||
#else
|
||||
#ifndef __GNUWIN32__
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
|
||||
EVT_CHAR(wxTextCtrl::OnChar)
|
||||
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
|
||||
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// Text item
|
||||
wxTextCtrl::wxTextCtrl()
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
:streambuf()
|
||||
#endif
|
||||
{
|
||||
m_fileName = "";
|
||||
}
|
||||
|
||||
bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxString& value,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
m_fileName = "";
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxString wxTextCtrl::GetValue() const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetValue(const wxString& value)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Clipboard operations
|
||||
void wxTextCtrl::Copy()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxTextCtrl::Cut()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxTextCtrl::Paste()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetEditable(bool editable)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetInsertionPoint(long pos)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetInsertionPointEnd()
|
||||
{
|
||||
long pos = GetLastPosition();
|
||||
SetInsertionPoint(pos);
|
||||
}
|
||||
|
||||
long wxTextCtrl::GetInsertionPoint() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
long wxTextCtrl::GetLastPosition() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wxTextCtrl::Replace(long from, long to, const wxString& value)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wxTextCtrl::Remove(long from, long to)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetSelection(long from, long to)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxTextCtrl::LoadFile(const wxString& file)
|
||||
{
|
||||
if (!wxFileExists(file))
|
||||
return FALSE;
|
||||
|
||||
m_fileName = file;
|
||||
|
||||
Clear();
|
||||
|
||||
ifstream input((char*) (const char*) file, ios::nocreate | ios::in);
|
||||
|
||||
if (!input.bad())
|
||||
{
|
||||
struct stat stat_buf;
|
||||
if (stat(file, &stat_buf) < 0)
|
||||
return FALSE;
|
||||
// This may need to be a bigger buffer than the file size suggests,
|
||||
// if it's a UNIX file. Give it an extra 1000 just in case.
|
||||
char *tmp_buffer = (char*)malloc((size_t)(stat_buf.st_size+1+1000));
|
||||
long no_lines = 0;
|
||||
long pos = 0;
|
||||
while (!input.eof() && input.peek() != EOF)
|
||||
{
|
||||
input.getline(wxBuffer, 500);
|
||||
int len = strlen(wxBuffer);
|
||||
wxBuffer[len] = 13;
|
||||
wxBuffer[len+1] = 10;
|
||||
wxBuffer[len+2] = 0;
|
||||
strcpy(tmp_buffer+pos, wxBuffer);
|
||||
pos += strlen(wxBuffer);
|
||||
no_lines++;
|
||||
}
|
||||
|
||||
// TODO add line
|
||||
|
||||
free(tmp_buffer);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// If file is null, try saved file name first
|
||||
// Returns TRUE if succeeds.
|
||||
bool wxTextCtrl::SaveFile(const wxString& file)
|
||||
{
|
||||
wxString theFile(file);
|
||||
if (theFile == "")
|
||||
theFile = m_fileName;
|
||||
if (theFile == "")
|
||||
return FALSE;
|
||||
m_fileName = theFile;
|
||||
|
||||
ofstream output((char*) (const char*) theFile);
|
||||
if (output.bad())
|
||||
return FALSE;
|
||||
|
||||
// TODO get and save text
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxTextCtrl::WriteText(const wxString& text)
|
||||
{
|
||||
// TODO write text to control
|
||||
}
|
||||
|
||||
void wxTextCtrl::AppendText(const wxString& text)
|
||||
{
|
||||
// TODO append text to control
|
||||
}
|
||||
|
||||
void wxTextCtrl::Clear()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxTextCtrl::IsModified() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Makes 'unmodified'
|
||||
void wxTextCtrl::DiscardEdits()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
int wxTextCtrl::GetNumberOfLines() const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
long wxTextCtrl::XYToPosition(long x, long y) const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxTextCtrl::ShowPosition(long pos)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
int wxTextCtrl::GetLineLength(long lineNo) const
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
wxString wxTextCtrl::GetLineText(long lineNo) const
|
||||
{
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
/*
|
||||
* Text item
|
||||
*/
|
||||
|
||||
void wxTextCtrl::Command(wxCommandEvent & event)
|
||||
{
|
||||
SetValue (event.GetString());
|
||||
ProcessCommand (event);
|
||||
}
|
||||
|
||||
void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
|
||||
{
|
||||
// By default, load the first file into the text window.
|
||||
if (event.GetNumberOfFiles() > 0)
|
||||
{
|
||||
LoadFile(event.GetFiles()[0]);
|
||||
}
|
||||
}
|
||||
|
||||
// The streambuf code was partly taken from chapter 3 by Jerry Schwarz of
|
||||
// AT&T's "C++ Lanuage System Release 3.0 Library Manual" - Stein Somers
|
||||
|
||||
//=========================================================================
|
||||
// Called then the buffer is full (gcc 2.6.3)
|
||||
// or when "endl" is output (Borland 4.5)
|
||||
//=========================================================================
|
||||
// Class declaration using multiple inheritance doesn't work properly for
|
||||
// Borland. See note in wb_text.h.
|
||||
#ifndef NO_TEXT_WINDOW_STREAM
|
||||
int wxTextCtrl::overflow(int c)
|
||||
{
|
||||
// Make sure there is a holding area
|
||||
if ( allocate()==EOF )
|
||||
{
|
||||
wxError("Streambuf allocation failed","Internal error");
|
||||
return EOF;
|
||||
}
|
||||
|
||||
// Verify that there are no characters in get area
|
||||
if ( gptr() && gptr() < egptr() )
|
||||
{
|
||||
wxError("Who's trespassing my get area?","Internal error");
|
||||
return EOF;
|
||||
}
|
||||
|
||||
// Reset get area
|
||||
setg(0,0,0);
|
||||
|
||||
// Make sure there is a put area
|
||||
if ( ! pptr() )
|
||||
{
|
||||
/* This doesn't seem to be fatal so comment out error message */
|
||||
// wxError("Put area not opened","Internal error");
|
||||
setp( base(), base() );
|
||||
}
|
||||
|
||||
// Determine how many characters have been inserted but no consumed
|
||||
int plen = pptr() - pbase();
|
||||
|
||||
// Now Jerry relies on the fact that the buffer is at least 2 chars
|
||||
// long, but the holding area "may be as small as 1" ???
|
||||
// And we need an additional \0, so let's keep this inefficient but
|
||||
// safe copy.
|
||||
|
||||
// If c!=EOF, it is a character that must also be comsumed
|
||||
int xtra = c==EOF? 0 : 1;
|
||||
|
||||
// Write temporary C-string to wxTextWindow
|
||||
{
|
||||
char *txt = new char[plen+xtra+1];
|
||||
memcpy(txt, pbase(), plen);
|
||||
txt[plen] = (char)c; // append c
|
||||
txt[plen+xtra] = '\0'; // append '\0' or overwrite c
|
||||
// If the put area already contained \0, output will be truncated there
|
||||
AppendText(txt);
|
||||
delete[] txt;
|
||||
}
|
||||
|
||||
// Reset put area
|
||||
setp(pbase(), epptr());
|
||||
|
||||
#if defined(__WATCOMC__)
|
||||
return __NOT_EOF;
|
||||
#elif defined(zapeof) // HP-UX (all cfront based?)
|
||||
return zapeof(c);
|
||||
#else
|
||||
return c!=EOF ? c : 0; // this should make everybody happy
|
||||
#endif
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// called then "endl" is output (gcc) or then explicit sync is done (Borland)
|
||||
//=========================================================================
|
||||
int wxTextCtrl::sync()
|
||||
{
|
||||
// Verify that there are no characters in get area
|
||||
if ( gptr() && gptr() < egptr() )
|
||||
{
|
||||
wxError("Who's trespassing my get area?","Internal error");
|
||||
return EOF;
|
||||
}
|
||||
|
||||
if ( pptr() && pptr() > pbase() ) return overflow(EOF);
|
||||
|
||||
return 0;
|
||||
/* OLD CODE
|
||||
int len = pptr() - pbase();
|
||||
char *txt = new char[len+1];
|
||||
strncpy(txt, pbase(), len);
|
||||
txt[len] = '\0';
|
||||
(*this) << txt;
|
||||
setp(pbase(), epptr());
|
||||
delete[] txt;
|
||||
return 0;
|
||||
*/
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
// Should not be called by a "ostream". Used by a "istream"
|
||||
//=========================================================================
|
||||
int wxTextCtrl::underflow()
|
||||
{
|
||||
return EOF;
|
||||
}
|
||||
#endif
|
||||
|
||||
wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
|
||||
{
|
||||
AppendText(s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxTextCtrl& wxTextCtrl::operator<<(float f)
|
||||
{
|
||||
wxString str;
|
||||
str.Printf("%.2f", f);
|
||||
AppendText(str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxTextCtrl& wxTextCtrl::operator<<(double d)
|
||||
{
|
||||
wxString str;
|
||||
str.Printf("%.2f", d);
|
||||
AppendText(str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxTextCtrl& wxTextCtrl::operator<<(int i)
|
||||
{
|
||||
wxString str;
|
||||
str.Printf("%d", i);
|
||||
AppendText(str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxTextCtrl& wxTextCtrl::operator<<(long i)
|
||||
{
|
||||
wxString str;
|
||||
str.Printf("%ld", i);
|
||||
AppendText(str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxTextCtrl& wxTextCtrl::operator<<(const char c)
|
||||
{
|
||||
char buf[2];
|
||||
|
||||
buf[0] = c;
|
||||
buf[1] = 0;
|
||||
AppendText(buf);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: threadgui.inc
|
||||
// Purpose: GUI thread manager for GTK
|
||||
// Author: Original from Wolfram Gloger/Guilhem Lavaux
|
||||
// Modified by:
|
||||
// Created: 04/22/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// for select()
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef __sgi
|
||||
#include <bstring.h>
|
||||
#endif
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Static variables
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int p_thrd_pipe[2] = { -1, -1 };
|
||||
// WorkProc in GTK
|
||||
static gint p_thrd_inid;
|
||||
|
||||
#define THREAD_SEND_EXIT_MSG(ptr) write(p_thrd_pipe[1], &ptr, sizeof(ptr));
|
||||
|
||||
static void
|
||||
ThreadExitProc(gpointer WXUNUSED(client), gint fid,
|
||||
GdkInputCondition WXUNUSED(cond))
|
||||
{
|
||||
wxThread* ptr;
|
||||
|
||||
if (fid != p_thrd_pipe[0])
|
||||
return;
|
||||
if (read(fid, &ptr, sizeof(ptr)) == sizeof(ptr)) {
|
||||
//fprintf(stderr, "calling OnExit %p\n", ptr);
|
||||
ptr->OnExit();
|
||||
} else {
|
||||
//fprintf(stderr, "this should never happen\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Global initialization
|
||||
static void wxThreadGuiInit()
|
||||
{
|
||||
pipe(p_thrd_pipe);
|
||||
p_thrd_inid = gdk_input_add(p_thrd_pipe[0], GDK_INPUT_READ,
|
||||
ThreadExitProc, 0);
|
||||
}
|
||||
|
||||
// Global cleanup
|
||||
static void wxThreadGuiExit()
|
||||
{
|
||||
gdk_input_remove(p_thrd_inid);
|
||||
close(p_thrd_pipe[0]);
|
||||
close(p_thrd_pipe[1]);
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: thread.cpp
|
||||
// Purpose: No thread support
|
||||
// Author: Original from Wolfram Gloger/Guilhem Lavaux
|
||||
// Modified by:
|
||||
// Created: 04/22/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "thread.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wx.h"
|
||||
#include "wx/module.h"
|
||||
#include "wx/thread.h"
|
||||
|
||||
wxMutex::wxMutex()
|
||||
{
|
||||
m_locked = 0;
|
||||
}
|
||||
|
||||
wxMutex::~wxMutex()
|
||||
{
|
||||
if (m_locked)
|
||||
wxDebugMsg("wxMutex warning: destroying a locked mutex (%d locks)\n", m_locked);
|
||||
}
|
||||
|
||||
wxMutexError wxMutex::Lock()
|
||||
{
|
||||
m_locked++;
|
||||
return MUTEX_NO_ERROR;
|
||||
}
|
||||
|
||||
wxMutexError wxMutex::TryLock()
|
||||
{
|
||||
if (m_locked > 0)
|
||||
return MUTEX_BUSY;
|
||||
m_locked++;
|
||||
return MUTEX_NO_ERROR;
|
||||
}
|
||||
|
||||
wxMutexError wxMutex::Unlock()
|
||||
{
|
||||
if (m_locked == 0)
|
||||
return MUTEX_UNLOCKED;
|
||||
m_locked--;
|
||||
return MUTEX_NO_ERROR;
|
||||
}
|
||||
|
||||
wxCondition::wxCondition()
|
||||
{
|
||||
}
|
||||
|
||||
wxCondition::~wxCondition()
|
||||
{
|
||||
}
|
||||
|
||||
void wxCondition::Wait(wxMutex& WXUNUSED(mutex))
|
||||
{
|
||||
}
|
||||
|
||||
bool wxCondition::Wait(wxMutex& WXUNUSED(mutex), unsigned long WXUNUSED(sec),
|
||||
unsigned long WXUNUSED(nsec))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxCondition::Signal()
|
||||
{
|
||||
}
|
||||
|
||||
void wxCondition::Broadcast()
|
||||
{
|
||||
}
|
||||
|
||||
struct wxThreadInternal {
|
||||
int thread_id;
|
||||
void* exit_status;
|
||||
};
|
||||
|
||||
wxThreadError wxThread::Create()
|
||||
{
|
||||
p_internal->exit_status = Entry();
|
||||
OnExit();
|
||||
return THREAD_NO_ERROR;
|
||||
}
|
||||
|
||||
wxThreadError wxThread::Destroy()
|
||||
{
|
||||
return THREAD_NOT_RUNNING;
|
||||
}
|
||||
|
||||
wxThreadError wxThread::Pause()
|
||||
{
|
||||
return THREAD_NOT_RUNNING;
|
||||
}
|
||||
|
||||
wxThreadError wxThread::Resume()
|
||||
{
|
||||
return THREAD_NOT_RUNNING;
|
||||
}
|
||||
|
||||
void wxThread::DeferDestroy( bool WXUNUSED(on) )
|
||||
{
|
||||
}
|
||||
|
||||
void wxThread::TestDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
void *wxThread::Join()
|
||||
{
|
||||
return p_internal->exit_status;
|
||||
}
|
||||
|
||||
unsigned long wxThread::GetID() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
wxThread *wxThread::GetThreadFromID(unsigned long WXUNUSED(id)) const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool wxThread::IsMain()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxThread::IsRunning() const
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxThread::IsAlive() const
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxThread::SetPriority(int WXUNUSED(prio)) { }
|
||||
int wxThread::GetPriority() const { return 0; }
|
||||
|
||||
wxMutex *wxMainMutex; // controls access to all GUI functions
|
||||
|
||||
wxThread::wxThread()
|
||||
{
|
||||
p_internal = new wxThreadInternal();
|
||||
}
|
||||
|
||||
wxThread::~wxThread()
|
||||
{
|
||||
Destroy();
|
||||
Join();
|
||||
delete p_internal;
|
||||
}
|
||||
|
||||
// The default callback just joins the thread and throws away the result.
|
||||
void wxThread::OnExit()
|
||||
{
|
||||
Join();
|
||||
}
|
||||
|
||||
|
||||
// Automatic initialization
|
||||
class wxThreadModule : public wxModule {
|
||||
DECLARE_DYNAMIC_CLASS(wxThreadModule)
|
||||
public:
|
||||
bool OnInit();
|
||||
void OnExit();
|
||||
};
|
||||
|
||||
bool wxThreadModule::OnInit() {
|
||||
wxMainMutex = new wxMutex();
|
||||
wxMainMutex->Lock();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxThreadModule::OnExit()
|
||||
{
|
||||
wxMainMutex->Unlock();
|
||||
delete wxMainMutex;
|
||||
}
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
|
||||
@@ -1,396 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: threadpsx.cpp
|
||||
// Purpose: wxThread (Posix) Implementation
|
||||
// Author: Original from Wolfram Gloger/Guilhem Lavaux
|
||||
// Modified by:
|
||||
// Created: 04/22/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "thread.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#include "wx/thread.h"
|
||||
#include "wx/module.h"
|
||||
#include "wx/utils.h"
|
||||
|
||||
enum thread_state {
|
||||
STATE_IDLE = 0,
|
||||
STATE_RUNNING,
|
||||
STATE_PAUSING,
|
||||
STATE_PAUSED,
|
||||
STATE_CANCELED,
|
||||
STATE_EXITED
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Static variables
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static pthread_t p_mainid;
|
||||
static wxMutex p_list_mutex;
|
||||
static wxList p_threads_list;
|
||||
|
||||
wxMutex *wxMainMutex; // controls access to all GUI functions
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// GUI thread manager
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include "threadgui.inc"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// wxThread: Posix Thread implementation (Mutex)
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class wxMutexInternal {
|
||||
public:
|
||||
pthread_mutex_t p_mutex;
|
||||
};
|
||||
|
||||
wxMutex::wxMutex()
|
||||
{
|
||||
p_internal = new wxMutexInternal;
|
||||
pthread_mutex_init(&(p_internal->p_mutex), NULL);
|
||||
m_locked = 0;
|
||||
}
|
||||
|
||||
wxMutex::~wxMutex()
|
||||
{
|
||||
if (m_locked > 0)
|
||||
wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n",
|
||||
m_locked);
|
||||
|
||||
pthread_mutex_destroy(&(p_internal->p_mutex));
|
||||
delete p_internal;
|
||||
}
|
||||
|
||||
wxMutexError wxMutex::Lock()
|
||||
{
|
||||
int err;
|
||||
|
||||
err = pthread_mutex_lock(&(p_internal->p_mutex));
|
||||
if (err == EDEADLK)
|
||||
return MUTEX_DEAD_LOCK;
|
||||
m_locked++;
|
||||
return MUTEX_NO_ERROR;
|
||||
}
|
||||
|
||||
wxMutexError wxMutex::TryLock()
|
||||
{
|
||||
int err;
|
||||
|
||||
if (m_locked)
|
||||
return MUTEX_BUSY;
|
||||
err = pthread_mutex_trylock(&(p_internal->p_mutex));
|
||||
switch (err) {
|
||||
case EBUSY: return MUTEX_BUSY;
|
||||
}
|
||||
m_locked++;
|
||||
return MUTEX_NO_ERROR;
|
||||
}
|
||||
|
||||
wxMutexError wxMutex::Unlock()
|
||||
{
|
||||
if (m_locked > 0)
|
||||
m_locked--;
|
||||
else
|
||||
return MUTEX_UNLOCKED;
|
||||
pthread_mutex_unlock(&(p_internal->p_mutex));
|
||||
return MUTEX_NO_ERROR;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// wxThread: Posix Thread implementation (Condition)
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class wxConditionInternal {
|
||||
public:
|
||||
pthread_cond_t p_condition;
|
||||
};
|
||||
|
||||
wxCondition::wxCondition()
|
||||
{
|
||||
p_internal = new wxConditionInternal;
|
||||
pthread_cond_init(&(p_internal->p_condition), NULL);
|
||||
}
|
||||
|
||||
wxCondition::~wxCondition()
|
||||
{
|
||||
pthread_cond_destroy(&(p_internal->p_condition));
|
||||
delete p_internal;
|
||||
}
|
||||
|
||||
void wxCondition::Wait(wxMutex& mutex)
|
||||
{
|
||||
pthread_cond_wait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex));
|
||||
}
|
||||
|
||||
bool wxCondition::Wait(wxMutex& mutex, unsigned long sec, unsigned long nsec)
|
||||
{
|
||||
struct timespec tspec;
|
||||
|
||||
tspec.tv_sec = time(NULL)+sec;
|
||||
tspec.tv_nsec = nsec;
|
||||
return (pthread_cond_timedwait(&(p_internal->p_condition), &(mutex.p_internal->p_mutex), &tspec) != ETIMEDOUT);
|
||||
}
|
||||
|
||||
void wxCondition::Signal()
|
||||
{
|
||||
pthread_cond_signal(&(p_internal->p_condition));
|
||||
}
|
||||
|
||||
void wxCondition::Broadcast()
|
||||
{
|
||||
pthread_cond_broadcast(&(p_internal->p_condition));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// wxThread: Posix Thread implementation (Thread)
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class wxThreadInternal {
|
||||
public:
|
||||
wxThreadInternal() { state = STATE_IDLE; }
|
||||
~wxThreadInternal() {}
|
||||
static void *PthreadStart(void *ptr);
|
||||
pthread_t thread_id;
|
||||
int state;
|
||||
int prio;
|
||||
int defer_destroy;
|
||||
int id;
|
||||
};
|
||||
|
||||
void *wxThreadInternal::PthreadStart(void *ptr)
|
||||
{
|
||||
wxThread *thread = (wxThread *)ptr;
|
||||
|
||||
// Add the current thread to the list
|
||||
p_list_mutex.Lock();
|
||||
thread->p_internal->id = p_threads_list.Number();
|
||||
p_threads_list.Append((wxObject *)thread);
|
||||
p_list_mutex.Unlock();
|
||||
|
||||
// Call the main entry
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
||||
void* status = thread->Entry();
|
||||
|
||||
thread->Exit(status);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wxThreadError wxThread::Create()
|
||||
{
|
||||
pthread_attr_t a;
|
||||
int min_prio, max_prio, p;
|
||||
struct sched_param sp;
|
||||
|
||||
if (p_internal->state != STATE_IDLE)
|
||||
return THREAD_RUNNING;
|
||||
|
||||
// Change thread priority
|
||||
pthread_attr_init(&a);
|
||||
pthread_attr_getschedpolicy(&a, &p);
|
||||
|
||||
min_prio = sched_get_priority_min(p);
|
||||
max_prio = sched_get_priority_max(p);
|
||||
|
||||
pthread_attr_getschedparam(&a, &sp);
|
||||
sp.sched_priority = min_prio +
|
||||
(p_internal->prio*(max_prio-min_prio))/100;
|
||||
pthread_attr_setschedparam(&a, &sp);
|
||||
|
||||
// this is the point of no return
|
||||
p_internal->state = STATE_RUNNING;
|
||||
if (pthread_create(&p_internal->thread_id, &a,
|
||||
wxThreadInternal::PthreadStart, (void *)this) != 0) {
|
||||
p_internal->state = STATE_IDLE;
|
||||
pthread_attr_destroy(&a);
|
||||
return THREAD_NO_RESOURCE;
|
||||
}
|
||||
pthread_attr_destroy(&a);
|
||||
|
||||
return THREAD_NO_ERROR;
|
||||
}
|
||||
|
||||
void wxThread::SetPriority(int prio)
|
||||
{
|
||||
if (p_internal->state == STATE_RUNNING)
|
||||
return;
|
||||
|
||||
if (prio > 100)
|
||||
prio = 100;
|
||||
if (prio < 0)
|
||||
prio = 0;
|
||||
p_internal->prio = prio;
|
||||
}
|
||||
|
||||
int wxThread::GetPriority() const
|
||||
{
|
||||
return p_internal->prio;
|
||||
}
|
||||
|
||||
void wxThread::DeferDestroy(bool on)
|
||||
{
|
||||
if (on)
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
|
||||
else
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
||||
}
|
||||
|
||||
wxThreadError wxThread::Destroy()
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
if (p_internal->state == STATE_RUNNING) {
|
||||
res = pthread_cancel(p_internal->thread_id);
|
||||
if (res == 0)
|
||||
p_internal->state = STATE_CANCELED;
|
||||
}
|
||||
|
||||
return THREAD_NO_ERROR;
|
||||
}
|
||||
|
||||
wxThreadError wxThread::Pause()
|
||||
{
|
||||
if (p_internal->state != STATE_RUNNING)
|
||||
return THREAD_NOT_RUNNING;
|
||||
|
||||
if (!p_internal->defer_destroy)
|
||||
return THREAD_MISC_ERROR;
|
||||
|
||||
p_internal->state = STATE_PAUSING;
|
||||
return THREAD_NO_ERROR;
|
||||
}
|
||||
|
||||
wxThreadError wxThread::Resume()
|
||||
{
|
||||
if (p_internal->state == STATE_PAUSING || p_internal->state == STATE_PAUSED)
|
||||
p_internal->state = STATE_RUNNING;
|
||||
|
||||
return THREAD_NO_ERROR;
|
||||
}
|
||||
|
||||
void *wxThread::Join()
|
||||
{
|
||||
void* status = 0;
|
||||
|
||||
if (p_internal->state != STATE_IDLE) {
|
||||
bool do_unlock = wxThread::IsMain();
|
||||
|
||||
while (p_internal->state == STATE_RUNNING)
|
||||
wxYield();
|
||||
|
||||
if (do_unlock)
|
||||
wxMainMutex->Unlock();
|
||||
pthread_join(p_internal->thread_id, &status);
|
||||
if (do_unlock)
|
||||
wxMainMutex->Lock();
|
||||
|
||||
p_list_mutex.Lock();
|
||||
delete p_threads_list.Nth(p_internal->id);
|
||||
p_list_mutex.Unlock();
|
||||
|
||||
p_internal->state = STATE_IDLE;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
unsigned long wxThread::GetID() const
|
||||
{
|
||||
return p_internal->id;
|
||||
}
|
||||
|
||||
wxThread *wxThread::GetThreadFromID(unsigned long id)
|
||||
{
|
||||
wxNode *node = p_threads_list.Nth(id);
|
||||
|
||||
if (!node)
|
||||
return NULL;
|
||||
return (wxThread *)node->Data();
|
||||
}
|
||||
|
||||
void wxThread::Exit(void *status)
|
||||
{
|
||||
wxThread* ptr = this;
|
||||
|
||||
THREAD_SEND_EXIT_MSG(ptr);
|
||||
p_internal->state = STATE_EXITED;
|
||||
pthread_exit(status);
|
||||
}
|
||||
|
||||
void wxThread::TestDestroy()
|
||||
{
|
||||
if (p_internal->state == STATE_PAUSING) {
|
||||
p_internal->state = STATE_PAUSED;
|
||||
while (p_internal->state == STATE_PAUSED) {
|
||||
pthread_testcancel();
|
||||
usleep(1);
|
||||
}
|
||||
}
|
||||
pthread_testcancel();
|
||||
}
|
||||
|
||||
bool wxThread::IsMain()
|
||||
{
|
||||
return (bool)pthread_equal(pthread_self(), p_mainid);
|
||||
}
|
||||
|
||||
bool wxThread::IsRunning() const
|
||||
{
|
||||
return (p_internal->state == STATE_RUNNING);
|
||||
}
|
||||
|
||||
bool wxThread::IsAlive() const
|
||||
{
|
||||
return (p_internal->state == STATE_RUNNING) ||
|
||||
(p_internal->state == STATE_PAUSING) ||
|
||||
(p_internal->state == STATE_PAUSED);
|
||||
}
|
||||
|
||||
wxThread::wxThread()
|
||||
{
|
||||
p_internal = new wxThreadInternal();
|
||||
}
|
||||
|
||||
wxThread::~wxThread()
|
||||
{
|
||||
Destroy();
|
||||
Join();
|
||||
delete p_internal;
|
||||
}
|
||||
|
||||
// The default callback just joins the thread and throws away the result.
|
||||
void wxThread::OnExit()
|
||||
{
|
||||
Join();
|
||||
}
|
||||
|
||||
// Automatic initialization
|
||||
class wxThreadModule : public wxModule {
|
||||
DECLARE_DYNAMIC_CLASS(wxThreadModule)
|
||||
public:
|
||||
virtual bool OnInit() {
|
||||
wxMainMutex = new wxMutex();
|
||||
wxThreadGuiInit();
|
||||
p_mainid = pthread_self();
|
||||
p_threads_list = wxList(wxKEY_INTEGER);
|
||||
wxMainMutex->Lock();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
virtual void OnExit() {
|
||||
wxMainMutex->Unlock();
|
||||
wxThreadGuiExit();
|
||||
delete wxMainMutex;
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
|
||||
@@ -1,254 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: threadsgi.cpp
|
||||
// Purpose: wxThread (SGI) Implementation
|
||||
// Author: Original from Wolfram Gloger/Guilhem Lavaux
|
||||
// Modified by:
|
||||
// Created: 04/22/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998)
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "thread.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/prctl.h>
|
||||
#include "wx/thread.h"
|
||||
#include "wx/module.h"
|
||||
#include "wx/utils.h"
|
||||
|
||||
enum thread_state {
|
||||
STATE_IDLE = 0,
|
||||
STATE_RUNNING,
|
||||
STATE_CANCELED,
|
||||
STATE_EXITED
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Static variables
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int p_mainid;
|
||||
wxMutex *wxMainMutex;
|
||||
|
||||
#include "threadgui.inc"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Unix implementations (SGI threads)
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class wxMutexInternal {
|
||||
public:
|
||||
abilock_t p_mutex;
|
||||
};
|
||||
|
||||
wxMutex::wxMutex()
|
||||
{
|
||||
m_locked = 0;
|
||||
p_internal = new wxMutexInternal;
|
||||
init_lock(&(p_internal->p_mutex));
|
||||
}
|
||||
|
||||
wxMutex::~wxMutex()
|
||||
{
|
||||
if (m_locked > 0)
|
||||
wxDebugMsg("wxMutex warning: freeing a locked mutex (%d locks)\n",
|
||||
m_locked);
|
||||
delete p_internal;
|
||||
}
|
||||
|
||||
wxMutexError wxMutex::Lock()
|
||||
{
|
||||
spin_lock(&(p_internal->p_mutex));
|
||||
m_locked++;
|
||||
return MUTEX_NO_ERROR;
|
||||
}
|
||||
|
||||
wxMutexError wxMutex::TryLock()
|
||||
{
|
||||
if (acquire_lock(&(p_internal->p_mutex)) != 0)
|
||||
return MUTEX_BUSY;
|
||||
m_locked++;
|
||||
return MUTEX_NO_ERROR;
|
||||
}
|
||||
|
||||
wxMutexError wxMutex::Unlock()
|
||||
{
|
||||
if (m_locked == 0)
|
||||
return MUTEX_UNLOCKED;
|
||||
release_lock(&(p_internal->p_mutex));
|
||||
m_locked--;
|
||||
return MUTEX_NO_ERROR;
|
||||
}
|
||||
|
||||
// GL: Don't know how it works on SGI. Wolfram ?
|
||||
|
||||
wxCondition::wxCondition() {}
|
||||
wxCondition::~wxCondition() {}
|
||||
int wxCondition::Wait(wxMutex& WXUNUSED(mutex)) { return 0;}
|
||||
int wxCondition::Wait(wxMutex& WXUNUSED(mutex), unsigned long WXUNUSED(sec),
|
||||
unsigned long WXUNUSED(nsec)) { return 0; }
|
||||
int wxCondition::Signal() { return 0; }
|
||||
int wxCondition::Broadcast() { return 0; }
|
||||
|
||||
class
|
||||
wxThreadPrivate {
|
||||
public:
|
||||
wxThreadPrivate() { thread_id = 0; state = STATE_IDLE; }
|
||||
~wxThreadPrivate() {}
|
||||
static void SprocStart(void *ptr);
|
||||
static void SignalHandler(int sig);
|
||||
public:
|
||||
int state, thread_id;
|
||||
void* exit_status;
|
||||
};
|
||||
|
||||
void wxThreadPrivate::SprocStart(void *ptr)
|
||||
{
|
||||
void* status;
|
||||
|
||||
wxThread *thr = (wxThread *)ptr;
|
||||
|
||||
thr->p_internal->thread_id = getpid();
|
||||
thr->p_internal->exit_status = 0;
|
||||
status = thr->Entry();
|
||||
thr->Exit(status);
|
||||
}
|
||||
|
||||
void wxThread::Exit(void* status)
|
||||
{
|
||||
wxThread* ptr = this;
|
||||
THREAD_SEND_EXIT_MSG(ptr);
|
||||
p_internal->state = STATE_EXITED;
|
||||
p_internal->exit_status = status;
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
wxThreadError wxThread::Create()
|
||||
{
|
||||
if (p_internal->state != STATE_IDLE)
|
||||
return THREAD_RUNNING;
|
||||
p_internal->state = STATE_RUNNING;
|
||||
if (sproc(p_internal->SprocStart, PR_SALL, this) < 0) {
|
||||
p_internal->state = STATE_IDLE;
|
||||
return THREAD_NO_RESOURCE;
|
||||
}
|
||||
return THREAD_NO_ERROR;
|
||||
}
|
||||
|
||||
wxThreadError wxThread::Destroy()
|
||||
{
|
||||
if (p_internal->state == STATE_RUNNING)
|
||||
p_internal->state = STATE_CANCELED;
|
||||
|
||||
return THREAD_NO_ERROR;
|
||||
}
|
||||
|
||||
wxThreadError wxThread::Pause()
|
||||
{
|
||||
return THREAD_NO_ERROR;
|
||||
}
|
||||
|
||||
wxThreadError wxThread::Resume()
|
||||
{
|
||||
return THREAD_NO_ERROR;
|
||||
}
|
||||
|
||||
void *wxThread::Join()
|
||||
{
|
||||
if (p_internal->state != STATE_IDLE) {
|
||||
bool do_unlock = wxThread::IsMain();
|
||||
int stat;
|
||||
|
||||
if (do_unlock)
|
||||
wxMainMutex->Unlock();
|
||||
waitpid(p_internal->thread_id, &stat, 0);
|
||||
if (do_unlock)
|
||||
wxMainMutex->Lock();
|
||||
if (!WIFEXITED(stat) && !WIFSIGNALED(stat))
|
||||
return 0;
|
||||
p_internal->state = STATE_IDLE;
|
||||
return p_internal->exit_status;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long wxThread::GetID() const
|
||||
{
|
||||
return (unsigned long)p_internal->thread_id;
|
||||
}
|
||||
|
||||
void wxThread::TestDestroy()
|
||||
{
|
||||
if (p_internal->state == STATE_CANCELED) {
|
||||
p_internal->exit_status = 0;
|
||||
_exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
void wxThread::SetPriority(int prio)
|
||||
{
|
||||
}
|
||||
|
||||
int wxThread::GetPriority() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wxThread::IsMain()
|
||||
{
|
||||
return (int)getpid() == main_id;
|
||||
}
|
||||
|
||||
bool wxThread::IsAlive() const
|
||||
{
|
||||
return (p_internal->state == STATE_RUNNING);
|
||||
}
|
||||
|
||||
bool wxThread::IsRunning() const
|
||||
{
|
||||
return (p_internal->state == STATE_RUNNING);
|
||||
}
|
||||
|
||||
wxThread::wxThread()
|
||||
{
|
||||
p_internal = new wxThreadPrivate();
|
||||
}
|
||||
|
||||
wxThread::~wxThread()
|
||||
{
|
||||
Cancel();
|
||||
Join();
|
||||
delete p_internal;
|
||||
}
|
||||
|
||||
// The default callback just joins the thread and throws away the result.
|
||||
void wxThread::OnExit()
|
||||
{
|
||||
Join();
|
||||
}
|
||||
|
||||
// Global initialization
|
||||
class wxThreadModule : public wxModule {
|
||||
DECLARE_DYNAMIC_CLASS(wxThreadModule)
|
||||
public:
|
||||
virtual bool OnInit() {
|
||||
wxMainMutex = new wxMutex();
|
||||
wxThreadGuiInit();
|
||||
p_mainid = (int)getpid();
|
||||
wxMainMutex->Lock();
|
||||
}
|
||||
|
||||
virtual void OnExit() {
|
||||
wxMainMutex->Unlock();
|
||||
wxThreadGuiExit();
|
||||
delete wxMainMutex;
|
||||
}
|
||||
};
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)
|
||||
@@ -1,54 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: timer.cpp
|
||||
// Purpose: wxTimer implementation
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "timer.h"
|
||||
#endif
|
||||
|
||||
#include "wx/timer.h"
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
|
||||
|
||||
wxTimer::wxTimer()
|
||||
{
|
||||
m_milli = 0 ;
|
||||
m_lastMilli = -1 ;
|
||||
m_id = 0;
|
||||
m_oneShot = FALSE;
|
||||
}
|
||||
|
||||
wxTimer::~wxTimer()
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
|
||||
bool wxTimer::Start(int milliseconds,bool mode)
|
||||
{
|
||||
m_oneShot = mode ;
|
||||
if (m_milliseconds < 0)
|
||||
m_milliseconds = lastMilli;
|
||||
|
||||
if (m_milliseconds <= 0)
|
||||
return FALSE;
|
||||
|
||||
m_lastMilli = m_milli = m_milliseconds;
|
||||
|
||||
// TODO: set the timer going.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxTimer::Stop()
|
||||
{
|
||||
m_id = 0 ;
|
||||
m_milli = 0 ;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,367 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: utils.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//#ifdef __GNUG__
|
||||
//#pragma implementation "utils.h"
|
||||
//#endif
|
||||
|
||||
#include "wx/utils.h"
|
||||
#include "wx/string.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#include <pwd.h>
|
||||
#include <errno.h>
|
||||
#include <netdb.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef __SVR4__
|
||||
#include <sys/systeminfo.h>
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// misc.
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void wxBell(void)
|
||||
{
|
||||
gdk_beep();
|
||||
};
|
||||
|
||||
void wxSleep(int nSecs)
|
||||
{
|
||||
sleep(nSecs);
|
||||
};
|
||||
|
||||
int wxKill(long pid, int sig)
|
||||
{
|
||||
return kill(pid, sig);
|
||||
};
|
||||
|
||||
void wxDisplaySize( int *width, int *height )
|
||||
{
|
||||
if (width) *width = gdk_screen_width();
|
||||
if (height) *height = gdk_screen_height();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// user and home routines
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
char* wxGetHomeDir( char *dest )
|
||||
{
|
||||
wxString tmp = wxGetUserHome( wxString() );
|
||||
if (tmp.IsNull())
|
||||
strcpy( wxBuffer, "/" );
|
||||
else
|
||||
strcpy( wxBuffer, tmp );
|
||||
if (dest) strcpy( dest, WXSTRINGCAST tmp );
|
||||
return wxBuffer;
|
||||
};
|
||||
|
||||
char *wxGetUserHome( const wxString &user )
|
||||
{
|
||||
struct passwd *who = NULL;
|
||||
|
||||
if (user.IsNull() || (user== ""))
|
||||
{
|
||||
register char *ptr;
|
||||
|
||||
if ((ptr = getenv("HOME")) != NULL)
|
||||
return ptr;
|
||||
if ((ptr = getenv("USER")) != NULL
|
||||
|| (ptr = getenv("LOGNAME")) != NULL) {
|
||||
who = getpwnam(ptr);
|
||||
}
|
||||
// We now make sure the the user exists!
|
||||
if (who == NULL)
|
||||
who = getpwuid(getuid());
|
||||
}
|
||||
else
|
||||
who = getpwnam (user);
|
||||
|
||||
return who ? who->pw_dir : (char*)NULL;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// id routines
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
bool wxGetHostName(char *buf, int sz)
|
||||
{
|
||||
*buf = '\0';
|
||||
#if defined(__SVR4__) && !defined(__sgi)
|
||||
return (sysinfo(SI_HOSTNAME, buf, sz) != -1);
|
||||
#else /* BSD Sockets */
|
||||
char name[255];
|
||||
struct hostent *h;
|
||||
// Get hostname
|
||||
if (gethostname(name, sizeof(name)/sizeof(char)-1) == -1)
|
||||
return FALSE;
|
||||
// Get official full name of host
|
||||
strncpy(buf, (h=gethostbyname(name))!=NULL ? h->h_name : name, sz-1);
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool wxGetUserId(char *buf, int sz)
|
||||
{
|
||||
struct passwd *who;
|
||||
|
||||
*buf = '\0';
|
||||
if ((who = getpwuid(getuid ())) != NULL) {
|
||||
strncpy (buf, who->pw_name, sz-1);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxGetUserName(char *buf, int sz)
|
||||
{
|
||||
struct passwd *who;
|
||||
|
||||
*buf = '\0';
|
||||
if ((who = getpwuid (getuid ())) != NULL) {
|
||||
strncpy (buf, who->pw_gecos, sz - 1);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// error and debug output routines
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void wxDebugMsg( const char *format, ... )
|
||||
{
|
||||
va_list ap;
|
||||
va_start( ap, format );
|
||||
vfprintf( stderr, format, ap );
|
||||
fflush( stderr );
|
||||
va_end(ap);
|
||||
};
|
||||
|
||||
void wxError( const wxString &msg, const wxString &title )
|
||||
{
|
||||
fprintf( stderr, "Error " );
|
||||
if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
|
||||
if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
|
||||
fprintf( stderr, ".\n" );
|
||||
};
|
||||
|
||||
void wxFatalError( const wxString &msg, const wxString &title )
|
||||
{
|
||||
fprintf( stderr, "Error " );
|
||||
if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
|
||||
if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
|
||||
fprintf( stderr, ".\n" );
|
||||
exit(1);
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// directory routines
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
bool wxDirExists( const wxString& dir )
|
||||
{
|
||||
char buf[500];
|
||||
strcpy( buf, WXSTRINGCAST(dir) );
|
||||
struct stat sbuf;
|
||||
return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// wild character routines
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
bool wxIsWild( const wxString& pattern )
|
||||
{
|
||||
wxString tmp = pattern;
|
||||
char *pat = WXSTRINGCAST(tmp);
|
||||
while (*pat) {
|
||||
switch (*pat++) {
|
||||
case '?': case '*': case '[': case '{':
|
||||
return TRUE;
|
||||
case '\\':
|
||||
if (!*pat++)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
|
||||
bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
|
||||
{
|
||||
wxString tmp1 = pat;
|
||||
char *pattern = WXSTRINGCAST(tmp1);
|
||||
wxString tmp2 = text;
|
||||
char *str = WXSTRINGCAST(tmp2);
|
||||
char c;
|
||||
char *cp;
|
||||
bool done = FALSE, ret_code, ok;
|
||||
// Below is for vi fans
|
||||
const char OB = '{', CB = '}';
|
||||
|
||||
// dot_special means '.' only matches '.'
|
||||
if (dot_special && *str == '.' && *pattern != *str)
|
||||
return FALSE;
|
||||
|
||||
while ((*pattern != '\0') && (!done)
|
||||
&& (((*str=='\0')&&((*pattern==OB)||(*pattern=='*')))||(*str!='\0'))) {
|
||||
switch (*pattern) {
|
||||
case '\\':
|
||||
pattern++;
|
||||
if (*pattern != '\0')
|
||||
pattern++;
|
||||
break;
|
||||
case '*':
|
||||
pattern++;
|
||||
ret_code = FALSE;
|
||||
while ((*str!='\0')
|
||||
&& (!(ret_code=wxMatchWild(pattern, str++, FALSE))))
|
||||
/*loop*/;
|
||||
if (ret_code) {
|
||||
while (*str != '\0')
|
||||
str++;
|
||||
while (*pattern != '\0')
|
||||
pattern++;
|
||||
}
|
||||
break;
|
||||
case '[':
|
||||
pattern++;
|
||||
repeat:
|
||||
if ((*pattern == '\0') || (*pattern == ']')) {
|
||||
done = TRUE;
|
||||
break;
|
||||
}
|
||||
if (*pattern == '\\') {
|
||||
pattern++;
|
||||
if (*pattern == '\0') {
|
||||
done = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (*(pattern + 1) == '-') {
|
||||
c = *pattern;
|
||||
pattern += 2;
|
||||
if (*pattern == ']') {
|
||||
done = TRUE;
|
||||
break;
|
||||
}
|
||||
if (*pattern == '\\') {
|
||||
pattern++;
|
||||
if (*pattern == '\0') {
|
||||
done = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((*str < c) || (*str > *pattern)) {
|
||||
pattern++;
|
||||
goto repeat;
|
||||
}
|
||||
} else if (*pattern != *str) {
|
||||
pattern++;
|
||||
goto repeat;
|
||||
}
|
||||
pattern++;
|
||||
while ((*pattern != ']') && (*pattern != '\0')) {
|
||||
if ((*pattern == '\\') && (*(pattern + 1) != '\0'))
|
||||
pattern++;
|
||||
pattern++;
|
||||
}
|
||||
if (*pattern != '\0') {
|
||||
pattern++, str++;
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
pattern++;
|
||||
str++;
|
||||
break;
|
||||
case OB:
|
||||
pattern++;
|
||||
while ((*pattern != CB) && (*pattern != '\0')) {
|
||||
cp = str;
|
||||
ok = TRUE;
|
||||
while (ok && (*cp != '\0') && (*pattern != '\0')
|
||||
&& (*pattern != ',') && (*pattern != CB)) {
|
||||
if (*pattern == '\\')
|
||||
pattern++;
|
||||
ok = (*pattern++ == *cp++);
|
||||
}
|
||||
if (*pattern == '\0') {
|
||||
ok = FALSE;
|
||||
done = TRUE;
|
||||
break;
|
||||
} else if (ok) {
|
||||
str = cp;
|
||||
while ((*pattern != CB) && (*pattern != '\0')) {
|
||||
if (*++pattern == '\\') {
|
||||
if (*++pattern == CB)
|
||||
pattern++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while (*pattern!=CB && *pattern!=',' && *pattern!='\0') {
|
||||
if (*++pattern == '\\') {
|
||||
if (*++pattern == CB || *pattern == ',')
|
||||
pattern++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (*pattern != '\0')
|
||||
pattern++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (*str == *pattern) {
|
||||
str++, pattern++;
|
||||
} else {
|
||||
done = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (*pattern == '*')
|
||||
pattern++;
|
||||
return ((*str == '\0') && (*pattern == '\0'));
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// subprocess routines
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
long wxExecute( char **argv, bool sync, wxProcess *process )
|
||||
{
|
||||
};
|
||||
|
||||
long wxExecute( const wxString& command, bool sync, wxProcess *process )
|
||||
{
|
||||
if (command.IsNull() || command == "") return FALSE;
|
||||
|
||||
int argc = 0;
|
||||
char *argv[127];
|
||||
char tmp[1024];
|
||||
const char *IFS = " \t\n";
|
||||
|
||||
strncpy (tmp, command, sizeof(tmp) / sizeof(char) - 1);
|
||||
tmp[sizeof (tmp) / sizeof (char) - 1] = '\0';
|
||||
argv[argc++] = strtok (tmp, IFS);
|
||||
while ((argv[argc++] = strtok(NULL, IFS)) != NULL)
|
||||
/* loop */ ;
|
||||
return wxExecute(argv, sync, process);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,332 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: utils.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//#ifdef __GNUG__
|
||||
//#pragma implementation "utils.h"
|
||||
//#endif
|
||||
|
||||
#include "wx/utils.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/list.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#ifdef __SVR4__
|
||||
#include <sys/systeminfo.h>
|
||||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xresource.h>
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// constants
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Yuck this is really BOTH site and platform dependent
|
||||
// so we should use some other strategy!
|
||||
#ifdef __SUN__
|
||||
#define DEFAULT_XRESOURCE_DIR "/usr/openwin/lib/app-defaults"
|
||||
#else
|
||||
#define DEFAULT_XRESOURCE_DIR "/usr/lib/X11/app-defaults"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// glabal data (data.cpp)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern wxList wxResourceCache;
|
||||
extern XrmDatabase wxResourceDatabase;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// utility functions for get/write resources
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static char *GetResourcePath(char *buf, char *name, bool create)
|
||||
{
|
||||
if (create && FileExists(name)) {
|
||||
strcpy(buf, name);
|
||||
return buf; // Exists so ...
|
||||
}
|
||||
if (*name == '/')
|
||||
strcpy(buf, name);
|
||||
else {
|
||||
// Put in standard place for resource files if not absolute
|
||||
strcpy(buf, DEFAULT_XRESOURCE_DIR);
|
||||
strcat(buf, "/");
|
||||
strcat(buf, FileNameFromPath(name));
|
||||
}
|
||||
if (create) {
|
||||
// Touch the file to create it
|
||||
FILE *fd = fopen(buf, "w");
|
||||
if (fd) fclose(fd);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
// Read $HOME for what it says is home, if not
|
||||
// read $USER or $LOGNAME for user name else determine
|
||||
// the Real User, then determine the Real home dir.
|
||||
static char *GetIniFile(char *dest, const char *filename)
|
||||
{
|
||||
char *home = NULL;
|
||||
if (filename && wxIsAbsolutePath(filename))
|
||||
{
|
||||
strcpy(dest, filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((home = wxGetUserHome(wxString())) != NULL)
|
||||
{
|
||||
strcpy(dest, home);
|
||||
if (dest[strlen(dest) - 1] != '/') strcat(dest, "/");
|
||||
if (filename == NULL)
|
||||
{
|
||||
if ((filename = getenv("XENVIRONMENT")) == NULL) filename = ".Xdefaults";
|
||||
}
|
||||
else
|
||||
if (*filename != '.') strcat(dest, ".");
|
||||
strcat(dest, filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
dest[0] = '\0';
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
static void wxXMergeDatabases(void)
|
||||
{
|
||||
XrmDatabase homeDB, serverDB, applicationDB;
|
||||
char filenamebuf[1024];
|
||||
|
||||
char *filename = &filenamebuf[0];
|
||||
char *environment;
|
||||
// char *classname = gdk_progclass; // Robert Roebling ??
|
||||
printf( "Fixme.\n");
|
||||
char name[256];
|
||||
(void)strcpy(name, "/usr/lib/X11/app-defaults/");
|
||||
(void)strcat(name, classname ? classname : "wxWindows");
|
||||
|
||||
// Get application defaults file, if any
|
||||
if ((applicationDB = XrmGetFileDatabase(name)))
|
||||
(void)XrmMergeDatabases(applicationDB, &wxResourceDatabase);
|
||||
|
||||
// Merge server defaults, created by xrdb, loaded as a property of the root
|
||||
// window when the server initializes and loaded into the display
|
||||
// structure on XOpenDisplay;
|
||||
// if not defined, use .Xdefaults
|
||||
printf( "Fixme.\n");
|
||||
/* if (XResourceManagerString(GDK_DISPLAY()) != NULL) {
|
||||
serverDB = XrmGetStringDatabase(XResourceManagerString(GDK_DISPLAY()));
|
||||
} else {
|
||||
(void)GetIniFile(filename, NULL);
|
||||
serverDB = XrmGetFileDatabase(filename);
|
||||
}
|
||||
*/
|
||||
if (serverDB)
|
||||
XrmMergeDatabases(serverDB, &wxResourceDatabase);
|
||||
|
||||
// Open XENVIRONMENT file, or if not defined, the .Xdefaults,
|
||||
// and merge into existing database
|
||||
|
||||
if ((environment = getenv("XENVIRONMENT")) == NULL) {
|
||||
size_t len;
|
||||
environment = GetIniFile(filename, NULL);
|
||||
len = strlen(environment);
|
||||
#if !defined(SVR4) || defined(__sgi)
|
||||
(void)gethostname(environment + len, 1024 - len);
|
||||
#else
|
||||
(void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len);
|
||||
#endif
|
||||
}
|
||||
if ((homeDB = XrmGetFileDatabase(environment)))
|
||||
XrmMergeDatabases(homeDB, &wxResourceDatabase);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// called on application exit
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void wxFlushResources(void)
|
||||
{
|
||||
char nameBuffer[512];
|
||||
|
||||
wxNode *node = wxResourceCache.First();
|
||||
while (node) {
|
||||
char *file = node->key.string;
|
||||
// If file doesn't exist, create it first.
|
||||
(void)GetResourcePath(nameBuffer, file, TRUE);
|
||||
|
||||
XrmDatabase database = (XrmDatabase)node->Data();
|
||||
XrmPutFileDatabase(database, nameBuffer);
|
||||
XrmDestroyDatabase(database);
|
||||
wxNode *next = node->Next();
|
||||
delete node;
|
||||
node = next;
|
||||
}
|
||||
}
|
||||
|
||||
void wxDeleteResources(const char *file)
|
||||
{
|
||||
char buffer[500];
|
||||
(void)GetIniFile(buffer, file);
|
||||
|
||||
wxNode *node = wxResourceCache.Find(buffer);
|
||||
if (node) {
|
||||
XrmDatabase database = (XrmDatabase)node->Data();
|
||||
XrmDestroyDatabase(database);
|
||||
delete node;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// resource functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file )
|
||||
{
|
||||
char buffer[500];
|
||||
|
||||
if (!entry) return FALSE;
|
||||
|
||||
(void)GetIniFile(buffer, file);
|
||||
|
||||
XrmDatabase database;
|
||||
wxNode *node = wxResourceCache.Find(buffer);
|
||||
if (node)
|
||||
database = (XrmDatabase)node->Data();
|
||||
else {
|
||||
database = XrmGetFileDatabase(buffer);
|
||||
wxResourceCache.Append(buffer, (wxObject *)database);
|
||||
}
|
||||
char resName[300];
|
||||
strcpy(resName, !section.IsNull() ? WXSTRINGCAST section : "wxWindows");
|
||||
strcat(resName, ".");
|
||||
strcat(resName, entry);
|
||||
XrmPutStringResource(&database, resName, value);
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file )
|
||||
{
|
||||
char buf[50];
|
||||
sprintf(buf, "%.4f", value);
|
||||
return wxWriteResource(section, entry, buf, file);
|
||||
};
|
||||
|
||||
bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file )
|
||||
{
|
||||
char buf[50];
|
||||
sprintf(buf, "%ld", value);
|
||||
return wxWriteResource(section, entry, buf, file);
|
||||
};
|
||||
|
||||
bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file )
|
||||
{
|
||||
char buf[50];
|
||||
sprintf(buf, "%d", value);
|
||||
return wxWriteResource(section, entry, buf, file);
|
||||
};
|
||||
|
||||
bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file )
|
||||
{
|
||||
if (!wxResourceDatabase)
|
||||
wxXMergeDatabases();
|
||||
|
||||
XrmDatabase database;
|
||||
if (file) {
|
||||
char buffer[500];
|
||||
// Is this right? Trying to get it to look in the user's
|
||||
// home directory instead of current directory -- JACS
|
||||
(void)GetIniFile(buffer, file);
|
||||
|
||||
wxNode *node = wxResourceCache.Find(buffer);
|
||||
if (node)
|
||||
database = (XrmDatabase)node->Data();
|
||||
else {
|
||||
database = XrmGetFileDatabase(buffer);
|
||||
wxResourceCache.Append(buffer, (wxObject *)database);
|
||||
}
|
||||
} else
|
||||
database = wxResourceDatabase;
|
||||
|
||||
XrmValue xvalue;
|
||||
char *str_type[20];
|
||||
char buf[150];
|
||||
strcpy(buf, section);
|
||||
strcat(buf, ".");
|
||||
strcat(buf, entry);
|
||||
|
||||
bool success = XrmGetResource(database, buf, "*", str_type, &xvalue);
|
||||
// Try different combinations of upper/lower case, just in case...
|
||||
if (!success) {
|
||||
buf[0] = (isupper(buf[0]) ? tolower(buf[0]) : toupper(buf[0]));
|
||||
success = XrmGetResource(database, buf, "*", str_type, &xvalue);
|
||||
}
|
||||
if (success) {
|
||||
if (*value)
|
||||
delete[] *value;
|
||||
*value = new char[xvalue.size + 1];
|
||||
strncpy(*value, xvalue.addr, (int)xvalue.size);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file )
|
||||
{
|
||||
char *s = NULL;
|
||||
bool succ = wxGetResource(section, entry, &s, file);
|
||||
if (succ) {
|
||||
*value = (float)strtod(s, NULL);
|
||||
delete[]s;
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file )
|
||||
{
|
||||
char *s = NULL;
|
||||
bool succ = wxGetResource(section, entry, &s, file);
|
||||
if (succ) {
|
||||
*value = strtol(s, NULL, 10);
|
||||
delete[]s;
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file )
|
||||
{
|
||||
char *s = NULL;
|
||||
bool succ = wxGetResource(section, entry, &s, file);
|
||||
if (succ) {
|
||||
// Handle True, False here
|
||||
// True, Yes, Enables, Set or Activated
|
||||
if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A')
|
||||
*value = TRUE;
|
||||
// False, No, Disabled, Reset, Cleared, Deactivated
|
||||
else if (*s == 'F' || *s == 'N' || *s == 'D' || *s == 'R' || *s == 'C')
|
||||
*value = FALSE;
|
||||
// Handle as Integer
|
||||
else
|
||||
*value = (int)strtol(s, NULL, 10);
|
||||
delete[]s;
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#define verti_width 15
|
||||
#define verti_height 15
|
||||
static char verti_bits[] = {
|
||||
0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10,
|
||||
0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10,
|
||||
0x84, 0x10, 0x84, 0x10, 0x84, 0x10};
|
||||
1282
src/qt/window.cpp
1282
src/qt/window.cpp
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user