/////////////////////////////////////////////////////////////////////////////
-// Name: app.cpp
+// Name: src/mac/classic/app.cpp
// Purpose: wxApp
// Author: Stefan Csomor
// Modified by:
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include "wx/defs.h"
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#include "wx/app.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/intl.h"
+#endif
#include "wx/window.h"
#include "wx/frame.h"
#include "wx/button.h"
-#include "wx/app.h"
#include "wx/utils.h"
#include "wx/gdicmn.h"
#include "wx/pen.h"
#include "wx/brush.h"
#include "wx/cursor.h"
-#include "wx/intl.h"
#include "wx/icon.h"
#include "wx/palette.h"
#include "wx/dc.h"
// statics for implementation
-static bool s_inYield = FALSE;
+static bool s_inYield = false;
#if TARGET_CARBON
-static bool s_inReceiveEvent = FALSE ;
+static bool s_inReceiveEvent = false ;
static EventTime sleepTime = kEventDurationNoWait ;
#else
static long sleepTime = 0 ;
{
wxCommandEvent exitEvent(wxEVT_COMMAND_MENU_SELECTED, s_macExitMenuItemId);
if (!win->ProcessEvent(exitEvent))
- win->Close(TRUE ) ;
+ win->Close(true) ;
}
else
{
if (printout)
{
wxPrinter printer;
- printer.Print(view->GetFrame(), printout, TRUE);
+ printer.Print(view->GetFrame(), printout, true);
delete printout;
}
}
MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar();
-
+
if ( mbar )
{
wxFrame* win = mbar->GetFrame();
if ( win )
{
-
+
// VZ: we could find the menu from its handle here by examining all
// the menus in the menu bar recursively but knowing that neither
// wxMSW nor wxGTK do it why bother...
&menuRef);
#endif // 0
- wxEventType type=0;
+ wxEventType type=0;
MenuCommand cmd=0;
switch (GetEventKind(event))
{
UMAShowArrowCursor() ;
ParamText("\pFatal Error", message, (ConstStr255Param)"\p", (ConstStr255Param)"\p");
itemHit = Alert(128, nil);
- return FALSE ;
+ return false ;
}
#ifndef __DARWIN__
#endif
}
- return TRUE ;
+ return true ;
}
void wxApp::CleanUp()
wxApp::wxApp()
{
- m_printMode = wxPRINT_WINDOWS;
- m_auto3D = TRUE;
+ m_printMode = wxPRINT_WINDOWS;
+ m_auto3D = true;
- m_macCurrentEvent = NULL ;
+ m_macCurrentEvent = NULL ;
#if TARGET_CARBON
- m_macCurrentEventHandlerCallRef = NULL ;
+ m_macCurrentEventHandlerCallRef = NULL ;
#endif
}
int wxApp::MainLoop()
{
- m_keepGoing = TRUE;
+ m_keepGoing = true;
while (m_keepGoing)
{
void wxApp::ExitMainLoop()
{
- m_keepGoing = FALSE;
+ m_keepGoing = false;
}
// Is a message/event pending?
// without the receive event (with pull param = false ) nothing is ever reported
EventRef theEvent;
ReceiveNextEvent (0, NULL, kEventDurationNoWait, false, &theEvent);
- return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
+ return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
#else
EventRecord event ;
void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event))
{
if (GetTopWindow())
- GetTopWindow()->Close(TRUE);
+ GetTopWindow()->Close(true);
}
// Default behaviour: close the application with prompts. The
if (GetTopWindow())
{
if (!GetTopWindow()->Close(!event.CanVeto()))
- event.Veto(TRUE);
+ event.Veto(true);
}
}
wxFAIL_MSG( wxT("wxYield called recursively" ) );
}
- return FALSE;
+ return false;
}
- s_inYield = TRUE;
+ s_inYield = true;
#if wxUSE_THREADS
YieldToAnyThread() ;
#endif
wxMacProcessNotifierAndPendingEvents() ;
- s_inYield = FALSE;
+ s_inYield = false;
- return TRUE;
+ return true;
}
// platform specifics
/*virtual*/ void wxApp::MacHandleUnhandledEvent( WXEVENTREF evr )
{
- // Override to process unhandled events as you please
+ // Override to process unhandled events as you please
}
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
{
// we must avoid reentrancy problems when processing high level events eg printing
bool former = s_inYield ;
- s_inYield = TRUE ;
+ s_inYield = true ;
EventRecord* ev = (EventRecord*) evr ;
::AEProcessAppleEvent( ev ) ;
s_inYield = former ;
wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key !=
WXK_MBUTTON, wxT("can't use wxGetKeyState() for mouse buttons"));
- KeyMap keymap;
+ KeyMap keymap;
GetKeys(keymap);
return !!(BitTst(keymap, (sizeof(KeyMap)*8) - key));
}
}
if (!handled)
{
- event.Skip( FALSE ) ;
+ event.Skip( false ) ;
event.SetEventType( wxEVT_CHAR ) ;
// raw value again
event.m_keyCode = realkeyval ;
bool controlDown = ev->modifiers & controlKey ; // for simulating right mouse
event.m_leftDown = isDown && !controlDown;
- event.m_middleDown = FALSE;
+ event.m_middleDown = false;
event.m_rightDown = isDown && controlDown;
event.m_shiftDown = ev->modifiers & shiftKey;
event.m_controlDown = ev->modifiers & controlKey;
event.m_leftDown = isDown && !controlDown;
- event.m_middleDown = FALSE;
+ event.m_middleDown = false;
event.m_rightDown = isDown && controlDown;
event.m_shiftDown = modifiers & shiftKey;