Creating a custom NSWindow interface - objective-c

I am trying to create an instance of NSWindow that has a style similar to that of Pixelmator, pictured below:
http://ideaorange.com/files/2010/12/pixelmato-sprinklebig.jpg>">
Basically, I would like to know how to create a window similar to that style, with the black title bar. Would I have to write the entire window out in code? Or is it possible to do in interface builder? Much appreciated.

The HUD appearance is what you're looking for. Note, however, that it only applies to panels (like Pixelmator's palettes), not standard windows (such as document windows). It also does not apply to controls, such as buttons; Pixelmator's are undoubtedly custom.

This tutorial is a good place to start: http://cocoawithlove.com/2008/12/drawing-custom-window-on-mac-os-x.html
There's a load of work involved in developing your own windows so be sure you're up for the challenge.
And another note, be sure to review your code against Apple's AppStore policies, as some of the window theming examples out on the web do use private API's which Apple won't approve for distribution through the app store.

Related

Embedded camera in Xamarin Forms

I have a client that adamantly insists on a solution with embedded camera in terms of having a ContentPage with an camera stream and custom buttons and icons, similar to https://github.com/pierceboggan/Moments, or at very least as I understand it seeing as it is a Snapchat clone. And my client wants similar swipe capabilities as to how navigation works in Snapchat.
However, as far as I can tell most of what is utilized in that solution has been deprecated.
I have suggested using the Media Plugin https://github.com/jamesmontemagno/MediaPlugin but they're not satisfied with the camera being pushed on the stack.
I've looked into implementing it natively and using dependency injections but it appears to be an overwhelming amount of work just to implement the most basic functions, particularly for Android's Camera2.
I'm hoping someone can provide me with good news of an easier alternative or an alteration to either Moments or Media Plugin or anything similar that will facilitate the requirements or if my only option is time consuming and complex?
From the code of Moment, you can do what you want to achieve. I did this for iOS.
You will have to create a custom renderer to display the camera page. You will be able to add buttons on top of it.
You could try this example which use custom renderer to add a take photo button and switch camera button on the camera view. Which is able to use on iOS and Android platform.
Main Page:
Camera View with custom button page:

How to have multiple proxy icons in Cocoa document windows?

Most Cocoa applications, provided they call NSWindow's -setRepresentedFilename:, will display a nice little proxy icon at the top-centre of their NSWindows.
Here's an example of the Preview app with a PDF document:
Xcode, somehow, manages to display 2 proxy icons - one for the project file and the other for the current document in the source display.
Does anyone know how they do that? window:shouldPopUpDocumentPathMenu: in NSWindowDelegate seems very close - you could probably position your custom path menus with this. But there doesn't seem to be anything that would allow you to actually display the two proxy icons themselves.
Any ideas?
Unfortunately Apple has access to APIs the rest of us don’t. Messing with the title bar is really hard.
The best I can suggest is making your window NOT have a standard title bar, and then placing the buttons yourself by calling [self standardWindowButton:X] for each of the close, resize, and miniaturize buttons you want. Then place your own document icon and title textField.
You’ll likely have to track when the window loses or gains key or main status and modify the buttons accordingly (Cocoa fetches new buttons each time this happens, not sure why). Whee! Good luck!

How to create a Controller to simulate the Springboard feature of the iPhone within your own application

I am trying to design a feature in my application for the iPhone that simulates the Springboard feature (Main menu of the iPhone that allows you to view more apps), or the way Weather application works that allows you to flip between views.
Does anyone have any samples of this how I would go about doing this. It's seems very trivial but I am wondering if I am missing something that is already available either as an Apple example or someone who did a tutorial on this.
The image below show how the user would use it.
alt text http://www.agilitesoftware.com/SpringboardExample.png
As they slide their finger to the right (or left) the other image would begin to show up. And it would animate smoothly. The faster you swiped your finger the faster it would move to the next view.
Update: The other feature is that it should mimic the same feel when you slide your hand across the display that is snaps to the current view into place. It should not keep sliding across if there is more than 1 view to the direction you swiping your finger.
I've seen other applications use this so that is why I am asking.
This is accomplished using the UIScrollView with the pagingEnabled property set to true. Just add each of your views, adjust the contentSize, and it will automatically "page" to the width of the screen across the content.
There is a sample app (with code) with exactly this functionality on the iPhone developer site on Apple.com (I believe it's called "PageControl".) - I'd suggest checking it out.
d.
I'm writing an app that uses a similar UI. As NilObject recommended, we're using a UIScrollView with pagingEnabled=YES.
You may also be interested in this example code involving just two child views. I'm trying it out now; it's an interesting technique but I've had to write some additional special-casing code for some odd situations that resulted.
There's also another question on this site that asks about creating a grid of icons like the home screen.
I would check out Joe Hewitt's code from the Three20 project for this. It provides a nice interface and further refinement of the UIScrollView implemented as TTScrollView and TTScrollViewDelegate, TTScrollViewDataSource.

How to make an iTunes like (playlists, library) left-sided (collapsible) navigation bar?

I am talking about the navigation area on the left side of iTunes for Library and Playlists. I'm wondering if this is a built in class (which I couldn't find documented) or something custom implemented by Apple.
I'm working an a mac application where I want to include that type of navigation. I want to allow people to "fold" the categories up by using the triangles. Do I need to write a custom implementation of this, or can I use some control in Interface Builder or some open source library?
Thanks!
The bar is called a source list. In 10.5, you can use an NSTableView for this, as described here. Before 10.5, you'll have to resort to third-party implementations.
See also: "How would one implement a sidebar similar to Mail/iTunes/Finder/etc in Cocoa/IB?"
You can also use NSOutlineView, as shown in this example

Is it possible to display a modal window in SCSF application at the center of the screen

In SCSF application I would like to display a view as a modal window at the center of the screen. Is it possible to do that?
WindowSmartPartInfo doesn't have any option for setting screen postion.
Thanks.
Assuming you're talking about Winforms, not WPF since the WPF layer for CAB does expose this option. In winforms there is no option in the WindowSmartPartInfo to do this. However, you could extend it and extend WindowWorkspace to use your new SmartPartInfo (override the OnApplySmartPartInfo method).
Before you do this, you might want to check the contrib and community sites to see if anyone has already done it. I think I've seen one somewhere.