More configure fixes

/src/qt and /include/wx/qt now have stubs. Not everything
  compiles yet. But it's a start..


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-08-07 21:32:13 +00:00
parent b4e76e0d7e
commit 7c78e7c702
105 changed files with 13910 additions and 12 deletions

366
src/qt/app.cpp Normal file
View File

@@ -0,0 +1,366 @@
/////////////////////////////////////////////////////////////////////////////
// Name: app.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 "app.h"
#endif
#include "wx/app.h"
#include "wx/gdicmn.h"
#include "wx/utils.h"
#include "wx/postscrp.h"
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/memory.h"
#include "unistd.h"
//-----------------------------------------------------------------------------
// global data
//-----------------------------------------------------------------------------
wxApp *wxTheApp = NULL;
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
extern wxList wxPendingDelete;
//-----------------------------------------------------------------------------
// local functions
//-----------------------------------------------------------------------------
extern void wxFlushResources(void);
//-----------------------------------------------------------------------------
// global functions
//-----------------------------------------------------------------------------
void wxExit(void)
{
};
bool wxYield(void)
{
return TRUE;
};
//-----------------------------------------------------------------------------
// wxApp
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler)
BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
EVT_IDLE(wxApp::OnIdle)
END_EVENT_TABLE()
wxApp::wxApp()
{
m_topWindow = NULL;
m_exitOnFrameDelete = TRUE;
};
wxApp::~wxApp(void)
{
};
bool wxApp::OnInit(void)
{
return TRUE;
};
bool wxApp::OnInitGui(void)
{
return TRUE;
};
int wxApp::OnRun(void)
{
return MainLoop();
};
bool wxApp::ProcessIdle(void)
{
wxIdleEvent event;
event.SetEventObject( this );
ProcessEvent( event );
return event.MoreRequested();
};
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;
};
bool wxApp::SendIdleEvents(void)
{
bool needMore = FALSE;
wxNode* node = wxTopLevelWindows.First();
while (node)
{
wxWindow* win = (wxWindow*) node->Data();
if (SendIdleEvents(win))
needMore = TRUE;
node = node->Next();
}
return needMore;
};
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 ;
};
int wxApp::OnExit(void)
{
return 0;
};
int wxApp::MainLoop(void)
{
return 0;
};
void wxApp::ExitMainLoop(void)
{
};
bool wxApp::Initialized(void)
{
return m_initialized;
};
bool wxApp::Pending(void)
{
return FALSE;
};
void wxApp::Dispatch(void)
{
};
void wxApp::DeletePendingObjects(void)
{
wxNode *node = wxPendingDelete.First();
while (node)
{
wxObject *obj = (wxObject *)node->Data();
delete obj;
if (wxPendingDelete.Member(obj))
delete node;
node = wxPendingDelete.First();
};
};
wxWindow *wxApp::GetTopWindow(void)
{
if (m_topWindow) return m_topWindow;
wxNode *node = wxTopLevelWindows.First();
if (!node) return NULL;
return (wxWindow*)node->Data();
};
void wxApp::SetTopWindow( wxWindow *win )
{
m_topWindow = win;
};
void wxApp::CommonInit(void)
{
/*
#if USE_RESOURCES
(void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
#endif
*/
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
wxTheColourDatabase->Initialize();
wxInitializeStockObjects();
// For PostScript printing
#if USE_POSTSCRIPT
wxInitializePrintSetupData();
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
wxThePrintPaperDatabase->CreateDatabase();
#endif
/*
wxBitmap::InitStandardHandlers();
g_globalCursor = new wxCursor;
*/
wxInitializeStockObjects();
};
void wxApp::CommonCleanUp(void)
{
wxDeleteStockObjects();
wxFlushResources();
};
wxLog *wxApp::CreateLogTarget()
{
return new wxLogGui;
}
//-----------------------------------------------------------------------------
// wxEntry
//-----------------------------------------------------------------------------
int wxEntry( int argc, char *argv[] )
{
wxBuffer = new char[BUFSIZ + 512];
wxClassInfo::InitializeClasses();
#if (WXDEBUG && USE_MEMORY_TRACING) || USE_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;
};
wxAppInitializerFunction app_ini = wxApp::GetInitializerFunction();
wxObject *test_app = app_ini();
wxTheApp = (wxApp*) test_app;
// wxTheApp = (wxApp*)( app_ini() );
};
if (!wxTheApp)
{
printf( "wxWindows error: wxTheApp == NULL\n" );
return 0;
};
// printf( "Programmstart.\n" );
wxTheApp->argc = argc;
wxTheApp->argv = argv;
// Your init here !!!!
wxApp::CommonInit();
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 && USE_MEMORY_TRACING) || USE_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;
};
//-----------------------------------------------------------------------------
// main()
//-----------------------------------------------------------------------------
#if defined(AIX) || defined(AIX4) || defined(____HPUX__)
// main in IMPLEMENT_WX_MAIN in IMPLEMENT_APP in app.h
#else
int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
#endif

6
src/qt/bdiag.xbm Normal file
View File

@@ -0,0 +1,6 @@
#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};

237
src/qt/bitmap.cpp Normal file
View File

@@ -0,0 +1,237 @@
/////////////////////////////////////////////////////////////////////////////
// Name: bitmap.cpp
// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "bitmap.h"
#endif
#include "wx/bitmap.h"
//-----------------------------------------------------------------------------
// wxMask
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMask,wxObject)
wxMask::wxMask(void)
{
};
wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap), const wxColour& WXUNUSED(colour) )
{
};
wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap), int WXUNUSED(paletteIndex) )
{
};
wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap) )
{
};
wxMask::~wxMask(void)
{
};
//-----------------------------------------------------------------------------
// wxBitmap
//-----------------------------------------------------------------------------
class wxBitmapRefData: public wxObjectRefData
{
public:
wxBitmapRefData(void);
~wxBitmapRefData(void);
wxMask *m_mask;
int m_width;
int m_height;
int m_bpp;
wxPalette *m_palette;
};
wxBitmapRefData::wxBitmapRefData(void)
{
m_mask = NULL;
m_width = 0;
m_height = 0;
m_bpp = 0;
m_palette = NULL;
};
wxBitmapRefData::~wxBitmapRefData(void)
{
if (m_mask) delete m_mask;
if (m_palette) delete m_palette;
};
//-----------------------------------------------------------------------------
#define M_BMPDATA ((wxBitmapRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject)
wxBitmap::wxBitmap(void)
{
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
};
wxBitmap::wxBitmap( int width, int height, int depth )
{
m_refData = new wxBitmapRefData();
M_BMPDATA->m_mask = NULL;
M_BMPDATA->m_width = width;
M_BMPDATA->m_height = height;
M_BMPDATA->m_bpp = depth;
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
};
wxBitmap::wxBitmap( char **WXUNUSED(bits) )
{
m_refData = new wxBitmapRefData();
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
};
wxBitmap::wxBitmap( const wxBitmap& bmp )
{
Ref( bmp );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
};
wxBitmap::wxBitmap( const wxBitmap* bmp )
{
if (bmp) Ref( *bmp );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
};
wxBitmap::wxBitmap( const wxString &filename, int type )
{
LoadFile( filename, type );
};
wxBitmap::wxBitmap( const char WXUNUSED(bits)[], int width, int height, int WXUNUSED(depth))
{
m_refData = new wxBitmapRefData();
M_BMPDATA->m_mask = NULL;
M_BMPDATA->m_width = width;
M_BMPDATA->m_height = height;
M_BMPDATA->m_bpp = 1;
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
}
wxBitmap::~wxBitmap(void)
{
if (wxTheBitmapList) wxTheBitmapList->DeleteObject(this);
};
wxBitmap& wxBitmap::operator = ( const wxBitmap& bmp )
{
if (*this == bmp) return (*this);
Ref( bmp );
return *this;
};
bool wxBitmap::operator == ( const wxBitmap& bmp )
{
return m_refData == bmp.m_refData;
};
bool wxBitmap::operator != ( const wxBitmap& bmp )
{
return m_refData != bmp.m_refData;
};
bool wxBitmap::Ok(void) const
{
return m_refData != NULL;
};
int wxBitmap::GetHeight(void) const
{
if (!Ok()) return 0;
return M_BMPDATA->m_height;
};
int wxBitmap::GetWidth(void) const
{
if (!Ok()) return 0;
return M_BMPDATA->m_width;
};
int wxBitmap::GetDepth(void) const
{
if (!Ok()) return 0;
return M_BMPDATA->m_bpp;
};
void wxBitmap::SetHeight( int height )
{
if (!Ok()) return;
M_BMPDATA->m_height = height;
};
void wxBitmap::SetWidth( int width )
{
if (!Ok()) return;
M_BMPDATA->m_width = width;
};
void wxBitmap::SetDepth( int depth )
{
if (!Ok()) return;
M_BMPDATA->m_bpp = depth;
};
wxMask *wxBitmap::GetMask(void) const
{
if (!Ok()) return NULL;
return M_BMPDATA->m_mask;
};
void wxBitmap::SetMask( wxMask *mask )
{
if (!Ok()) return;
if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask;
M_BMPDATA->m_mask = mask;
};
void wxBitmap::Resize( int WXUNUSED(height), int WXUNUSED(width) )
{
if (!Ok()) return;
};
bool wxBitmap::SaveFile( const wxString &WXUNUSED(name), int WXUNUSED(type),
wxPalette *WXUNUSED(palette) )
{
return FALSE;
};
bool wxBitmap::LoadFile( const wxString &WXUNUSED(name), int WXUNUSED(type) )
{
return FALSE;
};
wxPalette *wxBitmap::GetPalette(void) const
{
if (!Ok()) return NULL;
return M_BMPDATA->m_palette;
};

78
src/qt/bmpbuttn.cpp Normal file
View File

@@ -0,0 +1,78 @@
/////////////////////////////////////////////////////////////////////////////
// Name: bmpbuttn.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 "bmpbuttn.h"
#endif
#include "wx/bmpbuttn.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxBitmapButton;
//-----------------------------------------------------------------------------
// wxBitmapButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
wxBitmapButton::wxBitmapButton(void)
{
};
wxBitmapButton::wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, bitmap, pos, size, style, name );
};
bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
m_needParent = TRUE;
wxSize newSize = size;
PreCreation( parent, id, pos, newSize, style, name );
m_bitmap = bitmap;
m_label = "";
if (newSize.x == -1) newSize.x = m_bitmap.GetHeight()+10;
if (newSize.y == -1) newSize.y = m_bitmap.GetWidth()+10;
SetSize( newSize.x, newSize.y );
PostCreation();
Show( TRUE );
return TRUE;
};
void wxBitmapButton::SetDefault(void)
{
};
void wxBitmapButton::SetLabel( const wxString &label )
{
wxControl::SetLabel( label );
};
wxString wxBitmapButton::GetLabel(void) const
{
return wxControl::GetLabel();
};

132
src/qt/brush.cpp Normal file
View File

@@ -0,0 +1,132 @@
/////////////////////////////////////////////////////////////////////////////
// Name: brush.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 "brush.h"
#endif
#include "wx/brush.h"
//-----------------------------------------------------------------------------
// wxBrush
//-----------------------------------------------------------------------------
class wxBrushRefData: public wxObjectRefData
{
public:
wxBrushRefData(void);
int m_style;
wxBitmap m_stipple;
wxColour m_colour;
};
wxBrushRefData::wxBrushRefData(void)
{
m_style = 0;
};
//-----------------------------------------------------------------------------
#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
wxBrush::wxBrush(void)
{
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
};
wxBrush::wxBrush( const wxColour &colour, int style )
{
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = style;
M_BRUSHDATA->m_colour = colour;
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
};
wxBrush::wxBrush( const wxString &colourName, int style )
{
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = style;
M_BRUSHDATA->m_colour = colourName;
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
};
wxBrush::wxBrush( const wxBitmap &stippleBitmap )
{
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = wxSTIPPLE;
M_BRUSHDATA->m_colour = *wxBLACK;
M_BRUSHDATA->m_stipple = stippleBitmap;
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
};
wxBrush::wxBrush( const wxBrush &brush )
{
Ref( brush );
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
};
wxBrush::wxBrush( const wxBrush *brush )
{
if (brush) Ref( *brush );
if (wxTheBrushList) wxTheBrushList->Append( this );
};
wxBrush::~wxBrush(void)
{
if (wxTheBrushList) wxTheBrushList->RemoveBrush( this );
};
wxBrush& wxBrush::operator = ( const wxBrush& brush )
{
if (*this == brush) return (*this);
Ref( brush );
return *this;
};
bool wxBrush::operator == ( const wxBrush& brush )
{
return m_refData == brush.m_refData;
};
bool wxBrush::operator != ( const wxBrush& brush )
{
return m_refData != brush.m_refData;
};
bool wxBrush::Ok(void) const
{
return ((m_refData) && M_BRUSHDATA->m_colour.Ok());
};
int wxBrush::GetStyle(void) const
{
return M_BRUSHDATA->m_style;
};
wxColour &wxBrush::GetColour(void) const
{
return M_BRUSHDATA->m_colour;
};
wxBitmap *wxBrush::GetStipple(void) const
{
return &M_BRUSHDATA->m_stipple;
};

61
src/qt/button.cpp Normal file
View File

@@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////
// Name: button.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 "button.h"
#endif
#include "wx/button.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxButton;
//-----------------------------------------------------------------------------
// wxButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
//-----------------------------------------------------------------------------
wxButton::wxButton(void)
{
};
wxButton::wxButton( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
};
bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
return TRUE;
};
void wxButton::SetDefault(void)
{
};
void wxButton::SetLabel( const wxString &label )
{
wxControl::SetLabel( label );
};
wxString wxButton::GetLabel(void) const
{
return wxControl::GetLabel();
};

