Premade Cocoa component for a UI control like this? (rounded rectangle showing a stack of items) - cocoa

Update
Luckily, the code that WebKit uses to make this control draws onto a canvas using basic drawing operations, so it shouldn't be too hard to convert into a Cocoa control. This is what I have so far:Development progress so far http://img413.imageshack.us/img413/8418/capturedcran20100623074.png
I'll update here again once I get it finished.
Original question
I don't know what to call this sort of control, so I'll show pictures (from the iTunes dialog for a media player and the WebKit Web Inspector's Resource panel):
iTunes showing disk usage using this control http://img13.imageshack.us/img13/8245/capturedcran20100622144.png
Google Chrome's use of the control to show resource download speed http://img695.imageshack.us/img695/8245/capturedcran20100622144.png
I'm interested in using this sort of control in my Cocoa application. I've searched all over the Internets but haven't found much, seeing as I don't know its name - is there some sort of shared component that I can use for this?
Thanks!

On Safari it's implemented using javascript, see: SummaryBar.js.

That's a totally custom control, and I don't know of any open source counterpart (other than the one inside the Webkit source). Would you care to provide one? :)

Related

MvvmCross vnext : monodroid use a VideoView inside a plugin

I was playing with Xamarin Mobile api MediaPicker which uses MediaRecorder with monodroid to make a plugin to record a video.
Android must preview the video inside a VideoView. This restriction applies to wp7 and ios too for privacy.
So, I need to get the VideoView (or Rectangle in wp7) from my custom view and setPreviewDisplay to this VideoView in my plugin (or init MediaPicker with this VideoView).
What is the best way to implement my portable plugin which requires UI element ?
Thanks in advance for your help.
What is the best way to implement my portable plugin which requires UI element ?
I guess my first question is "do you need a portable plugin?"
What is the interface that you actually need at the ViewModel layer or lower?
My guess is that the cross-platform interface that the ViewModel will see might contain just:
some control commands (things like start/stop)
some summary information - e.g. video length
a file access layer - this may be as little as a file path?
If that's the case, then I'd probably implement most of the logic within Controls/Views/UIViews in the UIs, and would then bind the relevant commands and values to those ViewModel properties.
So I wouldn't personally implement this as a plugin at all!
I've previously done a couple of apps which use video views - one for video capture (Android only), one for bar code scanning.
I found that the basic available samples worked quite well. However, once I started trying to extend them, then they became quickly fragile, they were hard to get working and they were quite frustrating to develop!
I would genuinely recommend starting your current develop as UI View code. After you've got it working, then you might find a nice way to split up the control and interface into a plugin - but I suspect that this won't be where most of your time is spent.
e.g. for my next QR code app, I plan to use the separate UI controls in https://github.com/Redth/ZxingSharp.Mobile - at the ViewModel level, I can hopefully just expose some sort of Command which acts on the decoded QR strings.

Webkit page scaling in Cocoa

I'm making a WebKit-based text editor app for Mac, and I need to find a way to zoom the document in and out.
I've seen this StackOverflow article here, it suggests just scaling the view that Webkit is rendered into. The problem is, since Webkit doesn't know about it, this breaks things like drag & drop and causes Javascript to report the wrong cursor locations. Unfortunately, for some reason, the Cocoa WebKit API only supports scaling text up or down, not the whole page.
Safari and Chrome are both able to do this properly. I've gone as far as to look through the Chromium source code to figure out how it's done, but unfortunately it's using a completely different cross-platform API.
Any advice would be greatly appreciated. I'm not opposed to using private APIs, if I can figure out how to use them in a safe way.
-Keaton
The APIs for doing this aren't currently public, but they've been around for years and aren't likely to change. You can find them in WebKit's WebViewPrivate.h header. You won't find that header on your system, so you'll have to redeclare those methods yourself in a category. Something like:
#interface WebView (Zoom)
- (IBAction)zoomPageIn:(id)sender;
- (IBAction)zoomPageOut:(id)sender;
- (IBAction)resetPageZoom:(id)sender;
#end
Another option is just to set the CSS zoom property on the html element in your editor. You can do that in markup (<html style="zoom: 1.5">) or in JavaScript (document.documentElement.style.zoom = "1.5"). That doesn't require using any private APIs.

UI rendering issues with Segmented Control

I'm working on a simple app to learn Cocoa and I've encountered a little rendering bug with the segmented controller.
As you can see here, the view does not display fully opaque. I've looked around to try and find a solution to this to no avail. I did at one point think that maybe this control wasn't supposed to be used in this way but a quick browse through the system preferences yielded several views using this technique.
The control you are looking for is actually NSTabView. Docs here:
NSTabView

How i can NOT handle the selectionchange event in Panoramic View in WP7?

i have developed my own map control (similar Bing Maps control), but when i move this map to right or left, Panorama changes view, but when i move the same bing map, view doesn't change. How i can do the behaviour of my control similarly as in Bing maps
The issue is that your control is trying to handle gestures and so is the Panorama. This was a big issue for a lot of people in the early version of the tools. The standard response was always to avoid this situation as it has implications for usability. Unfortunately there are some situations where you really need this.
The NoDo update (March 2011) included a "fix" to work around this issue for the built in controls. That doesn't help you though.
Fortunately there is a work around.
When contact is made with your control you disable the "IsHitTestVisible" property on the container so that it doesn't also receive the gestures you are capturing. Be sure to set it abck afterwards though.
See http://mine.tuxfamily.org/?p=111 for more details.

Dashcode question - OnClick image to fullscreen?

I have a web app I'm building in Dashcode, currently every thing is working as advertised. I'm using the browser template and was able to modify it a bit, got the xml working to connect images and their description. Now I want to add a simple OnClick event that sends the image to fullscreen but I can't find any documentation for that. I'm pretty sure this is easily done so I'm missing something here? Any help greatly appreciated.
Tom
Taking over the screen is a bit complicated (if your talking about a full screen experience like youtube), but full screen in the browser window is defiantly possible. The simplest method is to have the click event open a link to the image location. This would load the image in full resolution in the browser window. A more elegant approach would be to load the image url into the source of a image dashcode object. and have that objects visibility only appear overs the whole web app when the Oncick event occurs. If you are talking about a built in function in dashcode to achieve a full screen/browser image, your out of luck.

Resources