///////////////////////////////////////////////////////////////////////////////
-// Name: mac/toplevel.cpp
+// Name: src/mac/classic/toplevel.cpp
// Purpose: implements wxTopLevelWindow for Mac
// Author: Stefan Csomor
// Modified by:
// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
- #pragma implementation "toplevel.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
event.m_x = point.h;
event.m_y = point.v;
- event.m_timeStamp = when;
+ event.SetTimestamp(when);
wxWindow* focus = wxWindow::FindFocus() ;
event.SetEventObject(focus);
if ( button == 0 || GetEventKind( event ) == kEventMouseUp )
modifiers += btnState ;
- // temporary hack to support true two button mouse
- if ( button == kEventMouseButtonSecondary )
- {
- modifiers |= controlKey ;
- }
+ // temporary hack to support true two button mouse
+ if ( button == kEventMouseButtonSecondary )
+ {
+ modifiers |= controlKey ;
+ }
WindowRef window ;
short windowPart = ::FindWindow(point, &window);
// either we really are active or we are capturing mouse events
- if ( (IsWindowActive(window) && windowPart == inContent) ||
+ if ( (IsWindowActive(window) && windowPart == inContent) ||
(wxTheApp->s_captureWindow && wxTheApp->s_captureWindow->MacGetTopLevelWindow() == toplevelWindow) )
{
switch ( GetEventKind( event ) )
NULL, sizeof(Point), NULL, &mouseLoc) == noErr)
{
wxMouseEvent wheelEvent(wxEVT_MOUSEWHEEL);
-
+
wheelEvent.m_x = mouseLoc.h;
wheelEvent.m_y = mouseLoc.v;
-
+
wheelEvent.m_wheelRotation = delta;
wheelEvent.m_wheelDelta = 1;
wheelEvent.m_linesPerAction = 1;
wxWindow* currentMouseWindow = NULL;
wxWindow::MacGetWindowFromPoint(wxPoint(mouseLoc.h, mouseLoc.v), ¤tMouseWindow);
-
+
if (currentMouseWindow)
{
currentMouseWindow->GetEventHandler()->ProcessEvent(wheelEvent);
toplevelWindow->MacActivate( EventTimeToTicks( GetEventTime( event ) ) , false) ;
result = noErr ;
break ;
- case kEventWindowShown :
- toplevelWindow->Refresh() ;
- result = noErr ;
- break ;
+ case kEventWindowShown :
+ toplevelWindow->Refresh() ;
+ result = noErr ;
+ break ;
case kEventWindowClose :
toplevelWindow->Close() ;
result = noErr ;
wxSize formerSize = toplevelWindow->GetSize() ;
- if ( (attributes & kWindowBoundsChangeSizeChanged ) ||
+ if ( (attributes & kWindowBoundsChangeSizeChanged ) ||
( attributes & kWindowBoundsChangeOriginChanged ) )
toplevelWindow->SetSize( newContentRect.left , newContentRect.top ,
newContentRect.right - newContentRect.left ,
newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING);
-
+
int x , y , w , h ;
toplevelWindow->GetPosition( &x , &y ) ;
toplevelWindow->GetSize( &w , &h ) ;
{
SetEventParameter( event , kEventParamCurrentBounds , typeQDRectangle, sizeof( adjustedRect ) , &adjustedRect ) ;
}
-
+
if ( toplevelWindow->GetSize() != formerSize )
toplevelWindow->Update() ;
-
+
result = noErr ;
}
break ;
WXWindow wxTopLevelWindowMac::s_macWindowInUpdate = NULL;
wxTopLevelWindowMac *wxTopLevelWindowMac::s_macDeactivateWindow = NULL;
-bool wxTopLevelWindowMac::s_macWindowCompositing = FALSE;
+bool wxTopLevelWindowMac::s_macWindowCompositing = false;
void wxTopLevelWindowMac::Init()
{
m_iconized =
- m_maximizeOnShow = FALSE;
+ m_maximizeOnShow = false;
m_macNoEraseUpdateRgn = NewRgn() ;
m_macNeedsErasing = false ;
m_macWindow = NULL ;
- m_macUsesCompositing = FALSE ;
+ m_macUsesCompositing = false ;
#if TARGET_CARBON
m_macEventHandler = NULL ;
#endif
if ( parent )
parent->AddChild(this);
- return TRUE;
+ return true;
}
wxTopLevelWindowMac::~wxTopLevelWindowMac()
OSStatus err = noErr ;
SetName(name);
m_windowStyle = style;
- m_isShown = FALSE;
+ m_isShown = false;
// create frame.
#endif
#endif
- //this setup lets us have compositing and non-compositing
- //windows in the same application.
-
-#if UNIVERSAL_INTERFACES_VERSION >= 0x0400
+ //this setup lets us have compositing and non-compositing
+ //windows in the same application.
+
+#if UNIVERSAL_INTERFACES_VERSION >= 0x0400
if ( wxTopLevelWindowMac::s_macWindowCompositing )
{
attr |= kWindowCompositingAttribute;
- m_macUsesCompositing = TRUE;
+ m_macUsesCompositing = true;
}
else
#endif
{
- m_macUsesCompositing = FALSE;
+ m_macUsesCompositing = false;
}
-
+
#if TARGET_CARBON
if ( HasFlag(wxFRAME_SHAPED) )
{
bool wxTopLevelWindowMac::MacEnableCompositing( bool useCompositing )
{
bool oldval = s_macWindowCompositing;
- s_macWindowCompositing = useCompositing;
- return oldval;
+ s_macWindowCompositing = useCompositing;
+ return oldval;
}
void wxTopLevelWindowMac::MacGetPortParams(WXPOINTPTR localOrigin, WXRECTPTR clipRect, WXWindow *window , wxWindowMac** rootwin)
event.m_leftDown = isDown && !controlDown;
- event.m_middleDown = FALSE;
+ event.m_middleDown = false;
event.m_rightDown = isDown && controlDown;
if ( kind == mouseDown )
if ( abs( localwhere.h - gs_lastWhere.h ) < 3 && abs( localwhere.v - gs_lastWhere.v ) < 3 )
{
// This is not right if the second mouse down
- // event occured in a differen window. We
+ // event occurred in a different window. We
// correct this in MacDispatchMouseEvent.
if ( controlDown )
event.SetEventType(wxEVT_RIGHT_DCLICK ) ;
event.m_x += m_x;
event.m_y += m_y;
- event.m_timeStamp = timestamp;
+ event.SetTimestamp(timestamp);
event.SetEventObject(this);
if ( wxTheApp->s_captureWindow )
{
s_macDeactivateWindow=NULL;
MacDelayedDeactivation(timestamp);
wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId);
- event.m_timeStamp = timestamp ;
+ event.SetTimestamp(timestamp);
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
long osVersion = UMAGetSystemVersion();
if (osVersion >= 0x1000 && osVersion < 0x1020 )
{
- Refresh(TRUE);
+ Refresh(true);
}
else
{
// for the moment we have to resolve some redrawing issues like this
// the OS is stealing some redrawing areas as soon as it draws a control
- Refresh(TRUE);
+ Refresh(true);
}
}
void wxTopLevelWindowMac::SetTitle(const wxString& title)
{
- wxWindow::SetTitle( title ) ;
+ wxWindow::SetLabel( title ) ;
UMASetWTitle( (WindowRef)m_macWindow , title , m_font.GetEncoding() ) ;
}
+wxString wxTopLevelWindowMac::GetTitle() const
+{
+ return wxWindow::GetLabel();
+}
+
bool wxTopLevelWindowMac::Show(bool show)
{
if ( !wxWindow::Show(show) )
- return FALSE;
+ return false;
if (show)
{
- #if wxUSE_SYSTEM_OPTIONS //code contributed by Ryan Wilcox December 18, 2003
+ #if wxUSE_SYSTEM_OPTIONS //code contributed by Ryan Wilcox December 18, 2003
if ( (wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) ) && ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1) )
{
::ShowWindow( (WindowRef)m_macWindow );
Refresh() ;
}
- return TRUE;
+ return true;
}
void wxTopLevelWindowMac::DoMoveWindow(int x, int y, int width, int height)
wxFrame* frame = (wxFrame*) this ;
#if wxUSE_STATUSBAR
frame->PositionStatusBar();
-#endif
+#endif
#if wxUSE_TOOLBAR
frame->PositionToolBar();
-#endif
+#endif
}
if ( doMove )
wxWindowMac::MacTopLevelWindowChangedPosition() ; // like this only children will be notified
bool wxTopLevelWindowMac::SetShape(const wxRegion& region)
{
- wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE,
+ wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), false,
_T("Shaped windows must be created with the wxFRAME_SHAPED style."));
#if TARGET_CARBON
// Tell the window manager that the window has changed shape
ReshapeCustomWindow((WindowRef)MacGetWindowRef());
- return TRUE;
+ return true;
#else
- return FALSE;
+ return false;
#endif
}
if (cachedRegion)
{
Rect windowRect;
- wxShapedMacWindowGetPos(window, &windowRect); //how big is the window
- CopyRgn(cachedRegion, rgn); //make a copy of our cached region
+ wxShapedMacWindowGetPos(window, &windowRect); //how big is the window
+ CopyRgn(cachedRegion, rgn); //make a copy of our cached region
OffsetRgn(rgn, windowRect.left, windowRect.top); // position it over window
- //MapRgn(rgn, &mMaskSize, &windowRect); //scale it to our actual window size
+ //MapRgn(rgn, &mMaskSize, &windowRect); //scale it to our actual window size
}
}
static RgnHandle tempRgn=nil;
if(!tempRgn)
- tempRgn=NewRgn();
+ tempRgn=NewRgn();
SetPt(&hitPoint,LoWord(param),HiWord(param));//get the point clicked
#endif
// ---------------------------------------------------------------------------
-