1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: app.h
|
|
|
|
// Purpose: wxApp class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_APP_H_
|
|
|
|
#define _WX_APP_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "app.h"
|
|
|
|
#endif
|
|
|
|
|
1999-01-15 19:13:58 -05:00
|
|
|
#include "wx/event.h"
|
1999-07-05 07:22:45 -04:00
|
|
|
#include "wx/icon.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
class WXDLLEXPORT wxFrame;
|
|
|
|
class WXDLLEXPORT wxWindow;
|
|
|
|
class WXDLLEXPORT wxApp ;
|
|
|
|
class WXDLLEXPORT wxKeyEvent;
|
|
|
|
class WXDLLEXPORT wxLog;
|
|
|
|
|
|
|
|
// Represents the application. Derive OnInit and declare
|
|
|
|
// a new App object to start application
|
1999-07-05 20:44:26 -04:00
|
|
|
class WXDLLEXPORT wxApp : public wxAppBase
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
1999-07-05 20:44:26 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxApp)
|
1998-10-14 19:53:24 -04:00
|
|
|
|
1999-07-05 20:44:26 -04:00
|
|
|
public:
|
|
|
|
wxApp();
|
|
|
|
virtual ~wxApp();
|
1998-07-29 08:00:17 -04:00
|
|
|
|
1999-07-05 20:44:26 -04:00
|
|
|
// override base class (pure) virtuals
|
|
|
|
virtual int MainLoop();
|
|
|
|
virtual void ExitMainLoop();
|
|
|
|
virtual bool Initialized();
|
2001-06-26 16:59:19 -04:00
|
|
|
virtual bool Pending();
|
|
|
|
virtual void Dispatch();
|
2001-10-19 14:29:32 -04:00
|
|
|
virtual bool Yield(bool onlyIfNeeded = FALSE);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-07-05 20:44:26 -04:00
|
|
|
virtual void SetPrintMode(int mode) { m_printMode = mode; }
|
|
|
|
virtual int GetPrintMode() const { return m_printMode; }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-07-05 20:44:26 -04:00
|
|
|
// implementation only
|
|
|
|
void OnIdle(wxIdleEvent& event);
|
|
|
|
void OnEndSession(wxCloseEvent& event);
|
|
|
|
void OnQueryEndSession(wxCloseEvent& event);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-07-05 20:44:26 -04:00
|
|
|
// Send idle event to all top-level windows.
|
|
|
|
// Returns TRUE if more idle time is requested.
|
|
|
|
bool SendIdleEvents();
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-07-05 20:44:26 -04:00
|
|
|
// Send idle event to window and all subwindows
|
|
|
|
// Returns TRUE if more idle time is requested.
|
|
|
|
bool SendIdleEvents(wxWindow* win);
|
1998-05-27 19:05:10 -04:00
|
|
|
|
1999-07-05 20:44:26 -04:00
|
|
|
void SetAuto3D(bool flag) { m_auto3D = flag; }
|
|
|
|
bool GetAuto3D() const { return m_auto3D; }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
protected:
|
2001-06-26 16:59:19 -04:00
|
|
|
bool m_showOnInit;
|
|
|
|
int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
|
|
|
|
bool m_auto3D ; // Always use 3D controls, except where overriden
|
1999-07-05 20:44:26 -04:00
|
|
|
|
|
|
|
/* Windows-specific wxApp definitions */
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
1999-07-05 20:44:26 -04:00
|
|
|
// Implementation
|
|
|
|
static bool Initialize();
|
|
|
|
static void CleanUp();
|
|
|
|
|
|
|
|
static bool RegisterWindowClasses();
|
2001-08-22 10:42:54 -04:00
|
|
|
static bool UnregisterWindowClasses();
|
2001-06-07 21:47:15 -04:00
|
|
|
|
1999-07-05 20:44:26 -04:00
|
|
|
// Convert Windows to argc, argv style
|
2001-11-25 16:36:28 -05:00
|
|
|
void ConvertToStandardCommandArgs(const char* p);
|
2001-06-07 21:47:15 -04:00
|
|
|
|
|
|
|
// message processing
|
|
|
|
// ------------------
|
|
|
|
|
|
|
|
// process the given message
|
|
|
|
virtual void DoMessage(WXMSG *pMsg);
|
|
|
|
|
|
|
|
// retrieve the next message from the queue and process it
|
1999-07-05 20:44:26 -04:00
|
|
|
virtual bool DoMessage();
|
2001-06-07 21:47:15 -04:00
|
|
|
|
|
|
|
// preprocess the message
|
1999-07-05 20:44:26 -04:00
|
|
|
virtual bool ProcessMessage(WXMSG* pMsg);
|
2001-06-07 21:47:15 -04:00
|
|
|
|
|
|
|
// idle processing
|
|
|
|
// ---------------
|
|
|
|
|
1999-07-05 20:44:26 -04:00
|
|
|
void DeletePendingObjects();
|
|
|
|
bool ProcessIdle();
|
1999-11-24 07:30:56 -05:00
|
|
|
|
|
|
|
#if wxUSE_RICHEDIT
|
|
|
|
// initialize the richedit DLL of (at least) given version, return TRUE if
|
|
|
|
// ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3)
|
|
|
|
static bool InitRichEdit(int version = 2);
|
|
|
|
#endif // wxUSE_RICHEDIT
|
|
|
|
|
|
|
|
// returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it
|
|
|
|
// wasn't found at all
|
|
|
|
static int GetComCtl32Version();
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
public:
|
1999-07-05 20:44:26 -04:00
|
|
|
int m_nCmdShow;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
protected:
|
2001-06-26 16:59:19 -04:00
|
|
|
bool m_keepGoing;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-07-05 20:44:26 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#if !defined(_WINDLL) || (defined(_WINDLL) && defined(WXMAKINGDLL))
|
1999-12-16 16:29:54 -05:00
|
|
|
int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance, WXHINSTANCE hPrevInstance,
|
|
|
|
char *lpszCmdLine, int nCmdShow, bool enterLoop = TRUE);
|
1998-05-20 10:12:05 -04:00
|
|
|
#else
|
|
|
|
int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_APP_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|