6
src/qt/cdiag.xbm Normal file
View File

@@ -0,0 +1,6 @@
#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};

50
src/qt/checkbox.cpp Normal file
View File

@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////
// Name: checkbox.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 "checkbox.h"
#endif
#include "wx/checkbox.h"
//-----------------------------------------------------------------------------
// wxCheckBox
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxCheckBox,wxControl)
wxCheckBox::wxCheckBox(void)
{
};
wxCheckBox::wxCheckBox( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
};
bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
return TRUE;
};
void wxCheckBox::SetValue( bool WXUNUSED(state) )
{
};
bool wxCheckBox::GetValue(void) const
{
return FALSE;
};

97
src/qt/choice.cpp Normal file
View File

@@ -0,0 +1,97 @@
/////////////////////////////////////////////////////////////////////////////
// Name: choice.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 "choice.h"
#endif
#include "wx/choice.h"
//-----------------------------------------------------------------------------
// wxChoice
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl)
wxChoice::wxChoice(void)
{
};
wxChoice::wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxString &name )
{
Create( parent, id, pos, size, n, choices, style, name );
};
bool wxChoice::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxString &name )
{
return TRUE;
};
void wxChoice::Append( const wxString &WXUNUSED(item) )
{
};
void wxChoice::Clear(void)
{
};
int wxChoice::FindString( const wxString &WXUNUSED(string) ) const
{
return -1;
};
int wxChoice::GetColumns(void) const
{
return 1;
};
int wxChoice::GetSelection(void)
{
return -1;
};
wxString wxChoice::GetString( int WXUNUSED(n) ) const
{
return "";
};
wxString wxChoice::GetStringSelection(void) const
{
return "";
};
int wxChoice::Number(void) const
{
return 0;
};
void wxChoice::SetColumns( int WXUNUSED(n) )
{
};
void wxChoice::SetSelection( int WXUNUSED(n) )
{
};
void wxChoice::SetStringSelection( const wxString &string )
{
int n = FindString( string );
if (n != -1) SetSelection( n );
};

164
src/qt/colour.cpp Normal file
View File

@@ -0,0 +1,164 @@
/////////////////////////////////////////////////////////////////////////////
// Name: colour.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 "colour.h"
#endif
#include "wx/gdicmn.h"
//-----------------------------------------------------------------------------
// wxColour
//-----------------------------------------------------------------------------
class wxColourRefData: public wxObjectRefData
{
public:
wxColourRefData(void);
~wxColourRefData(void);
void FreeColour(void);
bool m_hasPixel;
friend wxColour;
};
wxColourRefData::wxColourRefData(void)
{
m_hasPixel = FALSE;
};
wxColourRefData::~wxColourRefData(void)
{
FreeColour();
};
void wxColourRefData::FreeColour(void)
{
};
//-----------------------------------------------------------------------------
#define M_COLDATA ((wxColourRefData *)m_refData)
#define SHIFT (8*(sizeof(short int)-sizeof(char)))
IMPLEMENT_DYNAMIC_CLASS(wxColour,wxGDIObject)
wxColour::wxColour(void)
{
};
wxColour::wxColour( char WXUNUSED(red), char WXUNUSED(green), char WXUNUSED(blue) )
{
m_refData = new wxColourRefData();
};
wxColour::wxColour( const wxString &colourName )
{
wxNode *node = NULL;
if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
{
wxColour *col = (wxColour*)node->Data();
UnRef();
if (col) Ref( *col );
}
else
{
m_refData = new wxColourRefData();
};
};
wxColour::wxColour( const wxColour& col )
{
Ref( col );
};
wxColour::wxColour( const wxColour* col )
{
if (col) Ref( *col );
};
wxColour::~wxColour(void)
{
};
wxColour& wxColour::operator = ( const wxColour& col )
{
if (*this == col) return (*this);
Ref( col );
return *this;
};
wxColour& wxColour::operator = ( const wxString& colourName )
{
UnRef();
wxNode *node = NULL;
if ((wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
{
wxColour *col = (wxColour*)node->Data();
if (col) Ref( *col );
}
else
{
m_refData = new wxColourRefData();
};
return *this;
};
bool wxColour::operator == ( const wxColour& col )
{
return m_refData == col.m_refData;
};
bool wxColour::operator != ( const wxColour& col)
{
return m_refData != col.m_refData;
};
void wxColour::Set( const unsigned char WXUNUSED(red), const unsigned char WXUNUSED(green),
const unsigned char WXUNUSED(blue) )
{
UnRef();
m_refData = new wxColourRefData();
};
unsigned char wxColour::Red(void) const
{
if (!Ok()) return 0;
return 0;
};
unsigned char wxColour::Green(void) const
{
if (!Ok()) return 0;
return 0;
};
unsigned char wxColour::Blue(void) const
{
if (!Ok()) return 0;
return 0;
};
bool wxColour::Ok(void) const
{
return (m_refData);
return 0;
};
int wxColour::GetPixel(void)
{
if (!Ok()) return 0;
return 0;
};

149
src/qt/combobox.cpp Normal file
View File

@@ -0,0 +1,149 @@
/////////////////////////////////////////////////////////////////////////////
// Name: combobox.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 "combobox.h"
#endif
#include "wx/combobox.h"
//-----------------------------------------------------------------------------
// wxComboBox
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
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 wxString& name )
{
return TRUE;
};
void wxComboBox::Clear(void)
{
};
void wxComboBox::Append( const wxString &item )
{
Append( item, (char*)NULL );
};
void wxComboBox::Append( const wxString &WXUNUSED(item), char *WXUNUSED(clientData) )
{
};
void wxComboBox::Delete( int WXUNUSED(n) )
{
};
int wxComboBox::FindString( const wxString &WXUNUSED(item) )
{
return -1;
};
char* wxComboBox::GetClientData( int WXUNUSED(n) )
{
return (char*)NULL;
};
void wxComboBox::SetClientData( int WXUNUSED(n), char *WXUNUSED(clientData) )
{
};
int wxComboBox::GetSelection(void) const
{
return -1;
};
wxString wxComboBox::GetString( int WXUNUSED(n) ) const
{
return "";
};
wxString wxComboBox::GetStringSelection(void) const
{
return "";
};
int wxComboBox::Number(void) const
{
return 0;
};
void wxComboBox::SetSelection( int WXUNUSED(n) )
{
};
void wxComboBox::SetStringSelection( const wxString &string )
{
int res = FindString( string );
if (res == -1) return;
SetSelection( res );
};
wxString wxComboBox::GetValue(void) const
{
return "";
};
void wxComboBox::SetValue( const wxString& WXUNUSED(value) )
{
};
void wxComboBox::Copy(void)
{
};
void wxComboBox::Cut(void)
{
};
void wxComboBox::Paste(void)
{
};
void wxComboBox::SetInsertionPoint( long WXUNUSED(pos) )
{
};
void wxComboBox::SetInsertionPointEnd(void)
{
};
long wxComboBox::GetInsertionPoint(void) const
{
return 0;
};
long wxComboBox::GetLastPosition(void) const
{
return 0;
};
void wxComboBox::Replace( long WXUNUSED(from), long WXUNUSED(to), const wxString& WXUNUSED(value) )
{
};
void wxComboBox::Remove(long WXUNUSED(from), long WXUNUSED(to) )
{
};
void wxComboBox::SetSelection( long WXUNUSED(from), long WXUNUSED(to) )
{
};
void wxComboBox::SetEditable( bool WXUNUSED(editable) )
{
};

59
src/qt/control.cpp Normal file
View File

@@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////
// Name: control.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 "control.h"
#endif
#include "wx/control.h"
//-----------------------------------------------------------------------------
// wxControl
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxControl,wxWindow)
wxControl::wxControl(void)
{
};
wxControl::wxControl( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) :
wxWindow( parent, id, pos, size, style, name )
{
};
void wxControl::Command( wxCommandEvent &WXUNUSED(event) )
{
};
void wxControl::SetLabel( const wxString &label )
{
for ( const char *pc = label; *pc != '\0'; pc++ ) {
if ( *pc == '&' ) {
pc++; // skip it
#if 0 // it would be unused anyhow for now - kbd interface not done yet
if ( *pc != '&' )
m_chAccel = *pc;
#endif
}
m_label << *pc;
}
};
wxString wxControl::GetLabel(void) const
{
return m_label;
};

6
src/qt/cross.xbm Normal file
View File

@@ -0,0 +1,6 @@
#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};

120
src/qt/cursor.cpp Normal file
View File

@@ -0,0 +1,120 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cursor.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 "cursor.h"
#endif
#include "wx/cursor.h"
//-----------------------------------------------------------------------------
// wxCursor
//-----------------------------------------------------------------------------
class wxCursorRefData: public wxObjectRefData
{
public:
wxCursorRefData(void);
~wxCursorRefData(void);
};
wxCursorRefData::wxCursorRefData(void)
{
};
wxCursorRefData::~wxCursorRefData(void)
{
};
//-----------------------------------------------------------------------------
#define M_CURSORDATA ((wxCursorRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxCursor,wxObject)
wxCursor::wxCursor(void)
{
};
wxCursor::wxCursor( int WXUNUSED(cursorId) )
{
m_refData = new wxCursorRefData();
};
wxCursor::wxCursor( const wxCursor &cursor )
{
Ref( cursor );
};
wxCursor::wxCursor( const wxCursor *cursor )
{
UnRef();
if (cursor) Ref( *cursor );
};
wxCursor::~wxCursor(void)
{
};
wxCursor& wxCursor::operator = ( const wxCursor& cursor )
{
if (*this == cursor) return (*this);
Ref( cursor );
return *this;
};
bool wxCursor::operator == ( const wxCursor& cursor )
{
return m_refData == cursor.m_refData;
};
bool wxCursor::operator != ( const wxCursor& cursor )
{
return m_refData != cursor.m_refData;
};
bool wxCursor::Ok(void) const
{
return TRUE;
};
//-----------------------------------------------------------------------------
// busy cursor routines
//-----------------------------------------------------------------------------
bool g_isBusy = FALSE;
void wxEndBusyCursor(void)
{
g_isBusy = FALSE;
};
void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
{
g_isBusy = TRUE;
};
bool wxIsBusy(void)
{
return g_isBusy;
};
void wxSetCursor( const wxCursor& cursor )
{
extern wxCursor *g_globalCursor;
if (g_globalCursor) (*g_globalCursor) = cursor;
if (cursor.Ok()) {};
};

711
src/qt/data.cpp Normal file
View File

