1
0
Fork 0

Clean up CocoaMenuBar code

- remove use of Boost
- remove work-around for macOS < 10.7
This commit is contained in:
James Turner 2017-09-28 14:02:53 +01:00
parent a89d747348
commit 4c4cfb3b44

View file

@ -2,8 +2,6 @@
#include <AppKit/NSMenu.h> #include <AppKit/NSMenu.h>
#include <boost/foreach.hpp>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
@ -77,12 +75,6 @@ public:
std::vector<CocoaEnabledListener*> listeners; std::vector<CocoaEnabledListener*> listeners;
}; };
// prior to the 10.6 SDK, NSMenuDelegate was an informal protocol
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060
@protocol NSMenuDelegate <NSObject>
@end
#endif
@interface CocoaMenuDelegate : NSObject <NSMenuDelegate> { @interface CocoaMenuDelegate : NSObject <NSMenuDelegate> {
@private @private
FGCocoaMenuBar::CocoaMenuBarPrivate* peer; FGCocoaMenuBar::CocoaMenuBarPrivate* peer;
@ -182,7 +174,7 @@ static bool labelIsSeparator(NSString* s)
void FGCocoaMenuBar::CocoaMenuBarPrivate::menuFromProps(NSMenu* menu, SGPropertyNode* menuNode) void FGCocoaMenuBar::CocoaMenuBarPrivate::menuFromProps(NSMenu* menu, SGPropertyNode* menuNode)
{ {
int index = 0; int index = 0;
BOOST_FOREACH(SGPropertyNode_ptr n, menuNode->getChildren("item")) { for (SGPropertyNode_ptr n : menuNode->getChildren("item")) {
if (!n->hasValue("enabled")) { if (!n->hasValue("enabled")) {
n->setBoolValue("enabled", true); n->setBoolValue("enabled", true);
} }
@ -277,7 +269,7 @@ void FGCocoaMenuBar::init()
[previousMenu setTitle:@"FlightGear"]; [previousMenu setTitle:@"FlightGear"];
} }
BOOST_FOREACH(SGPropertyNode_ptr n, props->getChildren("menu")) { for (auto n : props->getChildren("menu")) {
NSString* label = stdStringToCocoa(getLocalizedLabel(n)); NSString* label = stdStringToCocoa(getLocalizedLabel(n));
NSMenuItem* item = [mainBar itemWithTitle:label]; NSMenuItem* item = [mainBar itemWithTitle:label];
NSMenu* menu; NSMenu* menu;