replaced by stubs files
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
525
src/qt/app.cpp
525
src/qt/app.cpp
@@ -1,10 +1,11 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: app.cpp
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Created: 01/02/97
|
||||
// Id:
|
||||
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
|
||||
// Purpose: wxApp
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -12,223 +13,60 @@
|
||||
#pragma implementation "app.h"
|
||||
#endif
|
||||
|
||||
#include "wx/frame.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/postscrp.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/pen.h"
|
||||
#include "wx/brush.h"
|
||||
#include "wx/cursor.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/palette.h"
|
||||
#include "wx/dc.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/msgdlg.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/memory.h"
|
||||
#include "wx/module.h"
|
||||
|
||||
#include "unistd.h"
|
||||
#if USE_WX_RESOURCES
|
||||
#include "wx/resource.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
wxApp *wxTheApp = NULL;
|
||||
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__WIN95__) && !defined(__GNUWIN32__)
|
||||
extern char *wxBuffer;
|
||||
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)
|
||||
wxApp *wxTheApp = NULL;
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
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
|
||||
*/
|
||||
|
||||
long wxApp::sm_lastMessageTime = 0;
|
||||
|
||||
void wxApp::CommonInit()
|
||||
{
|
||||
#ifdef __WXMSW__
|
||||
wxBuffer = new char[1500];
|
||||
#else
|
||||
wxBuffer = new char[BUFSIZ + 512];
|
||||
#endif
|
||||
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
|
||||
wxTheColourDatabase->Initialize();
|
||||
wxInitializeStockObjects();
|
||||
|
||||
#if USE_WX_RESOURCES
|
||||
wxInitializeResourceSystem();
|
||||
#endif
|
||||
|
||||
// For PostScript printing
|
||||
#if USE_POSTSCRIPT
|
||||
wxInitializePrintSetupData();
|
||||
@@ -236,36 +74,55 @@ void wxApp::CommonInit(void)
|
||||
wxThePrintPaperDatabase->CreateDatabase();
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
wxBitmap::InitStandardHandlers();
|
||||
|
||||
g_globalCursor = new wxCursor;
|
||||
*/
|
||||
|
||||
wxInitializeStockObjects();
|
||||
};
|
||||
|
||||
void wxApp::CommonCleanUp(void)
|
||||
{
|
||||
wxDeleteStockObjects();
|
||||
|
||||
wxFlushResources();
|
||||
};
|
||||
|
||||
wxLog *wxApp::CreateLogTarget()
|
||||
{
|
||||
return new wxLogGui;
|
||||
wxModule::RegisterModules();
|
||||
wxASSERT( wxModule::InitializeModules() == TRUE );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxEntry
|
||||
//-----------------------------------------------------------------------------
|
||||
void wxApp::CommonCleanUp()
|
||||
{
|
||||
wxModule::CleanUpModules();
|
||||
|
||||
#if USE_WX_RESOURCES
|
||||
wxCleanUpResourceSystem();
|
||||
#endif
|
||||
|
||||
wxDeleteStockObjects() ;
|
||||
|
||||
// Destroy all GDI lists, etc.
|
||||
delete wxTheBrushList;
|
||||
wxTheBrushList = NULL;
|
||||
|
||||
delete wxThePenList;
|
||||
wxThePenList = NULL;
|
||||
|
||||
delete wxTheFontList;
|
||||
wxTheFontList = NULL;
|
||||
|
||||
delete wxTheBitmapList;
|
||||
wxTheBitmapList = NULL;
|
||||
|
||||
delete wxTheColourDatabase;
|
||||
wxTheColourDatabase = NULL;
|
||||
|
||||
#if USE_POSTSCRIPT
|
||||
wxInitializePrintSetupData(FALSE);
|
||||
delete wxThePrintPaperDatabase;
|
||||
wxThePrintPaperDatabase = NULL;
|
||||
#endif
|
||||
|
||||
wxBitmap::CleanUpHandlers();
|
||||
|
||||
delete[] wxBuffer;
|
||||
wxBuffer = NULL;
|
||||
|
||||
// do it as the very last thing because everything else can log messages
|
||||
delete wxLog::SetActiveTarget(NULL);
|
||||
}
|
||||
|
||||
int wxEntry( int argc, char *argv[] )
|
||||
{
|
||||
wxBuffer = new char[BUFSIZ + 512];
|
||||
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT
|
||||
@@ -288,13 +145,7 @@ int wxEntry( int argc, char *argv[] )
|
||||
return 0;
|
||||
};
|
||||
|
||||
wxAppInitializerFunction app_ini = wxApp::GetInitializerFunction();
|
||||
|
||||
wxObject *test_app = app_ini();
|
||||
|
||||
wxTheApp = (wxApp*) test_app;
|
||||
|
||||
// wxTheApp = (wxApp*)( app_ini() );
|
||||
wxTheApp = (* wxApp::GetInitializerFunction()) ();
|
||||
};
|
||||
|
||||
if (!wxTheApp)
|
||||
@@ -303,15 +154,14 @@ int wxEntry( int argc, char *argv[] )
|
||||
return 0;
|
||||
};
|
||||
|
||||
// printf( "Programmstart.\n" );
|
||||
|
||||
wxTheApp->argc = argc;
|
||||
wxTheApp->argv = argv;
|
||||
|
||||
// Your init here !!!!
|
||||
|
||||
// TODO: your platform-specific initialization.
|
||||
|
||||
wxApp::CommonInit();
|
||||
|
||||
// GUI-specific initialization, such as creating an app context.
|
||||
wxTheApp->OnInitGui();
|
||||
|
||||
// Here frames insert themselves automatically
|
||||
@@ -349,18 +199,197 @@ int wxEntry( int argc, char *argv[] )
|
||||
return retValue;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// main()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if defined(AIX) || defined(AIX4) || defined(____HPUX__)
|
||||
|
||||
// main in IMPLEMENT_WX_MAIN in IMPLEMENT_APP in app.h
|
||||
// Static member initialization
|
||||
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
|
||||
|
||||
wxApp::wxApp()
|
||||
{
|
||||
m_topWindow = NULL;
|
||||
wxTheApp = this;
|
||||
m_className = "";
|
||||
m_wantDebugOutput = TRUE ;
|
||||
m_appName = "";
|
||||
argc = 0;
|
||||
argv = NULL;
|
||||
#ifdef __WXMSW__
|
||||
m_printMode = wxPRINT_WINDOWS;
|
||||
#else
|
||||
|
||||
int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
|
||||
|
||||
m_printMode = wxPRINT_POSTSCRIPT;
|
||||
#endif
|
||||
m_exitOnFrameDelete = TRUE;
|
||||
m_auto3D = TRUE;
|
||||
}
|
||||
|
||||
bool wxApp::Initialized()
|
||||
{
|
||||
if (GetTopWindow())
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int wxApp::MainLoop()
|
||||
{
|
||||
m_keepGoing = TRUE;
|
||||
|
||||
/* TODO: implement your main loop here, calling ProcessIdle in idle time.
|
||||
while (m_keepGoing)
|
||||
{
|
||||
while (!::PeekMessage(&s_currentMsg, 0, 0, 0, PM_NOREMOVE) &&
|
||||
ProcessIdle()) {}
|
||||
if (!DoMessage())
|
||||
m_keepGoing = FALSE;
|
||||
}
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Returns TRUE if more time is needed.
|
||||
bool wxApp::ProcessIdle()
|
||||
{
|
||||
wxIdleEvent event;
|
||||
event.SetEventObject(this);
|
||||
ProcessEvent(event);
|
||||
|
||||
return event.MoreRequested();
|
||||
}
|
||||
|
||||
void wxApp::ExitMainLoop()
|
||||
{
|
||||
m_keepGoing = FALSE;
|
||||
}
|
||||
|
||||
// Is a message/event pending?
|
||||
bool wxApp::Pending()
|
||||
{
|
||||
/* TODO.
|
||||
*/
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Dispatch a message.
|
||||
void wxApp::Dispatch()
|
||||
{
|
||||
/* TODO.
|
||||
*/
|
||||
}
|
||||
|
||||
void wxApp::OnIdle(wxIdleEvent& event)
|
||||
{
|
||||
static bool inOnIdle = FALSE;
|
||||
|
||||
// Avoid recursion (via ProcessEvent default case)
|
||||
if (inOnIdle)
|
||||
return;
|
||||
|
||||
inOnIdle = TRUE;
|
||||
|
||||
// 'Garbage' collection of windows deleted with Close().
|
||||
DeletePendingObjects();
|
||||
|
||||
// flush the logged messages if any
|
||||
wxLog *pLog = wxLog::GetActiveTarget();
|
||||
if ( pLog != NULL && pLog->HasPendingMessages() )
|
||||
pLog->Flush();
|
||||
|
||||
// Send OnIdle events to all windows
|
||||
bool needMore = SendIdleEvents();
|
||||
|
||||
if (needMore)
|
||||
event.RequestMore(TRUE);
|
||||
|
||||
inOnIdle = FALSE;
|
||||
}
|
||||
|
||||
// Send idle event to all top-level windows
|
||||
bool wxApp::SendIdleEvents()
|
||||
{
|
||||
bool needMore = FALSE;
|
||||
wxNode* node = wxTopLevelWindows.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow* win = (wxWindow*) node->Data();
|
||||
if (SendIdleEvents(win))
|
||||
needMore = TRUE;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
return needMore;
|
||||
}
|
||||
|
||||
// Send idle event to window and all subwindows
|
||||
bool wxApp::SendIdleEvents(wxWindow* win)
|
||||
{
|
||||
bool needMore = FALSE;
|
||||
|
||||
wxIdleEvent event;
|
||||
event.SetEventObject(win);
|
||||
win->ProcessEvent(event);
|
||||
|
||||
if (event.MoreRequested())
|
||||
needMore = TRUE;
|
||||
|
||||
wxNode* node = win->GetChildren()->First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow* win = (wxWindow*) node->Data();
|
||||
if (SendIdleEvents(win))
|
||||
needMore = TRUE;
|
||||
|
||||
node = node->Next();
|
||||
}
|
||||
return needMore ;
|
||||
}
|
||||
|
||||
void wxApp::DeletePendingObjects()
|
||||
{
|
||||
wxNode *node = wxPendingDelete.First();
|
||||
while (node)
|
||||
{
|
||||
wxObject *obj = (wxObject *)node->Data();
|
||||
|
||||
delete obj;
|
||||
|
||||
if (wxPendingDelete.Member(obj))
|
||||
delete node;
|
||||
|
||||
// Deleting one object may have deleted other pending
|
||||
// objects, so start from beginning of list again.
|
||||
node = wxPendingDelete.First();
|
||||
}
|
||||
}
|
||||
|
||||
wxLog* wxApp::CreateLogTarget()
|
||||
{
|
||||
return new wxLogGui;
|
||||
}
|
||||
|
||||
wxWindow* wxApp::GetTopWindow() const
|
||||
{
|
||||
if (m_topWindow)
|
||||
return m_topWindow;
|
||||
else if (wxTopLevelWindows.Number() > 0)
|
||||
return (wxWindow*) wxTopLevelWindows.First()->Data();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxExit()
|
||||
{
|
||||
wxApp::CommonCleanUp();
|
||||
/*
|
||||
* TODO: Exit in some platform-specific way. Not recommended that the app calls this:
|
||||
* only for emergencies.
|
||||
*/
|
||||
}
|
||||
|
||||
// Yield to other processes
|
||||
bool wxYield()
|
||||
{
|
||||
/*
|
||||
* TODO
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user