@@ -0,0 +1,711 @@
/////////////////////////////////////////////////////////////////////////////
// Name: data.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
#endif
#include "wx/wx.h"
#define _MAXPATHLEN 500
// Used for X resources
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
wxList wxResourceCache(wxKEY_STRING);
XrmDatabase wxResourceDatabase;
// Useful buffer, initialized in wxCommonInit
char *wxBuffer = NULL;
// Windows List
wxList wxTopLevelWindows;
// List of windows pending deletion
wxList wxPendingDelete;
// Current cursor, in order to hang on to
// cursor handle when setting the cursor globally
wxCursor *g_globalCursor = NULL;
// Don't allow event propagation during drag
bool g_blockEventsOnDrag = FALSE;
// Message Strings for Internationalization
char **wx_msg_str = (char**)NULL;
// Custom OS version, as optionally placed in wx.ini/.wxrc
// Currently this can be Win95, Windows, Win32s, WinNT.
// For some systems, you can't tell until run-time what services you
// have. See wxGetOsVersion, which uses this string if present.
char *wxOsVersion = NULL;
// For printing several pages
int wxPageNumber;
wxPrintPaperDatabase* wxThePrintPaperDatabase = NULL;
// GDI Object Lists
wxBrushList *wxTheBrushList = NULL;
wxPenList *wxThePenList = NULL;
wxFontList *wxTheFontList = NULL;
wxColourDatabase *wxTheColourDatabase = NULL;
wxBitmapList *wxTheBitmapList = NULL;
// X only font names
// wxFontNameDirectory wxTheFontNameDirectory;
// 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 *wxGREY; // Robert Roebling
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
wxBitmap wxNullBitmap;
wxIcon wxNullIcon;
wxCursor wxNullCursor;
wxPen wxNullPen;
wxBrush wxNullBrush;
wxFont wxNullFont;
wxColour wxNullColour;
wxPalette wxNullPalette;
// 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";
#ifdef wx_msw
const char *wxUserResourceStr = "TEXT";
#endif
#if USE_SHARED_LIBRARY
/*
* For wxWindows to be made into a dynamic library (e.g. Sun),
* all IMPLEMENT_... macros must be in one place.
* But normally, the definitions are in the appropriate places.
*/
// Hand-coded IMPLEMENT... macro for wxObject (define static data)
wxClassInfo wxObject::classwxObject("wxObject", NULL, NULL, sizeof(wxObject), NULL);
wxClassInfo *wxClassInfo::first = NULL;
#include "wx/button.h"
#include "wx/bmpbuttn.h"
IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
#include "wx/checkbox.h"
IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
#include "wx/choice.h"
IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
#if USE_CLIPBOARD
#include "wx/clipbrd.h"
IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxClipboardClient, wxObject)
#endif
#if USE_COMBOBOX
#include "wx/combobox.h"
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
#endif
#include "wx/dc.h"
#include "wx/dcmemory.h"
#include "wx/dcclient.h"
#include "wx/dcscreen.h"
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
#if defined(wx_msw)
#include "wx/dcprint.h"
IMPLEMENT_CLASS(wxPrinterDC, wxDC)
#endif
#include "wx/dialog.h"
IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxWindow)
#include "wx/frame.h"
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
#include "wx/mdi.h"
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
#include "wx/cmndata.h"
IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject)
#include "wx/colordlg.h"
#include "wx/fontdlg.h"
#if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW
#include "wx/generic/colordlg.h"
#include "wx/generic/fontdlg.h"
IMPLEMENT_DYNAMIC_CLASS(wxGenericColourDialog, wxDialog)
IMPLEMENT_DYNAMIC_CLASS(wxGenericFontDialog, wxDialog)
#endif
// X defines wxColourDialog to be wxGenericColourDialog
#ifndef wx_x
IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
#endif
#include "wx/gdicmn.h"
#include "wx/pen.h"
#include "wx/brush.h"
#include "wx/font.h"
#include "wx/palette.h"
#include "wx/icon.h"
#include "wx/cursor.h"
IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
IMPLEMENT_CLASS(wxColourDatabase, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
/*
#if (!USE_TYPEDEFS)
IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxIntPoint, wxObject)
#endif
*/
#if defined(wx_x) || (defined(wx_msw) && USE_PORTABLE_FONTS_IN_MSW)
IMPLEMENT_DYNAMIC_CLASS(wxFontNameDirectory, wxObject)
#endif
#include "wx/hash.h"
IMPLEMENT_DYNAMIC_CLASS(wxHashTable, wxObject)
#include "wx/help.h"
IMPLEMENT_DYNAMIC_CLASS(wxHelpInstance, wxClient)
IMPLEMENT_CLASS(wxHelpConnection, wxConnection)
#include "wx/list.h"
IMPLEMENT_DYNAMIC_CLASS(wxNode, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxList, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxStringList, wxList)
#if USE_PRINTING_ARCHITECTURE
#include "wx/print.h"
IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
IMPLEMENT_DYNAMIC_CLASS(wxPrinterBase, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase)
IMPLEMENT_DYNAMIC_CLASS(wxWindowsPrinter, wxPrinterBase)
IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject)
IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow)
IMPLEMENT_CLASS(wxPreviewControlBar, wxWindow)
IMPLEMENT_CLASS(wxPreviewFrame, wxFrame)
IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject)
IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase)
IMPLEMENT_CLASS(wxWindowsPrintPreview, wxPrintPreviewBase)
IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog)
IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog)
#endif
#if USE_POSTSCRIPT
#include "wx/postscrp.h"
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxPrintSetupData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPageSetupData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
#endif
#if USE_WX_RESOURCES
#include "wx/resource.h"
IMPLEMENT_DYNAMIC_CLASS(wxItemResource, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable)
#endif
#include "wx/event.h"
IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxSizeEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxPaintEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMenuEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxJoystickEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxDropFilesEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxActivateEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxProcessEvent, wxEvent)
#include "wx/utils.h"
IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxList)
// IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
#include "wx/process.h"
IMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler)
#if USE_TIMEDATE
#include "wx/date.h"
IMPLEMENT_DYNAMIC_CLASS(wxDate, wxObject)
#endif
#if USE_DOC_VIEW_ARCHITECTURE
#include "wx/docview.h"
//IMPLEMENT_ABSTRACT_CLASS(wxDocItem, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxDocument, wxEvtHandler)
IMPLEMENT_ABSTRACT_CLASS(wxView, wxEvtHandler)
IMPLEMENT_ABSTRACT_CLASS(wxDocTemplate, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxDocManager, wxEvtHandler)
IMPLEMENT_CLASS(wxDocChildFrame, wxFrame)
IMPLEMENT_CLASS(wxDocParentFrame, wxFrame)
#if USE_PRINTING_ARCHITECTURE
IMPLEMENT_DYNAMIC_CLASS(wxDocPrintout, wxPrintout)
#endif
IMPLEMENT_CLASS(wxCommand, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxCommandProcessor, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject)
#endif
#if USE_CONSTRAINTS
#include "wx/layout.h"
IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxSizer, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxRowColSizer, wxSizer)
#endif
#if USE_TOOLBAR
#include "wx/tbarbase.h"
IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxToolBarBase, wxControl)
#include "wx/tbarsmpl.h"
IMPLEMENT_DYNAMIC_CLASS(wxToolBarSimple, wxToolBarBase)
#ifdef wx_msw
#include "wx/tbarmsw.h"
IMPLEMENT_DYNAMIC_CLASS(wxToolBarMSW, wxToolBarBase)
#include "wx/tbar95.h"
IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase)
#endif
#endif
#include "wx/statusbr.h"
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow)
BEGIN_EVENT_TABLE(wxStatusBar, wxWindow)
EVT_PAINT(wxStatusBar::OnPaint)
EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged)
END_EVENT_TABLE()
#if USE_TIMEDATE
#include "wx/time.h"
IMPLEMENT_DYNAMIC_CLASS(wxTime, wxObject)
#endif
#if !USE_GNU_WXSTRING
#include "wx/string.h"
IMPLEMENT_DYNAMIC_CLASS(wxString, wxObject)
#endif
#ifdef wx_motif
IMPLEMENT_DYNAMIC_CLASS(wxXColormap, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxXFont, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxXCursor, wxObject)
#endif
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
// This will presumably be implemented on other platforms too
#ifdef wx_msw
IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxICOFileHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxICOResourceHandler, wxBitmapHandler)
#endif
#include "wx/statbox.h"
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
#if USE_IPC
#include "wx/dde.h"
IMPLEMENT_ABSTRACT_CLASS(wxDDEObject, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxDDEServer, wxDDEObject)
IMPLEMENT_DYNAMIC_CLASS(wxDDEClient, wxDDEObject)
IMPLEMENT_CLASS(wxDDEConnection, wxObject)
#endif
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
#include "wx/listbox.h"
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
#include "wx/menu.h"
IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxWindow)
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
#include "wx/stattext.h"
#include "wx/statbmp.h"
IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
#if USE_METAFILE
#include "wx/metafile.h"
IMPLEMENT_DYNAMIC_CLASS(wxMetaFile, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxMetaFileDC, wxDC)
#endif
#include "wx/radiobox.h"
#include "wx/radiobut.h"
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
// IMPLEMENT_DYNAMIC_CLASS(wxBitmapRadioButton, wxRadioButton)
#include "wx/scrolbar.h"
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
#if WXWIN_COMPATIBILITY
BEGIN_EVENT_TABLE(wxScrollBar, wxControl)
EVT_SCROLL(wxScrollBar::OnScroll)
END_EVENT_TABLE()
#endif
#include "wx/slider.h"
IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
#if WXWIN_COMPATIBILITY
BEGIN_EVENT_TABLE(wxSlider, wxControl)
EVT_SCROLL(wxSlider::OnScroll)
END_EVENT_TABLE()
#endif
#include "wx/timer.h"
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
#include "wx/textctrl.h"
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
#include "wx/window.h"
IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler)
#include "wx/scrolwin.h"
IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxWindow)
#include "wx/panel.h"
IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow)
#include "wx/msgbxdlg.h"
#include "wx/textdlg.h"
#include "wx/filedlg.h"
#include "wx/dirdlg.h"
#include "wx/choicdlg.h"
#if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW
#include "wx/generic/msgdlgg.h"
IMPLEMENT_CLASS(wxGenericMessageDialog, wxDialog)
#endif
IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog)
IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog)
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
IMPLEMENT_CLASS(wxDirDialog, wxDialog)
#ifdef wx_msw
IMPLEMENT_CLASS(wxMessageDialog)
#endif
#if USE_GAUGE
#ifdef wx_motif
#include "../../contrib/xmgauge/gauge.h"
#endif
#include "wx_gauge.h"
IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
#endif
#include "wx/grid.h"
IMPLEMENT_DYNAMIC_CLASS(wxGenericGrid, wxPanel)
///// 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 } };
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_ACTIVATE(wxFrame::OnActivate)
EVT_SIZE(wxFrame::OnSize)
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
EVT_IDLE(wxFrame::OnIdle)
EVT_CLOSE(wxFrame::OnCloseWindow)
END_EVENT_TABLE()
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()
BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler)
EVT_CHAR(wxWindow::OnChar)
EVT_SIZE(wxWindow::Size)
EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground)
EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
EVT_INIT_DIALOG(wxWindow::OnInitDialog)
EVT_IDLE(wxWindow::OnIdle)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxScrolledWindow, wxWindow)
EVT_SCROLL(wxScrolledWindow::OnScroll)
EVT_SIZE(wxScrolledWindow::OnSize)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxPanel, wxWindow)
EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
END_EVENT_TABLE()
#ifdef wx_msw
BEGIN_EVENT_TABLE(wxMDIParentWindow, wxFrame)
EVT_SIZE(wxMDIParentWindow::OnSize)
EVT_ACTIVATE(wxMDIParentWindow::OnActivate)
EVT_SYS_COLOUR_CHANGED(wxMDIParentWindow::OnSysColourChanged)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
EVT_SCROLL(wxMDIClientWindow::OnScroll)
END_EVENT_TABLE()
#endif
BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
EVT_SCROLL(wxToolBarBase::OnScroll)
EVT_SIZE(wxToolBarBase::OnSize)
EVT_IDLE(wxToolBarBase::OnIdle)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase)
EVT_SIZE(wxToolBarSimple::OnSize)
EVT_PAINT(wxToolBarSimple::OnPaint)
EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus)
EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent)
END_EVENT_TABLE()
#ifdef wx_msw
BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase)
EVT_SIZE(wxToolBarMSW::OnSize)
EVT_PAINT(wxToolBarMSW::OnPaint)
EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase)
EVT_SIZE(wxToolBar95::OnSize)
EVT_PAINT(wxToolBar95::OnPaint)
EVT_KILL_FOCUS(wxToolBar95::OnKillFocus)
EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent)
EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged)
END_EVENT_TABLE()
#endif
BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
EVT_SIZE(wxGenericGrid::OnSize)
EVT_PAINT(wxGenericGrid::OnPaint)
EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent)
EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText)
EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll)
EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxControl, wxWindow)
EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground)
END_EVENT_TABLE()
#if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW
BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog)
EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes)
EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo)
EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog)
EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom)
EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider)
EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider)
EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider)
EVT_PAINT(wxGenericColourDialog::OnPaint)
EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog)
EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont)
EVT_PAINT(wxGenericFontDialog::OnPaint)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK)
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup)
EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange)
END_EVENT_TABLE()
#endif
BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK)
END_EVENT_TABLE()
#include "wx/prntbase.h"
BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow)
EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose)
EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
END_EVENT_TABLE()
#endif
const wxSize wxDefaultSize(-1, -1);
const wxPoint wxDefaultPosition(-1, -1);

393
src/qt/dc.cpp Normal file
View File

@@ -0,0 +1,393 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dc.cpp
// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "dc.h"
#endif
#include "wx/dc.h"
//-----------------------------------------------------------------------------
// 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 = MM_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::DrawArc( long WXUNUSED(x1), long WXUNUSED(y1), long WXUNUSED(x2), long WXUNUSED(y2),
double WXUNUSED(xc), double WXUNUSED(yc) )
{
};
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 MM_TWIPS:
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
break;
case MM_POINTS:
SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
break;
case MM_METRIC:
SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
break;
case MM_LOMETRIC:
SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
break;
default:
case MM_TEXT:
SetLogicalScale( 1.0, 1.0 );
break;
};
if (mode != MM_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);
}
};

627
src/qt/dcclient.cpp Normal file
View File

@@ -0,0 +1,627 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcclient.cpp
// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "dcclient.h"
#endif
#include "wx/dcclient.h"
#include "wx/dcmemory.h"
#include <math.h>
//-----------------------------------------------------------------------------
// local data
//-----------------------------------------------------------------------------
#include "bdiag.xbm"
#include "fdiag.xbm"
#include "cdiag.xbm"
#include "horiz.xbm"
#include "verti.xbm"
#include "cross.xbm"
#define num_hatches 6
//-----------------------------------------------------------------------------
// constants
//-----------------------------------------------------------------------------
#define RAD2DEG 57.2957795131
//-----------------------------------------------------------------------------
// wxPaintDC
//-----------------------------------------------------------------------------
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 );
};

63
src/qt/dcmemory.cpp Normal file
View File

@@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcmemory.cpp
// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "dcmemory.h"
#endif
#include "wx/dcmemory.h"
//-----------------------------------------------------------------------------
// 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;
};
};

47
src/qt/dcscreen.cpp Normal file
View File

@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcscreen.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 "dcscreen.h"
#endif
#include "wx/dcscreen.h"
#include "wx/window.h"
//-----------------------------------------------------------------------------
// wxScreenDC
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
wxScreenDC::wxScreenDC(void)
{
m_ok = FALSE;
};
wxScreenDC::~wxScreenDC(void)
{
EndDrawingOnTop();
};
bool wxScreenDC::StartDrawingOnTop( wxWindow *WXUNUSED(window) )
{
return TRUE;
};
bool wxScreenDC::StartDrawingOnTop( wxRectangle *WXUNUSED(rect) )
{
return TRUE;
};
bool wxScreenDC::EndDrawingOnTop(void)
{
return TRUE;
};

191
src/qt/dialog.cpp Normal file
View File

