Hide window resize button - cocoa

When creating an NSWindow that has the NSResizableWindowMask flag set, Cocoa always draws a resize button in the bottom-right hand corner of the window. This button doesn't integrate very nicely with my custom drawn UI graphics so I'd like to know: Is there a way to tell Cocoa not to draw this button but still keep my window resizable?

Related

custom checkbox needs to decide when to draw psalternate border

I'm trying to create a custom checkbox control (delphi 2010; based on tstatictext), and i can't figure how to decide if the (psalternate style) border should be drawn around the focused caption. Windows draws this border once the tab key has been pressed, and does not it if the control is focused with the mouse prior to the first tab press (after activating the parent). Any hints?

How to change the style of the window close/minimize/resize buttons in Cocoa?

In a standard Cocoa window, is it possible to change the colors of the close, minimize, and resize window buttons from the textured, glossy, gumdrop style to a simple red, yellow, and green color with no gradient/gloss?
There's no built-in way so you've gotta do your own custom drawing.
Check out How to draw custom window controls (close, minimize, and zoom buttons) for an example.
No. But you can create a custom borderless window and create buttons if your liking and connect them to the same actions.

NSWindow's title as indicator popup button

I'm trying to make my first Cocoa app (previously I was making iOS apps) and what I wish to do for my custom view is make it's title clickable with indicator (accessory) triangle facing down.
Clicking the title would open a popup/menu with my items.
How is that doneable in Cocoa?
Rdelmar's answer is probably the easiest way to go, but may not do exactly what you might want to do (which is replace the actual title with a pop up item, instead of having a popup button under the title in the toolbar area). With respect to functionality your application will probably work just as well using the toolbar.
If, however, you truly want to replace the actual title, the means of going about this would be to set the NSWindow title text to #"" to hide it, and redraw it by sticking in your own view.
[[[theWindow contentView] superview] addSubview:theSubview];
This basically tells the superview of the main content view to add another subview (direct "translation" from the code), and you'll have to tinker with the frame of this new subview to have it be positioned where the title should be positioned (as now it's free to be placed anywhere in the window frame, including on top of the title bar, as opposed to simply inside the content view).
theSubview can be your popup button, or whatever you want, and you'll also probably have to custom draw the popup button to match the original drawing of the window title.
You can do this by adding a toolbar to your window in IB. Once, you add the toolbar, you can double click on it to open the customizer view of it. Drag a popup button into the Allowable Toolbar Items area and after it is inserted there you can drag it into the bottom area which shows the layout of the toolbar -- you can also drag out any of the default items there that you don't want.

How to write an own resize corner/handle for an NSWindow?

How can I write an own resize corner/handle for an NSWindow? I'm using a subclass of an NSWindow without the default resize corner, but I need it for my window.
The basic outline:
Create a view.
Put some "drag me" indicator appropriate to your window in the view.
Have the view's drag action method respond by resizing the window so that the corner in question is now located at the current mouse position.

Making an NSButton resize its image (Cocoa OSX)

I could not find a way in the documentation to tell an NSButton to resize its image to fill up the whole button. Is there a way to do this programatically?
The closest you'll get is -setImageScaling: ... look up the constants to see how the image will be scaled within the button cell, given its bordered state and bezel type.
If you're looking to replace the standard button entirely with your image (ie, the button cell doesn't draw itself at all - your image serves as the entire visual representation), turn off the border (-setBordered:).
All of these options can be configured in IB as well. A tip: in IB, hover the mouse over any setting in the inspector panel - most if not all give you a hint that shows what method controls the behavior affected by the setting's control.

Resources