Simple Mac OS development app - macos

What is the app's icon that appears to the right of the menu bar called?(like the twitter one)
When you press it, it's usually a drop down menu..
I want to implement a similar one in my mac app.. any help where can i start?

The menu icon is a status item, represented by the NSStatusItem class. See the question How to create a menubar application for Mac and its answers for more info.

Related

How to add Toolbar Button to Title Bar

I have created a toolbar via IB and have a simple View menu with the "Show Toolbar" and "Customize Toolbar" menu items. Both work exactly as I would like them to.
But, I cannot seem to get the Toolbar Button to show up in the title bar of the NSWindow.
I have tried setting the "Shows Toolbar Button" in IB... no luck.
I have tried calling setShowsToolbarButton in the window controller's awakeFromNib
NSLog(#"showsToolbarButton: %#\n",[[self window]showsToolbarButton]?#"YES":#"NO");
[[self window]setShowsToolbarButton:YES];
NSLog(#"showsToolbarButton: %#\n",[[self window]showsToolbarButton]?#"YES":#"NO");
Again, no luck. Both log entries show "NO" and there is no button.
Has this feature gone away?
If not, what is the proper way to get that button to show up?
I'm building for OSX 10.6 and newer using Xcode 5.0.2 on a machine running 10.9.
Thanks for any/all insights.
The button to hide and show the toolbar was commonly seen as a small capsule button in the upper right corner at least through 10.6 Snow Leopard.
It is no longer present in standard OS X windows.
Ostensibly this is still in Xcode for supporting projects targeting older versions of OS X.
You can probably still create your own button and set its action to the same selectors, but you would likely need to create a custom window using NSBorderlessWindowMask to get the button in the title bar where it used to be.
In its place for the last several OS X versions you will find the full screen button instead.

What is the technical term for a Mac app that resides in the menu bar?

I come from iOS to the Mac and want to make a simple utility that lives in the menu bar at the top right.
Some "menu bar apps" open a "window" like a speech bubble. The app is in the "window". When you click outside the "window" the "window" closes.
Here is a good looking example from Crashlytics Mac app:
Found this example project but I want to learn more about it and what it is called officially.
The OS X Human Interface Guidelines call them menu bar extras.

How to display my app's icon (programmatically) on the top right corner of the Mac OS X menu bar

I know Skype does it - they have a special icon register to there. And then when user click on the icon, a drop down menu will appear...
See the docs for status bar and NSStatusItem. You can also find tutorials and sample code by googling for NSStatusItem.
NSStatusItem is responsible for this.

disable menu bar and dock programmatically in mac

i am new to mac programming and i have to perform a task. I need to make an application that will run at startup and cover the complete screen and will not close until my custom passcode is inserted.
The menu bar and dock needs to be hidden behind this application and the application cannot be closed until the information is given.
So far i have written the code that would run at startup . But i cant seem to disable the menu bar and dock and lock all user actions unless he gives the passcode i want.
What to do !!!!
This article contains some good info and links on creating a full-screen app that hides the Dock and menubar.
If you want to hide the Menu-Bar in Swift (Xcode, Mac OS X Application), you do:
NSMenu.setMenuBarVisible(false)
If you want to show the Menu-Bar again:
NSMenu.setMenuBarVisible(true)
Please keep in mind, that "setMenuBarVisible" is a class function and does not exist for instances of a class. So the following line is not possible:
NSApplication.sharedApplication().mainMenu!.setMenuBarVisible(false)
And will result in an error, saying, that the func "setMenuBarVisible" is not defined.

bring the application from in focus, by clicking the icon of corresponding application

I was surprised this doesn't happen automatically, but I would like my applications window to be in focus as I click its dock icon, when in minimized mode.
Just to clarify, when I minimize the app, the window goes to dock, but when I click the its corresponding Dock Icon, the window don't come in focus.
Is there anything I am missing?
I am using Qt 4.5.3 on Mac OS X 10.5, 10.6
Thanks for help.
Rahul
First answer: That's the expected behavior of a Mac app. Try Safari for example. An app can be active without showing any window. In that case, only the menu bar at the top shows that the active app is changed. So, unless absolutely necessary, you shouldn't bring the minimized window back unless the user explicitly does so. That's the Mac way!
Second answer: I understand that there are cases where you want to bring the minimized window up. In Cocoa, the application delegate method -applicationDidBicomeActive is called when the application gets the focus, and there you can bring the window up yourself. I'm sure Qt also has a similar event/callback/signal or whatever, but I don't know any Qt ... :p Sorry I can't be of any help.

Resources