@@ -0,0 +1,191 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog.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 "dialog.h"
#endif
#include "wx/dialog.h"
#include "wx/frame.h"
#include "wx/app.h"
//-----------------------------------------------------------------------------
extern wxList wxPendingDelete;
//-----------------------------------------------------------------------------
// wxDialog
//-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxDialog,wxWindow)
EVT_BUTTON (wxID_OK, wxDialog::OnOk)
EVT_BUTTON (wxID_CANCEL, wxDialog::OnCancel)
EVT_BUTTON (wxID_APPLY, wxDialog::OnApply)
EVT_CLOSE (wxDialog::OnCloseWindow)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxWindow)
wxDialog::wxDialog(void)
{
m_title = "";
m_modalShowing = FALSE;
wxTopLevelWindows.Insert( this );
};
wxDialog::wxDialog( wxWindow *parent,
wxWindowID id, const wxString &title,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
m_modalShowing = FALSE;
wxTopLevelWindows.Insert( this );
Create( parent, id, title, pos, size, style, name );
};
bool wxDialog::Create( wxWindow *parent,
wxWindowID id, const wxString &title,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
return TRUE;
};
wxDialog::~wxDialog(void)
{
wxTopLevelWindows.DeleteObject( this );
if (wxTopLevelWindows.Number() == 0) wxTheApp->ExitMainLoop();
};
void wxDialog::SetTitle(const wxString& title )
{
m_title = title;
};
wxString wxDialog::GetTitle(void) const
{
return (wxString&)m_title;
};
void wxDialog::OnApply( wxCommandEvent &WXUNUSED(event) )
{
if (Validate()) TransferDataFromWindow();
};
void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) )
{
if (IsModal())
{
EndModal(wxID_CANCEL);
}
else
{
SetReturnCode(wxID_CANCEL);
this->Show(FALSE);
};
};
void wxDialog::OnOk( wxCommandEvent &WXUNUSED(event) )
{
if ( Validate() && TransferDataFromWindow())
{
if (IsModal())
{
EndModal(wxID_OK);
}
else
{
SetReturnCode(wxID_OK);
this->Show(FALSE);
};
};
};
void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
// yes
};
bool wxDialog::OnClose(void)
{
static wxList closing;
if (closing.Member(this)) return FALSE; // no loops
closing.Append(this);
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
cancelEvent.SetEventObject( this );
GetEventHandler()->ProcessEvent(cancelEvent);
closing.DeleteObject(this);
return FALSE;
}
bool wxDialog::Destroy(void)
{
if (!wxPendingDelete.Member(this))
wxPendingDelete.Append(this);
return TRUE;
}
void wxDialog::OnCloseWindow(wxCloseEvent& event)
{
if (GetEventHandler()->OnClose() || event.GetForce())
{
this->Destroy();
};
};
bool wxDialog::Show( bool show )
{
if (!show && IsModal() && m_modalShowing)
{
EndModal( wxID_CANCEL );
};
wxWindow::Show( show );
if (show) InitDialog();
return TRUE;
};
int wxDialog::ShowModal(void)
{
if (m_modalShowing) return GetReturnCode();
Show( TRUE );
m_modalShowing = TRUE;
// grab here
// main here
// release here
return GetReturnCode();
};
void wxDialog::EndModal( int retCode )
{
SetReturnCode( retCode );
if (!m_modalShowing) return;
m_modalShowing = FALSE;
// quit main
};
void wxDialog::InitDialog(void)
{
wxWindow::InitDialog();
};

123
src/qt/dnd.cpp Normal file
View File

@@ -0,0 +1,123 @@
///////////////////////////////////////////////////////////////////////////////
// Name: dnd.cpp
// Purpose: wxDropTarget class
// Author: Robert Roebling
// Copyright: Robert Roebling
// Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "dnd.h"
#endif
#include "wx/dnd.h"
#include "wx/window.h"
#include "wx/app.h"
#include "wx/gdicmn.h"
// ----------------------------------------------------------------------------
// global
// ----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
// ----------------------------------------------------------------------------
// 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
//-------------------------------------------------------------------------
wxDropSource::wxDropSource( wxWindow *WXUNUSED(win) )
{
g_blockEventsOnDrag = TRUE;
};
wxDropSource::wxDropSource( wxDataObject &data, wxWindow *WXUNUSED(win) )
{
g_blockEventsOnDrag = TRUE;
m_data = &data;
};
void wxDropSource::SetData( wxDataObject &data )
{
m_data = &data;
};
wxDropSource::~wxDropSource(void)
{
// if (m_data) delete m_data;
g_blockEventsOnDrag = FALSE;
};
wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
{
return Copy;
};

6
src/qt/fdiag.xbm Normal file
View File

@@ -0,0 +1,6 @@
#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};

125
src/qt/filedlg.cpp Normal file
View File

@@ -0,0 +1,125 @@
/////////////////////////////////////////////////////////////////////////////
// Name: filedlg.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 "filedlg.h"
#endif
#include "wx/filedlg.h"
#include "wx/utils.h"
#include "wx/intl.h"
#include "wx/generic/msgdlgg.h"
//-----------------------------------------------------------------------------
// wxFileDialog
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog)
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_path = "";
m_fileName = defaultFileName;
m_dir = defaultDir;
m_wildCard = wildCard;
m_dialogStyle = style;
m_filterIndex = 1;
m_path.Append(m_dir);
if(! m_path.IsEmpty() && m_path.Last()!='/') m_path.Append('/');
m_path.Append(m_fileName);
};
int wxFileDialog::ShowModal(void)
{
int ret = wxDialog::ShowModal();
if (ret == wxID_OK)
{
};
return ret;
};
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)
{
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* wxLoadFileSelector(const char *what, const char *extension, const char *default_name,
wxWindow *parent )
{
char *ext = (char *)extension;
char prompt[50];
wxString str = _("Load %s file");
sprintf(prompt, str, what);
if (*ext == '.') ext++;
char wild[60];
sprintf(wild, "*.%s", ext);
return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent);
};
char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name,
wxWindow *parent )
{
char *ext = (char *)extension;
char prompt[50];
wxString str = _("Save %s file");
sprintf(prompt, str, what);
if (*ext == '.') ext++;
char wild[60];
sprintf(wild, "*.%s", ext);
return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent);
};

213
src/qt/font.cpp Normal file
View File

@@ -0,0 +1,213 @@
/////////////////////////////////////////////////////////////////////////////
// Name: font.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 "font.h"
#endif
#include "wx/font.h"
#include "wx/utils.h"
#include <strings.h>
//-----------------------------------------------------------------------------
// local data
//-----------------------------------------------------------------------------
static char *wx_font_family [] = {
"wxDEFAULT", "wxDECORATIVE", "wxMODERN", "wxROMAN", "wxSCRIPT",
"wxSWISS", "wxTELETYPE",
};
static char *wx_font_style [] = {
"wxDEFAULT", "wxNORMAL", "wxSLANT", "wxITALIC",
};
static char *wx_font_weight [] = {
"wxDEFAULT", "wxNORMAL", "wxBOLD", "wxLIGHT",
};
extern wxFontNameDirectory wxTheFontNameDirectory;
//-----------------------------------------------------------------------------
// wxFont
//-----------------------------------------------------------------------------
class wxFontRefData: public wxObjectRefData
{
public:
wxFontRefData(void);
~wxFontRefData(void);
wxList m_scaled_xfonts;
int m_pointSize;
int m_family, m_style, m_weight;
bool m_underlined;
int m_fontId;
char* m_faceName;
};
wxFontRefData::wxFontRefData(void) : m_scaled_xfonts(wxKEY_INTEGER)
{
m_pointSize = -1;
m_family = -1;
m_style = -1;
m_weight = -1;
m_underlined = FALSE;
m_fontId = 0;
m_faceName = NULL;
};
wxFontRefData::~wxFontRefData(void)
{
wxNode *node = m_scaled_xfonts.First();
while (node)
{
wxNode *next = node->Next();
node = next;
};
if (m_faceName)
{
delete m_faceName;
m_faceName = NULL;
};
};
//-----------------------------------------------------------------------------
#define M_FONTDATA ((wxFontRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
wxFont::wxFont(void)
{
if (wxTheFontList) wxTheFontList->Append( this );
};
wxFont::wxFont( char *xFontName )
{
if (!xFontName) return;
m_refData = new wxFontRefData();
};
wxFont::wxFont(int PointSize, int FontIdOrFamily, int Style, int Weight,
bool Underlined, const char* Face)
{
m_refData = new wxFontRefData();
if (wxTheFontList) wxTheFontList->Append( this );
};
wxFont::wxFont(int PointSize, const char *Face, int Family, int Style,
int Weight, bool Underlined)
{
m_refData = new wxFontRefData();
if (wxTheFontList) wxTheFontList->Append( this );
};
wxFont::wxFont( const wxFont& font )
{
Ref( font );
};
wxFont::wxFont( const wxFont* font )
{
UnRef();
if (font) Ref( *font );
};
wxFont::~wxFont(void)
{
if (wxTheFontList) wxTheFontList->DeleteObject( this );
};
wxFont& wxFont::operator = ( const wxFont& font )
{
if (*this == font) return (*this);
Ref( font );
return *this;
};
bool wxFont::operator == ( const wxFont& font )
{
return m_refData == font.m_refData;
};
bool wxFont::operator != ( const wxFont& font )
{
return m_refData != font.m_refData;
};
bool wxFont::Ok()
{
return (m_refData != NULL);
};
int wxFont::GetPointSize(void) const
{
return M_FONTDATA->m_pointSize;
};
wxString wxFont::GetFaceString(void) const
{
return "";
};
wxString wxFont::GetFaceName(void) const
{
return "";
};
int wxFont::GetFamily(void) const
{
return M_FONTDATA->m_family;
};
wxString wxFont::GetFamilyString(void) const
{
wxString s = wx_font_family[M_FONTDATA->m_family];
return s;
};
int wxFont::GetFontId(void) const
{
return M_FONTDATA->m_fontId; // stub
};
int wxFont::GetStyle(void) const
{
return M_FONTDATA->m_style;
};
wxString wxFont::GetStyleString(void) const
{
wxString s = wx_font_style[M_FONTDATA->m_style];
return s;
};
int wxFont::GetWeight(void) const
{
return M_FONTDATA->m_weight;
};
wxString wxFont::GetWeightString(void) const
{
wxString s = wx_font_weight[M_FONTDATA->m_weight];
return s;
};
bool wxFont::GetUnderlined(void) const
{
return M_FONTDATA->m_underlined;
};

252
src/qt/frame.cpp Normal file
View File

@@ -0,0 +1,252 @@
/////////////////////////////////////////////////////////////////////////////
// Name: frame.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 "frame.h"
#endif
#include "wx/frame.h"
#include "wx/dialog.h"
#include "wx/control.h"
#include "wx/app.h"
#include "wx/menu.h"
#include "wx/toolbar.h"
#include "wx/statusbr.h"
#include "wx/mdi.h"
const wxMENU_HEIGHT = 28;
const wxSTATUS_HEIGHT = 25;
extern wxList wxTopLevelWindows;
extern wxList wxPendingDelete;
//-----------------------------------------------------------------------------
// wxFrame
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_SIZE(wxFrame::OnSize)
EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_IDLE(wxFrame::OnIdle)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
wxFrame::wxFrame()
{
wxTopLevelWindows.Insert( this );
};
wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, title, pos, size, style, name );
wxTopLevelWindows.Insert( this );
};
bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
m_title = title;
return TRUE;
};
wxFrame::~wxFrame()
{
if (m_frameMenuBar) delete m_frameMenuBar;
if (m_frameStatusBar) delete m_frameStatusBar;
wxTopLevelWindows.DeleteObject( this );
if (wxTopLevelWindows.Number() == 0) wxTheApp->ExitMainLoop();
};
bool wxFrame::Show( bool show )
{
if (show)
{
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
ProcessEvent( event );
};
return wxWindow::Show( show );
};
void wxFrame::Enable( bool enable )
{
wxWindow::Enable( enable );
};
void wxFrame::OnCloseWindow( wxCloseEvent &event )
{
if ( GetEventHandler()->OnClose() || event.GetForce())
{
this->Destroy();
}
};
bool wxFrame::Destroy()
{
if (!wxPendingDelete.Member(this))
wxPendingDelete.Append(this);
return TRUE;
}
void wxFrame::GetClientSize( int *width, int *height ) const
{
wxWindow::GetClientSize( width, height );
if (height)
{
if (m_frameMenuBar) (*height) -= wxMENU_HEIGHT;
if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT;
if (m_frameToolBar)
{
int y = 0;
m_frameToolBar->GetSize( NULL, &y );
(*height) -= y;
}
};
};
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
{
if ( GetAutoLayout() )
Layout();
else {
// no child: go out !
if (!GetChildren()->First())
return;
// do we have exactly one child?
wxWindow *child = NULL;
for(wxNode *node = GetChildren()->First(); node; node = node->Next())
{
wxWindow *win = (wxWindow *)node->Data();
if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog)
#if 0 // not in m_children anyway
&& (win != m_frameMenuBar) &&
(win != m_frameToolBar) &&
(win != m_frameStatusBar)
#endif
)
{
if ( child ) // it's the second one: do nothing
return;
child = win;
};
};
// yes: set it's size to fill all the frame
int client_x, client_y;
GetClientSize(&client_x, &client_y);
child->SetSize( 1, 1, client_x-2, client_y);
}
};
static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
{
menu->SetInvokingWindow( win );
wxNode *node = menu->m_items.First();
while (node)
{
wxMenuItem *menuitem = (wxMenuItem*)node->Data();
if (menuitem->IsSubMenu())
SetInvokingWindow( menuitem->GetSubMenu(), win );
node = node->Next();
};
};
void wxFrame::SetMenuBar( wxMenuBar *menuBar )
{
m_frameMenuBar = menuBar;
if (m_frameMenuBar)
{
if (m_frameMenuBar->m_parent != this)
{
wxNode *node = m_frameMenuBar->m_menus.First();
while (node)
{
wxMenu *menu = (wxMenu*)node->Data();
SetInvokingWindow( menu, this );
node = node->Next();
};
}
}
};
wxMenuBar *wxFrame::GetMenuBar(void)
{
return m_frameMenuBar;
};
wxToolBar *wxFrame::CreateToolBar( long style , wxWindowID id, const wxString& name )
{
m_frameToolBar = new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
return m_frameToolBar;
};
wxToolBar *wxFrame::GetToolBar(void)
{
return m_frameToolBar;
};
wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
{
if (m_frameStatusBar)
delete m_frameStatusBar;
m_frameStatusBar = new wxStatusBar( this, id, wxPoint(0,0), wxSize(100,20), style, name );
m_frameStatusBar->SetFieldsCount( number );
return m_frameStatusBar;
};
void wxFrame::SetStatusText( const wxString &text, int number )
{
if (m_frameStatusBar) m_frameStatusBar->SetStatusText( text, number );
};
void wxFrame::SetStatusWidths( int n, int *width )
{
if (m_frameStatusBar) m_frameStatusBar->SetStatusWidths( n, width );
};
wxStatusBar *wxFrame::GetStatusBar(void)
{
return m_frameStatusBar;
};
void wxFrame::SetTitle( const wxString &title )
{
m_title = title;
};
void wxFrame::SetSizeHints( int WXUNUSED(minW), int WXUNUSED(minH),
int WXUNUSED(maxW), int WXUNUSED(maxH), int WXUNUSED(incW) )
{
}
void wxFrame::SetIcon( const wxIcon &icon )
{
m_icon = icon;
if (!icon.Ok()) return;
}

