Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 16, 2012, 03:43 PM   #1
Cactus Dan
macrumors newbie
 
Join Date: Aug 2010
Secondary Menu Bar Inside Window?

Howdy,

How do you create a secondary menu bar inside a window?

Like this:


Adios,
Cactus Dan
Cactus Dan is offline   0 Reply With Quote
Old Jan 16, 2012, 04:18 PM   #2
chown33
macrumors 603
 
Join Date: Aug 2009
Use Java?
chown33 is online now   0 Reply With Quote
Old Jan 16, 2012, 04:29 PM   #3
Cactus Dan
Thread Starter
macrumors newbie
 
Join Date: Aug 2010
Howdy,

Ooops. Sorry about that. I reckon I forgot to mention what programming language.

I'm using C++/C/Objective C, building upon the glfw library code.

Adios,
Cactus Dan
Cactus Dan is offline   0 Reply With Quote
Old Jan 16, 2012, 04:57 PM   #4
chown33
macrumors 603
 
Join Date: Aug 2009
If you have popup menus, you might be able to implement an internal menubar that way. Could be fugly, but maybe worth a shot.
chown33 is online now   0 Reply With Quote
Old Jan 16, 2012, 05:17 PM   #5
robvas
macrumors 68000
 
Join Date: Mar 2009
Location: USA
Make a custom View that handles input, displaying labels, etc. Those don't look like a standard part of Cocoa.
robvas is offline   0 Reply With Quote
Old Jan 16, 2012, 06:04 PM   #6
Cactus Dan
Thread Starter
macrumors newbie
 
Join Date: Aug 2010
Howdy,
Quote:
Originally Posted by robvas View Post
Make a custom View that handles input, displaying labels, etc. Those don't look like a standard part of Cocoa.
Would that be an NSView?

Adios,
Cactus Dan
Cactus Dan is offline   0 Reply With Quote
Old Jan 17, 2012, 07:16 AM   #7
robvas
macrumors 68000
 
Join Date: Mar 2009
Location: USA
Quote:
Originally Posted by Cactus Dan View Post
Howdy,

Would that be an NSView?

Adios,
Cactus Dan
Yes. I made a simple one to imitate 'tabs' such as in Firefox.
robvas is offline   0 Reply With Quote
Old Apr 1, 2012, 03:16 PM   #8
Cactus Dan
Thread Starter
macrumors newbie
 
Join Date: Aug 2010
Howdy,

Hey thanks for steering me in the right direction. I've actually got it working nicely:


It works pretty much just like the main menu bar.

Adios,
Cactus Dan
Cactus Dan is offline   0 Reply With Quote
Old Apr 16, 2012, 09:14 PM   #9
rgbworld
macrumors newbie
 
Join Date: Apr 2012
Share secondary menu bar source code?

Hi Dan,
Any chance you could share your solution? I am rather new at cocoa development, so I could really use a comprehensive description on how you accomplished your secondary menu bar.

Possibly a code example and nib?

Thanks in advance!
Chris
rgbworld is offline   -1 Reply With Quote
Old Apr 16, 2012, 10:55 PM   #10
Cactus Dan
Thread Starter
macrumors newbie
 
Join Date: Aug 2010
Howdy,

Well, actually, I did that using C++/Objective-C++ without any nib, for the CPPAppKit project I've been doing as an experiment. It is really quite complicated, as I created my own c++ menu classes. Initially I tried using the NSMenuItem and NSMenu classes for the drop down menus, which did work, but I didn't like the results. I wanted them to have squared corners, and also wanted the possibility of adding background color.

But basically, the menu bar and menu item are wrapped to an NSView and the drop down menu is wrapped to an NSPanel. The menu item has subviews of NSTextView. If its a menu bar item then it only has one text subview for its title, and if its a sub menu item then it has 3 text subviews, one for the check mark, one for the title and one for the hot key list. The classes do their own event handling.

The whole project is mostly C++, with minimal Objective-C++ wrappers to communicate with the AppKit framework. I don't know if the code would be of much help if you're strictly working in Cocoa Objective-C but you're certainly welcome to it.

Adios,
Cactus Dan
Attached Files
File Type: zip CPPAppKitTest.zip (79.1 KB, 24 views)
Cactus Dan is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Is is possible to disable/hide menu bar? (Finder Menu Bar) zedchigo MacBook Pro 3 Oct 7, 2014 04:33 PM
'Hue Menu' Controls Philips Hue Lights From the Mac Menu Bar MacRumors Mac Blog Discussion 23 May 29, 2014 08:15 PM
Secondary-click menu issues (10.9.2. bug) Praetorian® OS X Mavericks (10.9) 6 Feb 26, 2014 03:01 PM
Open Window in Secondary Monitor By Default Blakeasd OS X Mavericks (10.9) 3 Oct 23, 2013 11:21 PM
Some icons missing on Desktop Menu Bar, Safari Menu Bar and Finder Menu Bar chroniceater MacBook Air 7 Jan 14, 2013 11:50 AM

Forum Jump

All times are GMT -5. The time now is 12:04 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC