Safari-style tabs Cocoa control? - objective-c

I'm referring to the Safari 8's tabbar control (which looks almost exactly the same with Xcode 6's tabbar + the horizontal scrolling, if I'm not mistaken)
Is it available somewhere? How do I proceed?
P.S.: If the answer is something along the lines of "It's a custom control. But you can do it very easily by subclassing... everything there is to subclass", I'm prepared for it! lol

It is a custom control: ScrollableTabBarView. You can inspect it using F-Script
The closest visual match is the Yosemite style of MMTabBarView. This control however does not implement scrolling.
Also check out LITabControl and KPCTabsControl

It is just a Segmented / Tab bar with customized Radio buttons with added NSButton(this is for closing the tab).
You could check this using Accessibility Inspector.
And there is no straightforward control to achieve this, as you mentioned in P.S., you should go with customizing the controls.

Related

Can we remove NSPopover's arrow in macOS using Objective-C

When I am displaying a NSViewController as NSPopover, I am getting an arrow with this NSPopover. My question is how we can remove this arrow from NSPopover?
I am not aware of any Apple, built-in functionality to do so. However, it is possible to mimic the functionality of NSPopover and have more advanced control. For example, the SFBPopovers library seems a very good choice and has a setDrawsArrow: method: https://github.com/sbooth/SFBPopovers
Here is a picture from the example application with a popover with no arrow coming from the "Toggle Popover" button.

Creating semi-transparent, round cornered with border Window in Cocoa?

What would be the best approach for creating a Window that is semi-transparent, has round corners and an outline around its border and the arrow, but without the the title bar and buttons.
The window will pop up from the Menu Bar when a use clicks on the menu bar icon.
I'm looking to have an effect similar to the "Applications" and "Downloads" windows:
I guess I will need to do the drawing myself. But I'm wondering what's the best way to do this and whether there is anything already built into Cocoa that can minimize the effort? Or maybe a 3rd party project that has already done that (couldn't find anything exactly like that)?
Thanks.
You can create your window with
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
with a style-mask of NSBorderlessWindowMask which will give an unadorned window. Its how the Dock does its mechanics too.
Note that you must init with this style , you can't change an already init'ed windows style.
Place a custom NSView via the contentView accessor with your desired background custom drawing at the top of the windows view stack.
You might need also to setOpaque to NO
What you are looking for has been done a lot. Too much really.
The classes you want to look into are as follows.
NSStatusItem
This is something that appears in the status bar section of the menu bar to the right side.
NSMenu
If you want this from a menu in the application menus, you'll need to do some clever things with views in menus.
NSWindow
As the other poster notes a borderless window is one way to achieve this.
NSPopover
This is another way. Combined with the above, a fancy technique is to use a clear window called a cover window then, when clicking on the menu or status menu, invoke a popover from a point below that in the clear cover window.
That should be enough to get you started with what you should look into.
Beyond that, peruse the Mac App Store and also look at cocoacontrols.com and GitHub.

Tab Pages Control Type used in IPad Apps

What kind of controls are used in the photo in the link below i pointed to them with red arrows, its outline+ App, couldn't find any equivalent to it in Xcode.
Kindest Regards
https://dl.dropbox.com/u/49071490/onenote_note_app_outline_plus_for_ipad_1.jpg
The longer arrow left below most probably points to an UITableViewCell which represents one cell in the UITableView, used as a menu. It is customized, though. No control in Xcode that looks like that out of the box.
Concerning the other arrow, iOS does not provide tab bar controls like in a browser. They are custom built from the ground with what you see in Xcode. A lot of thinkable possibilities to achieve that.

Color Menu Chooser

How can I make a color chooser for text to use in my cocoa app? I am trying to get the same color selection menu like used on microsoft word. Would this be a popup button or color well or what?
Thanks!
I would personally recommend that you don't emulate Microsoft's UI. It looks very un-Mac-like and you can do better.
You could implement something like this as a popup button and in the button's menu, use custom views for the various color picker sections. Apple's MenuItemView example code shows how to use custom views in menu items.
That's not a standard Cocoa control, so you'll have to come up with your own implementation if you want your picker to look just like that. You'd probably be better off using the standard Cocoa controls for colors, though -- they're used in many programs, so users will already be familiar with them. There's NSColorWell, which displays a single color, and NSColorPicker, which provides a user interface for selecting a color. Read about both in Color Programming Topics.

how to make an NSWindow blocking other Windows?

i'm looking for a way to have a NSWindow, which is able to block other NSWindows, like the menubar does. I mean: It is not possible to drag a Window over the menubar.
Is that kind of behavior realizable for my own NSWindow?
Thanks in advance
Bijan
NSWindow's dragging behavior automatically keeps windows from going under the menu bar — because they aren't supposed to. If you have some special case, you can override the standard dragging behavior. But think carefully before throwing away standard functionality prescribed by the HIG.
Also, it isn't possible to drag a window over the menu bar (rather than under) unless it's also over everything else, because the menu bar is normally above every other window.
I just stumbled on this question. There they say it is possible to move other windows using the Accessibility API or the Quartz Window Services.
Can't I just read out the other window's positions and move them, so that they do not collide with my window? Maybe triggered by a 0.1 sec. timer?