51
src/qt/gauge.cpp Normal file
View File

@@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////
// Name: gauge.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 "gauge.h"
#endif
#include "wx/gauge.h"
//-----------------------------------------------------------------------------
// wxGauge
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxGauge,wxControl)
bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
{
return TRUE;
};
void wxGauge::SetRange( int r )
{
m_rangeMax = r;
if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
};
void wxGauge::SetValue( int pos )
{
m_gaugePos = pos;
if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
};
int wxGauge::GetRange(void) const
{
return m_rangeMax;
};
int wxGauge::GetValue(void) const
{
return m_gaugePos;
};

21
src/qt/gdiobj.cpp Normal file
View File

@@ -0,0 +1,21 @@
/////////////////////////////////////////////////////////////////////////////
// Name: gdiobj.cpp
// Purpose: wxGDIObject class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "gdiobj.h"
#endif
#include "wx/gdiobj.h"
#if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
#endif

6
src/qt/horiz.xbm Normal file
View File

@@ -0,0 +1,6 @@
#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};

27
src/qt/icon.cpp Normal file
View File

@@ -0,0 +1,27 @@
/////////////////////////////////////////////////////////////////////////////
// Name: icon.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 "icon.h"
#endif
#include "wx/icon.h"
//-----------------------------------------------------------------------------
// wxIcon
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap)
wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
wxBitmap( bits )
{
};

358
src/qt/joystick.cpp Normal file
View File

@@ -0,0 +1,358 @@
/////////////////////////////////////////////////////////////////////////////
// Name: joystick.cpp
// Purpose: wxJoystick class
// Author: Ported to Linux by Guilhem Lavaux
// Modified by:
// Created: 05/23/98
// RCS-ID: $Id$
// Copyright: (c) Guilhem Lavaux
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "joystick.h"
#endif
#include <linux/joystick.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include "wx/event.h"
#include "wx/window.h"
#include "wx/gtk/joystick.h"
#define JOYSTICK_AXE_MAX 32767
#define JOYSTICK_AXE_MIN -32767
IMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject)
wxJoystick::wxJoystick(int joystick)
{
wxString dev_name;
// Assume it's the same device name on all Linux systems ...
dev_name.Printf("/dev/js%d", (joystick == wxJOYSTICK1) ? 0 : 1);
m_joystick = open(dev_name, O_RDWR);
m_lastposition = wxPoint(-1, -1);
for (int i=0;i<15;i++)
m_axe[i] = 0;
if (m_joystick != -1)
Create();
}
////////////////////////////////////////////////////////////////////////////
// Background thread
////////////////////////////////////////////////////////////////////////////
void *wxJoystick::Entry(void)
{
struct js_event j_evt;
wxJoystickEvent jwx_event;
fd_set read_fds;
struct timeval time_out = {0, 0};
FD_ZERO(&read_fds);
DeferDestroy(TRUE);
while (1) {
TestDestroy();
if (m_polling) {
FD_SET(m_joystick, &read_fds);
select(m_joystick+1, &read_fds, NULL, NULL, &time_out);
if (FD_ISSET(m_joystick, &read_fds))
read(m_joystick, &j_evt, sizeof(j_evt));
else
j_evt.type = 0;
} else {
read(m_joystick, &j_evt, sizeof(j_evt));
}
if ((j_evt.type & JS_EVENT_AXIS) == JS_EVENT_AXIS) {
switch (j_evt.number) {
case 1:
m_lastposition.x = j_evt.value;
jwx_event.SetEventType(wxEVT_JOY_MOVE);
break;
case 2:
m_lastposition.y = j_evt.value;
jwx_event.SetEventType(wxEVT_JOY_MOVE);
break;
case 3:
m_axe[3] = j_evt.value;
jwx_event.SetEventType(wxEVT_JOY_ZMOVE);
break;
default:
m_axe[j_evt.number] = j_evt.value;
jwx_event.SetEventType(wxEVT_JOY_MOVE);
break;
}
jwx_event.SetPosition(m_lastposition);
jwx_event.SetZPosition(m_axe[3]);
}
if ((j_evt.type & JS_EVENT_BUTTON) == JS_EVENT_BUTTON) {
register int mask = 1 << j_evt.number;
char button = m_buttons & mask;
m_buttons &= ~mask;
if (button) {
jwx_event.SetEventType(wxEVT_JOY_BUTTON_UP);
} else {
jwx_event.SetEventType(wxEVT_JOY_BUTTON_DOWN);
m_buttons |= mask;
}
jwx_event.SetButtonState(m_buttons);
jwx_event.SetButtonChange(j_evt.number);
}
}
if (m_catchwin)
m_catchwin->ProcessEvent(jwx_event);
if (m_polling)
usleep(m_polling*1000);
}
////////////////////////////////////////////////////////////////////////////
// State
////////////////////////////////////////////////////////////////////////////
wxPoint wxJoystick::GetPosition(void) const
{
return m_lastposition;
}
int wxJoystick::GetZPosition(void) const
{
return m_axe[3];
}
int wxJoystick::GetButtonState(void) const
{
return m_buttons;
}
int wxJoystick::GetPOVPosition(void) const
{
return 0;
}
int wxJoystick::GetPOVCTSPosition(void) const
{
return 0;
}
int wxJoystick::GetRudderPosition(void) const
{
return m_axe[4];
}
int wxJoystick::GetUPosition(void) const
{
return m_axe[5];
}
int wxJoystick::GetVPosition(void) const
{
return m_axe[6];
}
int wxJoystick::GetMovementThreshold(void) const
{
return 0;
}
void wxJoystick::SetMovementThreshold(int threshold)
{
}
////////////////////////////////////////////////////////////////////////////
// Capabilities
////////////////////////////////////////////////////////////////////////////
bool wxJoystick::IsOk(void) const
{
return (m_joystick != -1);
}
int wxJoystick::GetNumberJoysticks(void) const
{
wxString dev_name;
int fd, j;
for (j=0;j<2;j++) {
dev_name.Printf("/dev/js%d", j);
fd = open(dev_name, O_RDONLY);
if (fd == -1)
return j;
close(fd);
}
return j;
}
int wxJoystick::GetManufacturerId(void) const
{
return 0;
}
int wxJoystick::GetProductId(void) const
{
return 0;
}
wxString wxJoystick::GetProductName(void) const
{
return "";
}
int wxJoystick::GetXMin(void) const
{
return JOYSTICK_AXE_MAX;
}
int wxJoystick::GetYMin(void) const
{
return JOYSTICK_AXE_MAX;
}
int wxJoystick::GetZMin(void) const
{
return JOYSTICK_AXE_MAX;
}
int wxJoystick::GetXMax(void) const
{
return JOYSTICK_AXE_MAX;
}
int wxJoystick::GetYMax(void) const
{
return JOYSTICK_AXE_MAX;
}
int wxJoystick::GetZMax(void) const
{
return JOYSTICK_AXE_MAX;
}
int wxJoystick::GetNumberButtons(void) const
{
int nb;
ioctl(m_joystick, JSIOCGBUTTONS, &nb);
return nb;
}
int wxJoystick::GetNumberAxes(void) const
{
int nb;
ioctl(m_joystick, JSIOCGAXES, &nb);
return nb;
}
int wxJoystick::GetMaxButtons(void) const
{
return 15; // internal
}
int wxJoystick::GetMaxAxes(void) const
{
return 15; // internal
}
int wxJoystick::GetPollingMin(void) const
{
return -1;
}
int wxJoystick::GetPollingMax(void) const
{
return -1;
}
int wxJoystick::GetRudderMin(void) const
{
return JOYSTICK_AXE_MIN;
}
int wxJoystick::GetRudderMax(void) const
{
return JOYSTICK_AXE_MAX;
}
int wxJoystick::GetUMin(void) const
{
return JOYSTICK_AXE_MIN;
}
int wxJoystick::GetUMax(void) const
{
return JOYSTICK_AXE_MAX;
}
int wxJoystick::GetVMin(void) const
{
return JOYSTICK_AXE_MIN;
}
int wxJoystick::GetVMax(void) const
{
return JOYSTICK_AXE_MAX;
}
bool wxJoystick::HasRudder(void) const
{
return GetNumberAxes() >= 4;
}
bool wxJoystick::HasZ(void) const
{
return GetNumberAxes() >= 3;
}
bool wxJoystick::HasU(void) const
{
return GetNumberAxes() >= 5;
}
bool wxJoystick::HasV(void) const
{
return GetNumberAxes() >= 6;
}
bool wxJoystick::HasPOV(void) const
{
return FALSE;
}
bool wxJoystick::HasPOV4Dir(void) const
{
return FALSE;
}
bool wxJoystick::HasPOVCTS(void) const
{
return FALSE;
}
////////////////////////////////////////////////////////////////////////////
// Operations
////////////////////////////////////////////////////////////////////////////
bool wxJoystick::SetCapture(wxWindow* win, int pollingFreq = 0)
{
m_catchwin = win;
m_polling = pollingFreq;
return TRUE;
}
bool wxJoystick::ReleaseCapture(void)
{
m_catchwin = NULL;
m_polling = 0;
return TRUE;
}

137
src/qt/listbox.cpp Normal file
View File

@@ -0,0 +1,137 @@
/////////////////////////////////////////////////////////////////////////////
// Name: listbox.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 "listbox.h"
#endif
#include "wx/dynarray.h"
#include "wx/listbox.h"
#include "wx/utils.h"
//-----------------------------------------------------------------------------
// wxListBox
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxListBox,wxControl)
wxListBox::wxListBox(void)
{
};
wxListBox::wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxString &name )
{
Create( parent, id, pos, size, n, choices, style, name );
};
bool wxListBox::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxString &name )
{
return TRUE;
};
void wxListBox::Append( const wxString &item )
{
Append( item, (char*)NULL );
};
void wxListBox::Append( const wxString &WXUNUSED(item), char *WXUNUSED(clientData) )
{
};
void wxListBox::Clear(void)
{
};
void wxListBox::Delete( int WXUNUSED(n) )
{
};
void wxListBox::Deselect( int WXUNUSED(n) )
{
};
int wxListBox::FindString( const wxString &WXUNUSED(item) ) const
{
return -1;
};
char *wxListBox::GetClientData( int WXUNUSED(n) ) const
{
return (char*)NULL;
};
int wxListBox::GetSelection(void) const
{
return -1;
};
int wxListBox::GetSelections( wxArrayInt& WXUNUSED(aSelections) ) const
{
return 0;
};
wxString wxListBox::GetString( int WXUNUSED(n) ) const
{
return "";
};
wxString wxListBox::GetStringSelection(void) const
{
return "";
};
int wxListBox::Number(void)
{
return 0;
};
bool wxListBox::Selected( int WXUNUSED(n) )
{
return FALSE;
};
void wxListBox::Set( int WXUNUSED(n), const wxString *WXUNUSED(choices) )
{
};
void wxListBox::SetClientData( int WXUNUSED(n), char *WXUNUSED(clientData) )
{
};
void wxListBox::SetFirstItem( int WXUNUSED(n) )
{
};
void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) )
{
};
void wxListBox::SetSelection( int WXUNUSED(n), bool WXUNUSED(select) )
{
};
void wxListBox::SetString( int WXUNUSED(n), const wxString &WXUNUSED(string) )
{
};
void wxListBox::SetStringSelection( const wxString &WXUNUSED(string), bool WXUNUSED(select) )
{
};

229
src/qt/mdi.cpp Normal file
View File

