1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: app.h
|
|
|
|
// Purpose: wxApp class
|
1999-10-13 18:34:18 -04:00
|
|
|
// Author: David Webster
|
1999-07-29 01:11:30 -04:00
|
|
|
// Modified by:
|
1999-10-13 18:34:18 -04:00
|
|
|
// Created: 10/13/99
|
1999-07-29 01:11:30 -04:00
|
|
|
// RCS-ID: $Id$
|
1999-10-13 18:34:18 -04:00
|
|
|
// Copyright: (c) David Webster
|
1999-07-29 01:11:30 -04:00
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_APP_H_
|
|
|
|
#define _WX_APP_H_
|
|
|
|
|
2001-10-17 18:25:56 -04:00
|
|
|
#ifdef __WATCOMC__
|
|
|
|
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/select.h>
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2001-05-20 09:25:28 -04:00
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/types.h>
|
2001-05-21 16:29:42 -04:00
|
|
|
|
|
|
|
#ifdef __EMX__
|
2001-05-20 09:25:28 -04:00
|
|
|
#include <unistd.h>
|
2001-05-21 16:29:42 -04:00
|
|
|
#else
|
|
|
|
#include <utils.h>
|
|
|
|
#undef BYTE_ORDER
|
|
|
|
#include <types.h>
|
|
|
|
#define INCL_ORDERS
|
|
|
|
#endif
|
2001-05-20 09:25:28 -04:00
|
|
|
|
2001-10-17 18:25:56 -04:00
|
|
|
#endif
|
|
|
|
|
1999-07-29 01:11:30 -04:00
|
|
|
#include "wx/event.h"
|
1999-10-13 18:34:18 -04:00
|
|
|
#include "wx/icon.h"
|
1999-07-29 01:11:30 -04:00
|
|
|
|
|
|
|
class WXDLLEXPORT wxFrame;
|
|
|
|
class WXDLLEXPORT wxWindow;
|
2001-05-20 09:25:28 -04:00
|
|
|
class WXDLLEXPORT wxApp;
|
1999-07-29 01:11:30 -04:00
|
|
|
class WXDLLEXPORT wxKeyEvent;
|
|
|
|
class WXDLLEXPORT wxLog;
|
|
|
|
|
|
|
|
WXDLLEXPORT_DATA(extern wxApp*) wxTheApp;
|
1999-12-06 00:01:46 -05:00
|
|
|
WXDLLEXPORT_DATA(extern HAB) vHabmain;
|
1999-07-29 01:11:30 -04:00
|
|
|
|
|
|
|
// Force an exit from main loop
|
1999-11-14 23:50:09 -05:00
|
|
|
void WXDLLEXPORT wxExit(void);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
|
|
|
// Yield to other apps/messages
|
1999-11-14 23:50:09 -05:00
|
|
|
bool WXDLLEXPORT wxYield(void);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2000-03-19 19:20:29 -05:00
|
|
|
extern MRESULT EXPENTRY wxWndProc( HWND
|
|
|
|
,ULONG
|
|
|
|
,MPARAM
|
|
|
|
,MPARAM
|
|
|
|
);
|
|
|
|
|
2001-05-20 09:25:28 -04:00
|
|
|
|
1999-07-29 01:11:30 -04:00
|
|
|
// Represents the application. Derive OnInit and declare
|
|
|
|
// a new App object to start application
|
1999-10-13 18:34:18 -04:00
|
|
|
class WXDLLEXPORT wxApp : public wxAppBase
|
1999-07-29 01:11:30 -04:00
|
|
|
{
|
1999-10-13 18:34:18 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxApp)
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-13 18:34:18 -04:00
|
|
|
public:
|
|
|
|
wxApp();
|
|
|
|
virtual ~wxApp();
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-11-14 23:50:09 -05:00
|
|
|
virtual bool OnInitGui(void);
|
|
|
|
|
1999-10-13 18:34:18 -04:00
|
|
|
// override base class (pure) virtuals
|
1999-11-14 23:50:09 -05:00
|
|
|
virtual int MainLoop(void);
|
|
|
|
virtual void ExitMainLoop(void);
|
|
|
|
virtual bool Initialized(void);
|
|
|
|
virtual bool Pending(void) ;
|
|
|
|
virtual void Dispatch(void);
|
2003-06-23 20:56:19 -04:00
|
|
|
|
|
|
|
virtual void Exit();
|
|
|
|
|
2001-10-19 14:29:32 -04:00
|
|
|
virtual bool Yield(bool onlyIfNeeded = FALSE);
|
2003-06-23 20:56:19 -04:00
|
|
|
virtual void WakeUpIdle(void);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-11-14 23:50:09 -05:00
|
|
|
virtual void SetPrintMode(int mode) { m_nPrintMode = mode; }
|
|
|
|
virtual int GetPrintMode(void) const { return m_nPrintMode; }
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-13 18:34:18 -04:00
|
|
|
// implementation only
|
1999-11-14 23:50:09 -05:00
|
|
|
void OnIdle(wxIdleEvent& rEvent);
|
|
|
|
void OnEndSession(wxCloseEvent& rEvent);
|
|
|
|
void OnQueryEndSession(wxCloseEvent& rEvent);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2001-05-20 09:25:28 -04:00
|
|
|
int AddSocketHandler(int handle, int mask,
|
|
|
|
void (*callback)(void*), void * gsock);
|
|
|
|
void RemoveSocketHandler(int handle);
|
|
|
|
void HandleSockets();
|
|
|
|
|
1999-07-29 01:11:30 -04:00
|
|
|
protected:
|
1999-11-14 23:50:09 -05:00
|
|
|
bool m_bShowOnInit;
|
|
|
|
int m_nPrintMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-11-14 23:50:09 -05:00
|
|
|
//
|
|
|
|
// PM-specific wxApp definitions */
|
|
|
|
//
|
2001-05-20 09:25:28 -04:00
|
|
|
private:
|
2001-05-21 16:29:42 -04:00
|
|
|
int m_maxSocketHandles;
|
|
|
|
int m_maxSocketNr;
|
|
|
|
int m_lastUsedHandle;
|
|
|
|
fd_set m_readfds;
|
|
|
|
fd_set m_writefds;
|
|
|
|
void* m_sockCallbackInfo;
|
2001-05-20 09:25:28 -04:00
|
|
|
|
1999-10-13 18:34:18 -04:00
|
|
|
public:
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-13 18:34:18 -04:00
|
|
|
// Implementation
|
2003-06-30 16:02:05 -04:00
|
|
|
virtual bool Initialize(int& argc, wxChar **argv);
|
2003-06-30 14:43:09 -04:00
|
|
|
virtual void CleanUp(void);
|
1999-10-13 18:34:18 -04:00
|
|
|
|
1999-11-14 23:50:09 -05:00
|
|
|
static bool RegisterWindowClasses(HAB vHab);
|
2001-06-08 11:23:14 -04:00
|
|
|
virtual void DoMessage(WXMSG *pMsg);
|
1999-11-14 23:50:09 -05:00
|
|
|
virtual bool DoMessage(void);
|
1999-10-13 18:34:18 -04:00
|
|
|
virtual bool ProcessMessage(WXMSG* pMsg);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
|
|
|
public:
|
1999-11-14 23:50:09 -05:00
|
|
|
int m_nCmdShow;
|
2001-05-20 09:25:28 -04:00
|
|
|
HMQ m_hMq;
|
1999-07-29 01:11:30 -04:00
|
|
|
|
|
|
|
protected:
|
1999-11-14 23:50:09 -05:00
|
|
|
bool m_bKeepGoing ;
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-10-13 18:34:18 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
1999-07-29 01:11:30 -04:00
|
|
|
};
|
|
|
|
|
1999-11-14 23:50:09 -05:00
|
|
|
int WXDLLEXPORT wxEntry( int argc, char *argv[] );
|
1999-07-29 01:11:30 -04:00
|
|
|
#endif
|
|
|
|
// _WX_APP_H_
|
|
|
|
|