g++ 4/wxMAC_USE_CORE_GRAPHICS warning fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36513 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-12-21 16:12:48 +00:00
parent 6c28639791
commit fe224552a9
3 changed files with 61 additions and 60 deletions

View File

@@ -325,10 +325,10 @@ bool wxNotebook::InsertPage(size_t nPage,
int wxNotebook::HitTest(const wxPoint& pt, long * flags) const int wxNotebook::HitTest(const wxPoint& pt, long * flags) const
{ {
int resultV = wxNOT_FOUND; int resultV = wxNOT_FOUND;
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
const int countPages = GetPageCount(); const int countPages = GetPageCount();
HIPoint hipoint= { pt.x , pt.y } ; HIPoint hipoint= { pt.x , pt.y } ;
HIViewPartCode outPart = 0 ; HIViewPartCode outPart = 0 ;
OSStatus err = HIViewGetPartHit ( OSStatus err = HIViewGetPartHit (
@@ -336,12 +336,12 @@ int wxNotebook::HitTest(const wxPoint& pt, long * flags) const
&hipoint , &hipoint ,
&outPart &outPart
); );
int max = m_peer->GetMaximum() ; int max = m_peer->GetMaximum() ;
if ( outPart == 0 && max > 0 ) if ( outPart == 0 && max > 0 )
{ {
// this is a hack, as unfortunately a hit on an already selected tab returns 0, // this is a hack, as unfortunately a hit on an already selected tab returns 0,
// so we have to go some extra miles to make sure we select something different // so we have to go some extra miles to make sure we select something different
// and try again .. // and try again ..
int val = m_peer->GetValue() ; int val = m_peer->GetValue() ;
int maxval = max ; int maxval = max ;
@@ -355,30 +355,30 @@ int wxNotebook::HitTest(const wxPoint& pt, long * flags) const
m_peer->SetValue( maxval ) ; m_peer->SetValue( maxval ) ;
else else
m_peer->SetValue( 1 ) ; m_peer->SetValue( 1 ) ;
err = HIViewGetPartHit ( err = HIViewGetPartHit (
m_peer->GetControlRef() , m_peer->GetControlRef() ,
&hipoint , &hipoint ,
&outPart &outPart
); );
m_peer->SetValue( val ) ; m_peer->SetValue( val ) ;
if ( max == 1 ) if ( max == 1 )
{ {
m_peer->SetMaximum( 1 ) ; m_peer->SetMaximum( 1 ) ;
} }
} }
if ( outPart >= 1 && (size_t)outPart <= countPages ) if ( outPart >= 1 && outPart <= countPages )
{ {
resultV = outPart ; resultV = outPart ;
} }
#endif // TARGET_API_MAC_OSX #endif // TARGET_API_MAC_OSX
if (flags != NULL) if (flags != NULL)
{ {
*flags = 0; *flags = 0;
// we cannot differentiate better // we cannot differentiate better
if (resultV >= 1) if (resultV >= 1)
*flags |= wxNB_HITTEST_ONLABEL; *flags |= wxNB_HITTEST_ONLABEL;

View File

@@ -35,7 +35,7 @@
// Superclass of wxTaskBarIcon implementations // Superclass of wxTaskBarIcon implementations
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxTaskBarIconImpl class wxTaskBarIconImpl
{ {
public: public:
wxTaskBarIconImpl(wxTaskBarIcon* parent); wxTaskBarIconImpl(wxTaskBarIcon* parent);
@@ -67,15 +67,15 @@ public:
class wxTaskBarIconWindow : public wxTopLevelWindow class wxTaskBarIconWindow : public wxTopLevelWindow
{ {
public: public:
wxTaskBarIconWindow(wxTaskBarIconImpl* impl) wxTaskBarIconWindow(wxTaskBarIconImpl* impl)
: wxTopLevelWindow(NULL, -1, wxT("")), m_impl(impl) : wxTopLevelWindow(NULL, -1, wxT("")), m_impl(impl)
{ {
Connect(-1, wxEVT_COMMAND_MENU_SELECTED, Connect(-1, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(wxTaskBarIconWindow::OnMenuEvent) wxCommandEventHandler(wxTaskBarIconWindow::OnMenuEvent)
); );
} }
void OnMenuEvent(wxCommandEvent& event) void OnMenuEvent(wxCommandEvent& event)
{ {
m_impl->m_parent->ProcessEvent(event); m_impl->m_parent->ProcessEvent(event);
} }
@@ -115,7 +115,7 @@ public:
pascal OSStatus wxDockEventHandler( EventHandlerCallRef inHandlerCallRef, pascal OSStatus wxDockEventHandler( EventHandlerCallRef inHandlerCallRef,
EventRef inEvent, void* pData); EventRef inEvent, void* pData);
wxMenu* wxDeepCopyMenu(wxMenu* menu); wxMenu* wxDeepCopyMenu(wxMenu* menu);
//============================================================================= //=============================================================================
// //
@@ -134,7 +134,7 @@ wxMenu* wxDeepCopyMenu(wxMenu* menu);
// //
// Initializes members and creates the event window // Initializes members and creates the event window
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
wxTaskBarIconImpl::wxTaskBarIconImpl(wxTaskBarIcon* parent) wxTaskBarIconImpl::wxTaskBarIconImpl(wxTaskBarIcon* parent)
: m_parent(parent), m_menuEventWindow(new wxTaskBarIconWindow(this)) : m_parent(parent), m_menuEventWindow(new wxTaskBarIconWindow(this))
{ {
} }
@@ -185,35 +185,34 @@ pascal OSStatus wxDockEventHandler( EventHandlerCallRef inHandlerCallRef,
// This is the real reason why we need this. Normally menus // This is the real reason why we need this. Normally menus
// get handled in wxMacAppEventHandler // get handled in wxMacAppEventHandler
// //
// pascal OSStatus wxMacAppEventHandler(EventHandlerCallRef handler, // pascal OSStatus wxMacAppEventHandler(EventHandlerCallRef handler,
// EventRef event, void *data) // EventRef event, void *data)
// //
// However, in the case of a taskbar menu call // However, in the case of a taskbar menu call
// command.menu.menuRef IS NULL! // command.menu.menuRef IS NULL!
// Which causes the wxApp handler just to skip it. // Which causes the wxApp handler just to skip it.
// //
MenuRef taskbarMenuRef = MAC_WXHMENU(pTB->m_pMenu->GetHMenu()); MenuRef taskbarMenuRef = MAC_WXHMENU(pTB->m_pMenu->GetHMenu());
OSStatus result = eventNotHandledErr;
OSErr err; OSErr err;
// get the HICommand from the event // get the HICommand from the event
HICommand command; HICommand command;
err = GetEventParameter(inEvent, kEventParamDirectObject, err = GetEventParameter(inEvent, kEventParamDirectObject,
typeHICommand, NULL, typeHICommand, NULL,
sizeof(HICommand), NULL, &command); sizeof(HICommand), NULL, &command);
if (err == noErr) if (err == noErr)
{ {
// Obtain the REAL menuRef and the menuItemIndex in the real menuRef // Obtain the REAL menuRef and the menuItemIndex in the real menuRef
// //
// NOTE: menuRef is generally used here for submenus, as // NOTE: menuRef is generally used here for submenus, as
// GetMenuItemRefCon could give an incorrect wxMenuItem if we pass // GetMenuItemRefCon could give an incorrect wxMenuItem if we pass
// just the top level wxTaskBar menu // just the top level wxTaskBar menu
// //
MenuItemIndex menuItemIndex; MenuItemIndex menuItemIndex;
MenuRef menuRef; MenuRef menuRef;
err = GetIndMenuItemWithCommandID(taskbarMenuRef, err = GetIndMenuItemWithCommandID(taskbarMenuRef,
command.commandID, command.commandID,
1, &menuRef, &menuItemIndex); 1, &menuRef, &menuItemIndex);
if (err == noErr) if (err == noErr)
{ {
@@ -231,22 +230,22 @@ pascal OSStatus wxDockEventHandler( EventHandlerCallRef inHandlerCallRef,
item->Check( !item->IsChecked() ) ; item->Check( !item->IsChecked() ) ;
// send the wxEvent to the wxMenu // send the wxEvent to the wxMenu
item->GetMenu()->SendEvent(id, item->GetMenu()->SendEvent(id,
item->IsCheckable() ? item->IsCheckable() ?
item->IsChecked() : -1 item->IsChecked() : -1
); );
err = noErr; // successfully handled the event err = noErr; // successfully handled the event
} }
} }
} //end if noErr on getting HICommand from event } //end if noErr on getting HICommand from event
// return whether we handled the event or not // return whether we handled the event or not
return err; return err;
} }
// We better have a kEventClassApplication/kEventAppGetDockTileMenu combo here, // We better have a kEventClassApplication/kEventAppGetDockTileMenu combo here,
// otherwise something is truly funky // otherwise something is truly funky
wxASSERT(eventClass == kEventClassApplication && wxASSERT(eventClass == kEventClassApplication &&
eventKind == kEventAppGetDockTileMenu); eventKind == kEventAppGetDockTileMenu);
// process the right click events // process the right click events
@@ -274,7 +273,7 @@ pascal OSStatus wxDockEventHandler( EventHandlerCallRef inHandlerCallRef,
RetainMenu(hMenu); RetainMenu(hMenu);
// set the actual dock menu // set the actual dock menu
err = SetEventParameter(inEvent, kEventParamMenuRef, err = SetEventParameter(inEvent, kEventParamMenuRef,
typeMenuRef, sizeof(MenuRef), &hMenu); typeMenuRef, sizeof(MenuRef), &hMenu);
wxASSERT(err == noErr); wxASSERT(err == noErr);
} }
@@ -299,16 +298,16 @@ wxMenu* wxDeepCopyMenu(wxMenu* menu)
// //
// NB: Here we have to perform a deep copy of the menu, // NB: Here we have to perform a deep copy of the menu,
// copying each and every menu item from menu to m_pMenu. // copying each and every menu item from menu to m_pMenu.
// Other implementations use wxWindow::PopupMenu here, // Other implementations use wxWindow::PopupMenu here,
// which idle execution until the user selects something, // which idle execution until the user selects something,
// but since the mac handles this internally, we can't - // but since the mac handles this internally, we can't -
// and have no way at all to idle it while the dock menu // and have no way at all to idle it while the dock menu
// is being shown before menu goes out of scope (it may // is being shown before menu goes out of scope (it may
// not be on the heap, and may expire right after this function // not be on the heap, and may expire right after this function
// is done - we need it to last until the carbon event is triggered - // is done - we need it to last until the carbon event is triggered -
// that's when the user right clicks). // that's when the user right clicks).
// //
// Also, since there is no equal (assignment) operator // Also, since there is no equal (assignment) operator
// on either wxMenu or wxMenuItem, we have to do all the // on either wxMenu or wxMenuItem, we have to do all the
// dirty work ourselves. // dirty work ourselves.
// //
@@ -345,10 +344,10 @@ wxMenu* wxDeepCopyMenu(wxMenu* menu)
// //
// Here we create some mac-specific event handlers and UPPs. // Here we create some mac-specific event handlers and UPPs.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
wxDockTaskBarIcon::wxDockTaskBarIcon(wxTaskBarIcon* parent) wxDockTaskBarIcon::wxDockTaskBarIcon(wxTaskBarIcon* parent)
: wxTaskBarIconImpl(parent), : wxTaskBarIconImpl(parent),
m_eventHandlerRef(NULL), m_pMenu(NULL), m_eventHandlerRef(NULL), m_pMenu(NULL),
m_theLastMenu(GetApplicationDockTileMenu()), m_iconAdded(false) m_theLastMenu(GetApplicationDockTileMenu()), m_iconAdded(false)
{ {
// register the events that will return the dock menu // register the events that will return the dock menu
EventTypeSpec tbEventList[] = EventTypeSpec tbEventList[] =
@@ -365,7 +364,7 @@ wxDockTaskBarIcon::wxDockTaskBarIcon(wxTaskBarIcon* parent)
#endif #endif
InstallApplicationEventHandler( InstallApplicationEventHandler(
m_eventupp, m_eventupp,
GetEventTypeCount(tbEventList), tbEventList, GetEventTypeCount(tbEventList), tbEventList,
this, &m_eventHandlerRef); this, &m_eventHandlerRef);
wxASSERT( err == noErr ); wxASSERT( err == noErr );
} }
@@ -382,13 +381,13 @@ wxDockTaskBarIcon::~wxDockTaskBarIcon()
DisposeEventHandlerUPP(m_eventupp); DisposeEventHandlerUPP(m_eventupp);
// restore old icon and menu to the dock // restore old icon and menu to the dock
RemoveIcon(); RemoveIcon();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxDockTaskBarIcon::DoCreatePopupMenu // wxDockTaskBarIcon::DoCreatePopupMenu
// //
// Helper function that handles a request from the dock event handler // Helper function that handles a request from the dock event handler
// to get the menu for the dock // to get the menu for the dock
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
wxMenu* wxDockTaskBarIcon::DoCreatePopupMenu() wxMenu* wxDockTaskBarIcon::DoCreatePopupMenu()
@@ -404,7 +403,7 @@ wxMenu* wxDockTaskBarIcon::DoCreatePopupMenu()
m_pMenu->SetInvokingWindow(m_menuEventWindow); m_pMenu->SetInvokingWindow(m_menuEventWindow);
} }
// the return here can be one of three things // the return here can be one of three things
// (in order of priority): // (in order of priority):
// 1) User passed a menu from CreatePopupMenu override // 1) User passed a menu from CreatePopupMenu override
// 2) menu sent to and copied from PopupMenu // 2) menu sent to and copied from PopupMenu
@@ -419,8 +418,8 @@ wxMenu* wxDockTaskBarIcon::DoCreatePopupMenu()
// Returns whether or not the dock is not using the default image // Returns whether or not the dock is not using the default image
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool wxDockTaskBarIcon::IsIconInstalled() const bool wxDockTaskBarIcon::IsIconInstalled() const
{ {
return m_iconAdded; return m_iconAdded;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -437,7 +436,7 @@ bool wxDockTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
// get the CGImageRef for the wxBitmap: // get the CGImageRef for the wxBitmap:
// OSX builds only, but then the dock only exists in OSX // OSX builds only, but then the dock only exists in OSX
CGImageRef pImage = (CGImageRef) bmp.CGImageCreate(); CGImageRef pImage = (CGImageRef) bmp.CGImageCreate();
wxASSERT( pImage != NULL ); wxASSERT( pImage != NULL );
// actually set the dock image // actually set the dock image
@@ -485,7 +484,7 @@ bool wxDockTaskBarIcon::RemoveIcon()
// //
// 2.4 and wxPython method that "pops of the menu in the taskbar". // 2.4 and wxPython method that "pops of the menu in the taskbar".
// //
// In reality because of the way the dock menu works in carbon // In reality because of the way the dock menu works in carbon
// we just save the menu, and if the user didn't override CreatePopupMenu // we just save the menu, and if the user didn't override CreatePopupMenu
// return the menu passed here, thus sort of getting the same effect. // return the menu passed here, thus sort of getting the same effect.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -504,15 +503,15 @@ bool wxDockTaskBarIcon::PopupMenu(wxMenu *menu)
return true; return true;
} }
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// //
// wxTaskBarIcon // wxTaskBarIcon
// //
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler) IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxTaskBarIcon Constructor // wxTaskBarIcon Constructor
// //
@@ -520,12 +519,12 @@ IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler)
// //
// Note that we only support DOCK currently as others require cocoa and // Note that we only support DOCK currently as others require cocoa and
// also some require hacks and other such things. (MenuExtras are // also some require hacks and other such things. (MenuExtras are
// actually seperate programs that also require a special undocumented id // actually seperate programs that also require a special undocumented id
// hack and other such fun stuff). // hack and other such fun stuff).
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
wxTaskBarIcon::wxTaskBarIcon(wxTaskBarIconType nType) wxTaskBarIcon::wxTaskBarIcon(wxTaskBarIconType nType)
{ {
wxASSERT_MSG(nType == DOCK, wxASSERT_MSG(nType == DOCK,
wxT("Only the DOCK implementation of wxTaskBarIcon") wxT("Only the DOCK implementation of wxTaskBarIcon")
wxT("on mac carbon is currently supported!")); wxT("on mac carbon is currently supported!"));
m_impl = new wxDockTaskBarIcon(this); m_impl = new wxDockTaskBarIcon(this);

View File

@@ -2649,7 +2649,9 @@ void wxWindowMac::OnSetFocus( wxFocusEvent& event )
//wxChildFocusEvent eventFocus(this); //wxChildFocusEvent eventFocus(this);
//(void)GetEventHandler()->ProcessEvent(eventFocus); //(void)GetEventHandler()->ProcessEvent(eventFocus);
#if !wxMAC_USE_CORE_GRAPHICS
bool bIsFocusEvent = (event.GetEventType() == wxEVT_SET_FOCUS); bool bIsFocusEvent = (event.GetEventType() == wxEVT_SET_FOCUS);
#endif
// enable for patch 1376506 - perhaps? // enable for patch 1376506 - perhaps?
#if 0 #if 0
@@ -3263,11 +3265,11 @@ wxPoint wxGetMousePosition()
void wxWindowMac::OnMouseEvent( wxMouseEvent &event ) void wxWindowMac::OnMouseEvent( wxMouseEvent &event )
{ {
long evtType = event.GetEventType();
// if ((evtType == ewxEVT_RIGHT_DOWN) || (evtType == wxEVT_CONTEXT_MENU))
if ( event.GetEventType() == wxEVT_RIGHT_DOWN ) if ( event.GetEventType() == wxEVT_RIGHT_DOWN )
{ {
// copied from wxGTK : CS // copied from wxGTK : CS
// VZ: shouldn't we move this to base class then?
// generate a "context menu" event: this is similar to wxEVT_RIGHT_DOWN // generate a "context menu" event: this is similar to wxEVT_RIGHT_DOWN
// except that: // except that:
// //