@@ -0,0 +1,229 @@
/////////////////////////////////////////////////////////////////////////////
// Name: mdi.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 "mdi.h"
#endif
#include "wx/mdi.h"
#include "wx/dialog.h"
#include "wx/menu.h"
//-----------------------------------------------------------------------------
extern wxList wxPendingDelete;
//-----------------------------------------------------------------------------
// wxMDIParentFrame
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame)
BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
END_EVENT_TABLE()
wxMDIParentFrame::wxMDIParentFrame(void)
{
m_clientWindow = NULL;
m_currentChild = NULL;
m_parentFrameActive = TRUE;
};
wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent,
wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
{
m_clientWindow = NULL;
m_currentChild = NULL;
m_parentFrameActive = TRUE;
Create( parent, id, title, pos, size, style, name );
};
wxMDIParentFrame::~wxMDIParentFrame(void)
{
};
bool wxMDIParentFrame::Create( wxWindow *parent,
wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
{
wxFrame::Create( parent, id, title, pos, size, style, name );
OnCreateClient();
return TRUE;
};
void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
{
wxFrame::GetClientSize( width, height );
};
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const
{
return m_currentChild;
};
wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const
{
return m_clientWindow;
};
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient(void)
{
m_clientWindow = new wxMDIClientWindow( this );
return m_clientWindow;
};
void wxMDIParentFrame::ActivateNext(void)
{
};
void wxMDIParentFrame::ActivatePrevious(void)
{
};
void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
{
};
void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(event) )
{
};
//-----------------------------------------------------------------------------
// wxMDIChildFrame
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxFrame)
BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame)
EVT_ACTIVATE(wxMDIChildFrame::OnActivate)
END_EVENT_TABLE()
wxMDIChildFrame::wxMDIChildFrame(void)
{
};
wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent,
wxWindowID id, const wxString& title,
const wxPoint& WXUNUSED(pos), const wxSize& size,
long style, const wxString& name )
{
Create( parent, id, title, wxDefaultPosition, size, style, name );
};
wxMDIChildFrame::~wxMDIChildFrame(void)
{
};
bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
wxWindowID id, const wxString& title,
const wxPoint& WXUNUSED(pos), const wxSize& size,
long style, const wxString& name )
{
m_title = title;
return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name );
};
void wxMDIChildFrame::GetClientSize( int *width, int *height ) const
{
wxWindow::GetClientSize( width, height );
}
void wxMDIChildFrame::AddChild( wxWindow *child )
{
wxWindow::AddChild( child );
}
static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
{
menu->SetInvokingWindow( win );
wxNode *node = menu->m_items.First();
while (node)
{
wxMenuItem *menuitem = (wxMenuItem*)node->Data();
if (menuitem->IsSubMenu())
SetInvokingWindow( menuitem->GetSubMenu(), win );
node = node->Next();
};
};
void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
{
m_menuBar = menu_bar;
if (m_menuBar)
{
wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent;
if (m_menuBar->m_parent != this)
{
wxNode *node = m_menuBar->m_menus.First();
while (node)
{
wxMenu *menu = (wxMenu*)node->Data();
SetInvokingWindow( menu, this );
node = node->Next();
};
m_menuBar->m_parent = mdi_frame;
}
mdi_frame->SetMDIMenuBar( m_menuBar );
}
};
wxMenuBar *wxMDIChildFrame::GetMenuBar()
{
return m_menuBar;
};
void wxMDIChildFrame::Activate(void)
{
};
void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) )
{
};
//-----------------------------------------------------------------------------
// wxMDIClientWindow
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow,wxWindow)
wxMDIClientWindow::wxMDIClientWindow(void)
{
};
wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, long style )
{
CreateClient( parent, style );
};
wxMDIClientWindow::~wxMDIClientWindow(void)
{
};
bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *WXUNUSED(parent), long WXUNUSED(style) )
{
return TRUE;
};
void wxMDIClientWindow::AddChild( wxWindow *WXUNUSED(child) )
{
};

293
src/qt/menu.cpp Normal file
View File

@@ -0,0 +1,293 @@
/////////////////////////////////////////////////////////////////////////////
// Name: menu.cpp
// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "menu.h"
#endif
#include "wx/menu.h"
#include "wx/log.h"
//-----------------------------------------------------------------------------
// wxMenuBar
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow)
wxMenuBar::wxMenuBar()
{
};
void wxMenuBar::Append( wxMenu *menu, const wxString &title )
{
m_menus.Append( menu );
menu->m_title = title; // ??????
int pos;
do {
pos = menu->m_title.First( '&' );
if (pos != -1) menu->m_title.Remove( pos, 1 );
} while (pos != -1);
};
static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString )
{
if (menu->m_title == menuString)
{
int res = menu->FindItem( itemString );
if (res != -1) return res;
};
wxNode *node = menu->m_items.First();
while (node)
{
wxMenuItem *item = (wxMenuItem*)node->Data();
if (item->IsSubMenu())
return FindMenuItemRecursive(item->GetSubMenu(), menuString, itemString);
node = node->Next();
};
return -1;
};
int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const
{
wxNode *node = m_menus.First();
while (node)
{
wxMenu *menu = (wxMenu*)node->Data();
int res = FindMenuItemRecursive( menu, menuString, itemString);
if (res != -1) return res;
node = node->Next();
};
return -1;
};
// Find a wxMenuItem using its id. Recurses down into sub-menus
static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id)
{
wxMenuItem* result = menu->FindItem(id);
wxNode *node = menu->m_items.First();
while ( node && result == NULL ) {
wxMenuItem *item = (wxMenuItem*)node->Data();
if ( item->IsSubMenu() )
result = FindMenuItemByIdRecursive( item->GetSubMenu(), id );
node = node->Next();
};
return result;
};
wxMenuItem* wxMenuBar::FindMenuItemById( int id ) const
{
wxMenuItem* result = 0;
wxNode *node = m_menus.First();
while (node && result == 0)
{
wxMenu *menu = (wxMenu*)node->Data();
result = FindMenuItemByIdRecursive( menu, id );
node = node->Next();
}
return result;
}
void wxMenuBar::Check( int id, bool check )
{
wxMenuItem* item = FindMenuItemById( id );
if (item) item->Check(check);
};
bool wxMenuBar::Checked( int id ) const
{
wxMenuItem* item = FindMenuItemById( id );
if (item) return item->IsChecked();
return FALSE;
};
void wxMenuBar::Enable( int id, bool enable )
{
wxMenuItem* item = FindMenuItemById( id );
if (item) item->Enable(enable);
};
bool wxMenuBar::Enabled( int id ) const
{
wxMenuItem* item = FindMenuItemById( id );
if (item) return item->IsEnabled();
return FALSE;
};
//-----------------------------------------------------------------------------
// wxMenu
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem,wxObject)
wxMenuItem::wxMenuItem()
{
m_id = ID_SEPARATOR;
m_isCheckMenu = FALSE;
m_isChecked = FALSE;
m_isEnabled = TRUE;
m_subMenu = NULL;
};
void wxMenuItem::SetText(const wxString& str)
{
for ( const char *pc = str; *pc != '\0'; pc++ ) {
if ( *pc == '&' )
pc++; // skip it
m_text << *pc;
}
}
void wxMenuItem::Check( bool check )
{
wxCHECK_RET( IsCheckable(), "can't check uncheckable item!" )
m_isChecked = check;
}
bool wxMenuItem::IsChecked() const
{
wxCHECK( IsCheckable(), FALSE ); // can't get state of uncheckable item!
return FALSE;
}
IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
wxMenu::wxMenu( const wxString &title )
{
m_title = title;
m_items.DeleteContents( TRUE );
m_invokingWindow = NULL;
};
void wxMenu::AppendSeparator()
{
wxMenuItem *mitem = new wxMenuItem();
mitem->SetId(ID_SEPARATOR);
m_items.Append( mitem );
};
void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool checkable )
{
wxMenuItem *mitem = new wxMenuItem();
mitem->SetId(id);
mitem->SetText(item);
mitem->SetHelpString(helpStr);
mitem->SetCheckable(checkable);
m_items.Append( mitem );
};
void wxMenu::Append( int id, const wxString &text, wxMenu *subMenu, const wxString &helpStr )
{
wxMenuItem *mitem = new wxMenuItem();
mitem->SetId(id);
mitem->SetText(text);
mitem->SetHelpString(helpStr);
mitem->SetSubMenu(subMenu);
m_items.Append( mitem );
};
int wxMenu::FindItem( const wxString itemString ) const
{
wxString s( itemString );
int pos;
do {
pos = s.First( '&' );
if (pos != -1) s.Remove( pos, 1 );
} while (pos != -1);
wxNode *node = m_items.First();
while (node)
{
wxMenuItem *item = (wxMenuItem*)node->Data();
if (item->GetText() == s)
return item->GetId();
node = node->Next();
};
return -1;
};
void wxMenu::Enable( int id, bool enable )
{
wxMenuItem *item = FindItem(id);
if ( item )
item->Enable(enable);
};
bool wxMenu::IsEnabled( int id ) const
{
wxMenuItem *item = FindItem(id);
if ( item )
return item->IsEnabled();
else
return FALSE;
};
void wxMenu::Check( int id, bool enable )
{
wxMenuItem *item = FindItem(id);
if ( item )
item->Check(enable);
};
bool wxMenu::IsChecked( int id ) const
{
wxMenuItem *item = FindItem(id);
if ( item )
return item->IsChecked();
else
return FALSE;
};
void wxMenu::SetLabel( int id, const wxString &label )
{
wxMenuItem *item = FindItem(id);
if ( item )
item->SetText(label);
};
wxMenuItem *wxMenu::FindItem(int id) const
{
wxNode *node = m_items.First();
while (node) {
wxMenuItem *item = (wxMenuItem*)node->Data();
if ( item->GetId() == id )
return item;
node = node->Next();
};
wxLogDebug("wxMenu::FindItem: item %d not found.", id);
return NULL;
}
void wxMenu::SetInvokingWindow( wxWindow *win )
{
m_invokingWindow = win;
};
wxWindow *wxMenu::GetInvokingWindow()
{
return m_invokingWindow;
};

185
src/qt/notebook.cpp Normal file
View File

@@ -0,0 +1,185 @@
/////////////////////////////////////////////////////////////////////////////
// Name: notebook.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 "notebook.h"
#endif
#include "wx/notebook.h"
#include "wx/panel.h"
#include "wx/utils.h"
#include "wx/imaglist.h"
#include "wx/log.h"
//-----------------------------------------------------------------------------
// wxNotebookPage
//-----------------------------------------------------------------------------
class wxNotebookPage: public wxObject
{
public:
wxNotebookPage()
{
m_id = -1;
m_text = "";
m_image = -1;
m_page = NULL;
m_client = NULL;
m_parent = NULL;
};
//private:
int m_id;
wxString m_text;
int m_image;
wxWindow *m_client;
};
//-----------------------------------------------------------------------------
// wxNotebook
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxControl)
void wxNotebook::Init()
{
m_imageList = NULL;
m_pages.DeleteContents( TRUE );
}
wxNotebook::wxNotebook()
{
Init();
};
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 );
};
wxNotebook::~wxNotebook()
{
DeleteAllPages();
};
bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
{
PreCreation( parent, id, pos, size, style, name );
PostCreation();
Show( TRUE );
return TRUE;
};
int wxNotebook::GetSelection() const
{
};
int wxNotebook::GetPageCount() const
{
};
int wxNotebook::GetRowCount() const
{
};
wxString wxNotebook::GetPageText( int page ) const
{
};
int wxNotebook::GetPageImage( int page ) const
{
};
wxNotebookPage* wxNotebook::GetNotebookPage(int page) const
{
return NULL;
};
int wxNotebook::SetSelection( int page )
{
};
void wxNotebook::AdvanceSelection(bool bForward)
{
}
void wxNotebook::SetImageList( wxImageList* imageList )
{
m_imageList = imageList;
};
bool wxNotebook::SetPageText( int page, const wxString &text )
{
return TRUE;
};
bool wxNotebook::SetPageImage( int page, int image )
{
return TRUE;
};
void wxNotebook::SetPageSize( const wxSize &WXUNUSED(size) )
{
};
void wxNotebook::SetPadding( const wxSize &WXUNUSED(padding) )
{
};
bool wxNotebook::DeleteAllPages()
{
return TRUE;
};
bool wxNotebook::DeletePage( int page )
{
return TRUE;
};
bool wxNotebook::AddPage(wxWindow* win, const wxString& text,
bool bSelect, int imageId)
{
return TRUE;
};
wxWindow *wxNotebook::GetPage( int page ) const
{
return NULL;
};
void wxNotebook::AddChild( wxWindow *win )
{
};
// override these 2 functions to do nothing: everything is done in OnSize
void wxNotebook::SetConstraintSizes( bool WXUNUSED(recurse) )
{
// don't set the sizes of the pages - their correct size is not yet known
wxControl::SetConstraintSizes(FALSE);
}
bool wxNotebook::DoPhase( int WXUNUSED(nPhase) )
{
return TRUE;
}
//-----------------------------------------------------------------------------
// wxNotebookEvent
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)

103
src/qt/palette.cpp Normal file
View File

@@ -0,0 +1,103 @@
/////////////////////////////////////////////////////////////////////////////
// Name: palette.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 "palette.h"
#endif
#include "wx/palette.h"
//-----------------------------------------------------------------------------
// wxPalette
//-----------------------------------------------------------------------------
class wxPaletteRefData: public wxObjectRefData
{
public:
wxPaletteRefData(void);
~wxPaletteRefData(void);
};
wxPaletteRefData::wxPaletteRefData(void)
{
};
wxPaletteRefData::~wxPaletteRefData(void)
{
};
//-----------------------------------------------------------------------------
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject)
wxPalette::wxPalette(void)
{
};
wxPalette::wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue )
{
m_refData = new wxPaletteRefData();
Create( n, red, green, blue );
};
wxPalette::wxPalette( const wxPalette& palette )
{
Ref( palette );
};
wxPalette::wxPalette( const wxPalette* palette )
{
UnRef();
if (palette) Ref( *palette );
};
wxPalette::~wxPalette(void)
{
};
wxPalette& wxPalette::operator = ( const wxPalette& palette )
{
if (*this == palette) return (*this);
Ref( palette );
return *this;
};
bool wxPalette::operator == ( const wxPalette& palette )
{
return m_refData == palette.m_refData;
};
bool wxPalette::operator != ( const wxPalette& palette )
{
return m_refData != palette.m_refData;
};
bool wxPalette::Ok(void) const
{
return (m_refData);
};
bool wxPalette::Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
{
};
int wxPalette::GetPixel( const unsigned char red, const unsigned char green, const unsigned char blue ) const
{
};
bool wxPalette::GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const
{
};

204
src/qt/pen.cpp Normal file
View File

@@ -0,0 +1,204 @@
/////////////////////////////////////////////////////////////////////////////
// Name: pen.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 "pen.h"
#endif
#include "wx/pen.h"
//-----------------------------------------------------------------------------
// wxPen
//-----------------------------------------------------------------------------
class wxPenRefData: public wxObjectRefData
{
public:
wxPenRefData(void);
int m_width;
int m_style;
int m_joinStyle;
int m_capStyle;
wxColour m_colour;
};
wxPenRefData::wxPenRefData(void)
{
m_width = 1;
m_style = wxSOLID;
m_joinStyle = wxJOIN_ROUND;
m_capStyle = wxCAP_ROUND;
};
//-----------------------------------------------------------------------------
#define M_PENDATA ((wxPenRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject)
wxPen::wxPen(void)
{
if (wxThePenList) wxThePenList->AddPen( this );
};
wxPen::wxPen( const wxColour &colour, int width, int style )
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
M_PENDATA->m_style = style;
M_PENDATA->m_colour = colour;
if (wxThePenList) wxThePenList->AddPen( this );
};
wxPen::wxPen( const wxString &colourName, int width, int style )
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
M_PENDATA->m_style = style;
M_PENDATA->m_colour = colourName;
if (wxThePenList) wxThePenList->AddPen( this );
};
wxPen::wxPen( const wxPen& pen )
{
Ref( pen );
if (wxThePenList) wxThePenList->AddPen( this );
};
wxPen::wxPen( const wxPen* pen )
{
UnRef();
if (pen) Ref( *pen );
if (wxThePenList) wxThePenList->AddPen( this );
};
wxPen::~wxPen(void)
{
if (wxThePenList) wxThePenList->RemovePen( this );
};
wxPen& wxPen::operator = ( const wxPen& pen )
{
if (*this == pen) return (*this);
Ref( pen );
return *this;
};
bool wxPen::operator == ( const wxPen& pen )
{
return m_refData == pen.m_refData;
};
bool wxPen::operator != ( const wxPen& pen )
{
return m_refData != pen.m_refData;
};
void wxPen::SetColour( const wxColour &colour )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_colour = colour;
};
void wxPen::SetColour( const wxString &colourName )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_colour = colourName;
};
void wxPen::SetColour( int red, int green, int blue )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_colour.Set( red, green, blue );
};
void wxPen::SetCap( int capStyle )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_capStyle = capStyle;
};
void wxPen::SetJoin( int joinStyle )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_joinStyle = joinStyle;
};
void wxPen::SetStyle( int style )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_style = style;
};
void wxPen::SetWidth( int width )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
};
int wxPen::GetCap(void) const
{
return M_PENDATA->m_capStyle;
};
int wxPen::GetJoin(void) const
{
if (!m_refData)
return 0;
else
return M_PENDATA->m_joinStyle;
};
int wxPen::GetStyle(void) const
{
if (!m_refData)
return 0;
else
return M_PENDATA->m_style;
};
int wxPen::GetWidth(void) const
{
if (!m_refData)
return 0;
else
return M_PENDATA->m_width;
};
wxColour &wxPen::GetColour(void) const
{
if (!m_refData)
return wxNullColour;
else
return M_PENDATA->m_colour;
};
bool wxPen::Ok(void) const
{
return (m_refData);
};

133
src/qt/radiobox.cpp Normal file
View File

@@ -0,0 +1,133 @@
/////////////////////////////////////////////////////////////////////////////
// Name: radiobox.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 "radiobox.h"
#endif
#include "wx/radiobox.h"
#include "wx/dialog.h"
#include "wx/frame.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
wxRadioBox::wxRadioBox(void)
{
};
wxRadioBox::wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
int majorDim, long style,
const wxString &name )
{
Create( parent, id, title, pos, size, n, choices, majorDim, style, name );
};
bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
int WXUNUSED(majorDim), long style,
const wxString &name )
{
return TRUE;
};
bool wxRadioBox::Show( bool show )
{
wxWindow::Show( show );
return TRUE;
};
int wxRadioBox::FindString( const wxString &s ) const
{
return -1;
};
void wxRadioBox::SetSelection( int n )
{
};
int wxRadioBox::GetSelection(void) const
{
return -1;
};
wxString wxRadioBox::GetString( int n ) const
{
};
wxString wxRadioBox::GetLabel(void) const
{
return wxControl::GetLabel();
};
void wxRadioBox::SetLabel( const wxString& WXUNUSED(label) )
{
};
void wxRadioBox::SetLabel( int WXUNUSED(item), const wxString& WXUNUSED(label) )
{
};
void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) )
{
};
wxString wxRadioBox::GetLabel( int WXUNUSED(item) ) const
{
return "";
};
void wxRadioBox::Enable( bool WXUNUSED(enable) )
{
};
void wxRadioBox::Enable( int WXUNUSED(item), bool WXUNUSED(enable) )
{
};
void wxRadioBox::Show( int WXUNUSED(item), bool WXUNUSED(show) )
{
};
wxString wxRadioBox::GetStringSelection(void) const
{
return "";
};
bool wxRadioBox::SetStringSelection( const wxString&s )
{
return TRUE;
};
int wxRadioBox::Number(void) const
{
return 0;
};
int wxRadioBox::GetNumberOfRowsOrCols(void) const
{
return 1;
};
void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
{
};

17
src/qt/radiobut.cpp Normal file
View File

@@ -0,0 +1,17 @@
/////////////////////////////////////////////////////////////////////////////
// Name: radiobut.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 "radiobut.h"
#endif
#include "wx/radiobut.h"

163
src/qt/region.cpp Normal file
View File

@@ -0,0 +1,163 @@
/////////////////////////////////////////////////////////////////////////////
// Name: region.cpp
// Purpose:
// Author: Robert Roebling
// Created: 01/02/98
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "region.h"
#endif
#include "wx/region.h"
//-----------------------------------------------------------------------------
// wxRegion
//-----------------------------------------------------------------------------
class wxRegionRefData: public wxObjectRefData
{
public:
wxRegionRefData(void);
~wxRegionRefData(void);
public:
};
wxRegionRefData::wxRegionRefData(void)
{
};
wxRegionRefData::~wxRegionRefData(void)
{
};
//-----------------------------------------------------------------------------
#define M_REGIONDATA ((wxRegionRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxRegion,wxGDIObject);
wxRegion::wxRegion( long x, long y, long w, long h )
{
m_refData = new wxRegionRefData();
};
wxRegion::wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight )
{
m_refData = new wxRegionRefData();
};
wxRegion::wxRegion( const wxRect& rect )
{
m_refData = new wxRegionRefData();
};
wxRegion::wxRegion(void)
{
m_refData = new wxRegionRefData();
};
wxRegion::~wxRegion(void)
{
};
void wxRegion::Clear(void)
{
UnRef();
m_refData = new wxRegionRefData();
};
bool wxRegion::Union( long x, long y, long width, long height )
{
return TRUE;
};
bool wxRegion::Union( const wxRect& rect )
{
return TRUE;
};
bool wxRegion::Union( const wxRegion& region )
{
return TRUE;
};
bool wxRegion::Intersect( long x, long y, long width, long height )
{
return TRUE;
};
bool wxRegion::Intersect( const wxRect& rect )
{
return TRUE;
};
bool wxRegion::Intersect( const wxRegion& region )
{
return TRUE;
};
bool wxRegion::Subtract( long x, long y, long width, long height )
{
return TRUE;
};
bool wxRegion::Subtract( const wxRect& rect )
{
return TRUE;
};
bool wxRegion::Subtract( const wxRegion& region )
{
return TRUE;
};
bool wxRegion::Xor( long x, long y, long width, long height )
{
return TRUE;
};
bool wxRegion::Xor( const wxRect& rect )
{
return TRUE;
};
bool wxRegion::Xor( const wxRegion& region )
{
return TRUE;
};
void wxRegion::GetBox( long& x, long& y, long&w, long &h ) const
{
x = 0;
y = 0;
w = -1;
h = -1;
};
wxRect wxRegion::GetBox(void) const
{
return wxRect( 0, 0, -1, -1 );
};
bool wxRegion::Empty(void) const
{
};
wxRegionContain wxRegion::Contains( long x, long y ) const
{
return wxOutRegion;
};
wxRegionContain wxRegion::Contains( long x, long y, long w, long h ) const
{
return wxOutRegion;
};

102
src/qt/scrolbar.cpp Normal file
View File

@@ -0,0 +1,102 @@
/////////////////////////////////////////////////////////////////////////////
// Name: scrolbar.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 "scrolbar.h"
#endif
#include "wx/scrolbar.h"
#include "wx/utils.h"
//-----------------------------------------------------------------------------
// wxScrollBar
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl)
wxScrollBar::wxScrollBar(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
{
Create( parent, id, pos, size, style, name );
};
wxScrollBar::~wxScrollBar(void)
{
};
bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
{
return TRUE;
};
int wxScrollBar::GetPosition(void) const
{
};
int wxScrollBar::GetThumbSize() const
{
};
int wxScrollBar::GetPageSize() const
{
};
int wxScrollBar::GetRange() const
{
};
void wxScrollBar::SetPosition( int viewStart )
{
};
void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int pageSize,
bool WXUNUSED(refresh) )
{
};
// Backward compatibility
int wxScrollBar::GetValue(void) const
{
return GetPosition();
};
void wxScrollBar::SetValue( int viewStart )
{
SetPosition( viewStart );
};
void wxScrollBar::GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength ) const
{
};
int wxScrollBar::GetViewLength() const
{
};
int wxScrollBar::GetObjectLength() const
{
};
void wxScrollBar::SetPageSize( int pageLength )
{
};
void wxScrollBar::SetObjectLength( int objectLength )
{
};
void wxScrollBar::SetViewLength( int viewLength )
{
};

144
src/qt/settings.cpp Normal file
View File

@@ -0,0 +1,144 @@
/////////////////////////////////////////////////////////////////////////////
// Name: settings.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 "settings.h"
#endif
#include "wx/settings.h"
/*
#define wxSYS_COLOUR_SCROLLBAR 0
#define wxSYS_COLOUR_BACKGROUND 1
#define wxSYS_COLOUR_ACTIVECAPTION 2
#define wxSYS_COLOUR_INACTIVECAPTION 3
#define wxSYS_COLOUR_MENU 4
#define wxSYS_COLOUR_WINDOW 5
#define wxSYS_COLOUR_WINDOWFRAME 6
#define wxSYS_COLOUR_MENUTEXT 7
#define wxSYS_COLOUR_WINDOWTEXT 8
#define wxSYS_COLOUR_CAPTIONTEXT 9
#define wxSYS_COLOUR_ACTIVEBORDER 10
#define wxSYS_COLOUR_INACTIVEBORDER 11
#define wxSYS_COLOUR_APPWORKSPACE 12
#define wxSYS_COLOUR_HIGHLIGHT 13
#define wxSYS_COLOUR_HIGHLIGHTTEXT 14
#define wxSYS_COLOUR_BTNFACE 15
#define wxSYS_COLOUR_BTNSHADOW 16
#define wxSYS_COLOUR_GRAYTEXT 17
#define wxSYS_COLOUR_BTNTEXT 18
#define wxSYS_COLOUR_INACTIVECAPTIONTEXT 19
#define wxSYS_COLOUR_BTNHIGHLIGHT 20
#define wxSYS_COLOUR_3DDKSHADOW 21
#define wxSYS_COLOUR_3DLIGHT 22
#define wxSYS_COLOUR_INFOTEXT 23
#define wxSYS_COLOUR_INFOBK 24
#define wxSYS_COLOUR_DESKTOP wxSYS_COLOUR_BACKGROUND
#define wxSYS_COLOUR_3DFACE wxSYS_COLOUR_BTNFACE
#define wxSYS_COLOUR_3DSHADOW wxSYS_COLOUR_BTNSHADOW
#define wxSYS_COLOUR_3DHIGHLIGHT wxSYS_COLOUR_BTNHIGHLIGHT
#define wxSYS_COLOUR_3DHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
#define wxSYS_COLOUR_BTNHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
*/
#define SHIFT (8*(sizeof(short int)-sizeof(char)))
wxColour *g_systemBtnFaceColour = NULL;
wxColour *g_systemBtnShadowColour = NULL;
wxColour *g_systemBtnHighlightColour = NULL;
wxColour *g_systemHighlightColour = NULL;
wxColour wxSystemSettings::GetSystemColour( int index )
{
switch (index)
{
case wxSYS_COLOUR_SCROLLBAR:
case wxSYS_COLOUR_BACKGROUND:
case wxSYS_COLOUR_ACTIVECAPTION:
case wxSYS_COLOUR_INACTIVECAPTION:
case wxSYS_COLOUR_MENU:
case wxSYS_COLOUR_WINDOW:
case wxSYS_COLOUR_WINDOWFRAME:
case wxSYS_COLOUR_ACTIVEBORDER:
case wxSYS_COLOUR_INACTIVEBORDER:
case wxSYS_COLOUR_BTNFACE:
{
return *g_systemBtnFaceColour;
};
case wxSYS_COLOUR_BTNSHADOW:
{
return *g_systemBtnShadowColour;
};
case wxSYS_COLOUR_GRAYTEXT:
case wxSYS_COLOUR_BTNHIGHLIGHT:
{
return *g_systemBtnHighlightColour;
};
case wxSYS_COLOUR_HIGHLIGHT:
{
return *g_systemHighlightColour;
};
case wxSYS_COLOUR_MENUTEXT:
case wxSYS_COLOUR_WINDOWTEXT:
case wxSYS_COLOUR_CAPTIONTEXT:
case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
case wxSYS_COLOUR_INFOTEXT:
{
return *wxBLACK;
};
case wxSYS_COLOUR_HIGHLIGHTTEXT:
{
return *wxWHITE;
};
case wxSYS_COLOUR_INFOBK:
case wxSYS_COLOUR_APPWORKSPACE:
{
return *wxWHITE; // ?
};
};
return *wxWHITE;
};
wxFont *g_systemFont = NULL;
wxFont wxSystemSettings::GetSystemFont( int index )
{
switch (index)
{
case wxSYS_OEM_FIXED_FONT:
case wxSYS_ANSI_FIXED_FONT:
case wxSYS_SYSTEM_FIXED_FONT:
{
return *wxNORMAL_FONT;
};
case wxSYS_ANSI_VAR_FONT:
case wxSYS_SYSTEM_FONT:
case wxSYS_DEVICE_DEFAULT_FONT:
case wxSYS_DEFAULT_GUI_FONT:
{
return *g_systemFont;
};
};
return wxNullFont;
};
int wxSystemSettings::GetSystemMetric( int index )
{
switch (index)
{
case wxSYS_SCREEN_X: return 0;
case wxSYS_SCREEN_Y: return 0;
};
return 0;
};

147
src/qt/slider.cpp Normal file
View File

@@ -0,0 +1,147 @@
/////////////////////////////////////////////////////////////////////////////
// Name: slider.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 "slider.h"
#endif
#include "wx/slider.h"
#include "wx/utils.h"
//-----------------------------------------------------------------------------
// wxSlider
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxSlider,wxControl)
wxSlider::wxSlider(void)
{
};
wxSlider::wxSlider( wxWindow *parent, wxWindowID id,
int value, int minValue, int maxValue,
const wxPoint& pos, const wxSize& size,
long style,
/* const wxValidator& validator = wxDefaultValidator, */
const wxString& name )
{
Create( parent, id, value, minValue, maxValue,
pos, size, style, name );
};
wxSlider::~wxSlider(void)
{
};
bool wxSlider::Create(wxWindow *parent, wxWindowID id,
int value, int minValue, int maxValue,
const wxPoint& pos, const wxSize& size,
long style,
/* const wxValidator& validator = wxDefaultValidator, */
const wxString& name )
{
return TRUE;
};
int wxSlider::GetValue(void) const
{
};
void wxSlider::SetValue( int value )
{
};
void wxSlider::SetRange( int minValue, int maxValue )
{
};
int wxSlider::GetMin(void) const
{
};
int wxSlider::GetMax(void) const
{
};
void wxSlider::SetPageSize( int pageSize )
{
};
int wxSlider::GetPageSize(void) const
{
};
void wxSlider::SetThumbLength( int len )
{
};
int wxSlider::GetThumbLength(void) const
{
};
void wxSlider::SetLineSize( int WXUNUSED(lineSize) )
{
};
int wxSlider::GetLineSize(void) const
{
};
void wxSlider::GetSize( int *x, int *y ) const
{
wxWindow::GetSize( x, y );
};
void wxSlider::SetSize( int x, int y, int width, int height, int sizeFlags )
{
wxWindow::SetSize( x, y, width, height, sizeFlags );
};
void wxSlider::GetPosition( int *x, int *y ) const
{
wxWindow::GetPosition( x, y );
};
void wxSlider::SetTick( int WXUNUSED(tickPos) )
{
};
void wxSlider::SetTickFreq( int WXUNUSED(n), int WXUNUSED(pos) )
{
};
int wxSlider::GetTickFreq(void) const
{
return 0;
};
void wxSlider::ClearTicks(void)
{
};
void wxSlider::SetSelection( int WXUNUSED(minPos), int WXUNUSED(maxPos) )
{
};
int wxSlider::GetSelEnd(void) const
{
return 0;
};
int wxSlider::GetSelStart(void) const
{
return 0;
};
void wxSlider::ClearSel(void)
{
};

44
src/qt/statbmp.cpp Normal file
View File

@@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////
// Name: statbmp.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 "statbmp.h"
#endif
#include "wx/statbmp.h"
//-----------------------------------------------------------------------------
// wxStaticBitmap
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap,wxControl)
wxStaticBitmap::wxStaticBitmap(void)
{
};
wxStaticBitmap::wxStaticBitmap( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, bitmap, pos, size, style, name );
};
bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
return TRUE;
};
void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap )
{
};

38
src/qt/statbox.cpp Normal file
View File

@@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////
// Name: statbox.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 "statbox.h"
#endif
#include "wx/statbox.h"
//-----------------------------------------------------------------------------
// wxStaticBox
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox,wxControl)
wxStaticBox::wxStaticBox(void)
{
};
wxStaticBox::wxStaticBox( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
};
bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
};

49
src/qt/stattext.cpp Normal file
View File

@@ -0,0 +1,49 @@
/////////////////////////////////////////////////////////////////////////////
// Name: stattext.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 "stattext.h"
#endif
#include "wx/stattext.h"
//-----------------------------------------------------------------------------
// wxStaticText
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxStaticText,wxControl)
wxStaticText::wxStaticText(void)
{
};
wxStaticText::wxStaticText( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
};
bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
return TRUE;
};
wxString wxStaticText::GetLabel(void) const
{
};
void wxStaticText::SetLabel( const wxString &label )
{
wxControl::SetLabel(label);
};

193
src/qt/tbargtk.cpp Normal file
View File

@@ -0,0 +1,193 @@
/////////////////////////////////////////////////////////////////////////////
// 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 )
{
};

235
src/qt/textctrl.cpp Normal file
View File

@@ -0,0 +1,235 @@
/////////////////////////////////////////////////////////////////////////////
// Name: textctrl.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 "textctrl.h"
#endif
#include "wx/textctrl.h"
#include "wx/utils.h"
//-----------------------------------------------------------------------------
// wxTextCtrl
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl)
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
// EVT_CHAR(wxTextCtrl::OnChar)
END_EVENT_TABLE()
wxTextCtrl::wxTextCtrl(void) : streambuf()
{
if( allocate() )
setp(base(),ebuf());
m_modified = FALSE;
};
wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
const wxPoint &pos, const wxSize &size,
int style, const wxString &name ) : streambuf()
{
if( allocate() )
setp(base(),ebuf());
m_modified = FALSE;
Create( parent, id, value, pos, size, style, name );
};
bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
const wxPoint &pos, const wxSize &size,
int style, const wxString &name )
{
return TRUE;
};
wxString wxTextCtrl::GetValue(void) const
{
return tmp;
};
void wxTextCtrl::SetValue( const wxString &value )
{
};
void wxTextCtrl::WriteText( const wxString &text )
{
};
bool wxTextCtrl::LoadFile( const wxString &WXUNUSED(file) )
{
return FALSE;
};
bool wxTextCtrl::SaveFile( const wxString &WXUNUSED(file) )
{
return FALSE;
};
/*
wxString wxTextCtrl::GetLineText( long lineNo ) const
{
};
void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event )
{
};
long wxTextCtrl::PositionToXY( long pos, long *x, long *y ) const
{
};
long wxTextCtrl::XYToPosition( long x, long y )
{
};
int wxTextCtrl::GetNumberOfLines(void)
{
};
*/
void wxTextCtrl::SetInsertionPoint( long pos )
{
};
void wxTextCtrl::SetInsertionPointEnd(void)
{
};
void wxTextCtrl::SetEditable( bool editable )
{
};
void wxTextCtrl::SetSelection( long from, long to )
{
};
void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
{
};
long wxTextCtrl::GetInsertionPoint(void) const
{
};
long wxTextCtrl::GetLastPosition(void) const
{
};
void wxTextCtrl::Remove( long from, long to )
{
};
void wxTextCtrl::Replace( long from, long to, const wxString &value )
{
};
void wxTextCtrl::Cut(void)
{
};
void wxTextCtrl::Copy(void)
{
};
void wxTextCtrl::Paste(void)
{
};
void wxTextCtrl::Delete(void)
{
};
void wxTextCtrl::OnChar( wxKeyEvent &WXUNUSED(event) )
{
};
int wxTextCtrl::overflow( int WXUNUSED(c) )
{
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 EOF;
};
int wxTextCtrl::sync(void)
{
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;
};
int wxTextCtrl::underflow(void)
{
return EOF;
};
wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
{
WriteText(s);
return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(float f)
{
static char buf[100];
sprintf(buf, "%.2f", f);
WriteText(buf);
return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(double d)
{
static char buf[100];
sprintf(buf, "%.2f", d);
WriteText(buf);
return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(int i)
{
static char buf[100];
sprintf(buf, "%i", i);
WriteText(buf);
return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(long i)
{
static char buf[100];
sprintf(buf, "%ld", i);
WriteText(buf);
return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(const char c)
{
char buf[2];
buf[0] = c;
buf[1] = 0;
WriteText(buf);
return *this;
}

65
src/qt/threadgui.inc Normal file
View File

@@ -0,0 +1,65 @@
/////////////////////////////////////////////////////////////////////////////
// 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]);
}

165
src/qt/threadno.cpp Normal file
View File

@@ -0,0 +1,165 @@
/////////////////////////////////////////////////////////////////////////////
// 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_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;
}
bool wxThread::IsMain()
{
return TRUE;
}
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.Lock();
return TRUE;
}
void wxThreadModule::OnExit()
{
wxMainMutex.Unlock();
}
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)

322
src/qt/threadpsx.cpp Normal file
View File

@@ -0,0 +1,322 @@
/////////////////////////////////////////////////////////////////////////////
// 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_CANCELED,
STATE_EXITED
};
/////////////////////////////////////////////////////////////////////////////
// Static variables
/////////////////////////////////////////////////////////////////////////////
static pthread_t p_mainid;
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;
};
void *wxThreadInternal::PthreadStart(void *ptr)
{
wxThread *thread = (wxThread *)ptr;
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;
}
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_internal->state = STATE_IDLE;
}
return status;
}
unsigned long wxThread::GetID() const
{
return (unsigned long)p_internal->thread_id;
}
void wxThread::Exit(void *status)
{
wxThread* ptr = this;
THREAD_SEND_EXIT_MSG(ptr);
p_internal->state = STATE_EXITED;
pthread_exit(status);
}
void wxThread::TestDestroy()
{
pthread_testcancel();
}
bool wxThread::IsMain()
{
return (bool)pthread_equal(pthread_self(), p_mainid);
}
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()
{
}
// Automatic initialization
class wxThreadModule : public wxModule {
DECLARE_DYNAMIC_CLASS(wxThreadModule)
public:
virtual bool OnInit() {
wxThreadGuiInit();
p_mainid = pthread_self();
wxMainMutex.Lock();
return TRUE;
}
virtual void OnExit() {
wxMainMutex.Unlock();
wxThreadGuiExit();
}
};
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)

230
src/qt/threadsgi.cpp Normal file
View File

@@ -0,0 +1,230 @@
/////////////////////////////////////////////////////////////////////////////
// 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;
}
void wxThread::Destroy()
{
if (p_internal->state == STATE_RUNNING)
p_internal->state = STATE_CANCELED;
}
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 wxThreadIsMain()
{
return (int)getpid() == main_id;
}
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() {
wxThreadGuiInit();
p_mainid = (int)getpid();
wxMainMutex.Lock();
}
virtual void OnExit() {
wxMainMutex.Unlock();
wxThreadGuiExit();
}
};
IMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule)

66
src/qt/timer.cpp Normal file
View File

@@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////
// Name: timer.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 "timer.h"
#endif
#include "wx/timer.h"
//-----------------------------------------------------------------------------
// wxTimer
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxTimer,wxObject)
gint timeout_callback( gpointer data )
{
wxTimer *timer = (wxTimer*)data;
timer->Notify();
if (timer->OneShot()) timer->Stop();
return TRUE;
};
wxTimer::wxTimer(void)
{
m_time = 1000;
m_oneShot = FALSE;
};
wxTimer::~wxTimer(void)
{
Stop();
};
int wxTimer::Interval(void)
{
return m_time;
};
bool wxTimer::OneShot(void)
{
return m_oneShot;
};
void wxTimer::Notify(void)
{
};
void wxTimer::Start( int millisecs, bool oneShot )
{
if (millisecs != -1) m_time = millisecs;
m_oneShot = oneShot;
};
void wxTimer::Stop(void)
{
};

367
src/qt/utilsgtk.cpp Normal file
View File

@@ -0,0 +1,367 @@
/////////////////////////////////////////////////////////////////////////////
// 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);
};

332
src/qt/utilsres.cpp Normal file
View File

@@ -0,0 +1,332 @@
/////////////////////////////////////////////////////////////////////////////
// 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;
};

6
src/qt/verti.xbm Normal file
View File

@@ -0,0 +1,6 @@
#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};

1048
src/qt/window.cpp Normal file

File diff suppressed because it is too large Load Diff