Re: Carousel - like control for Mac OS

2011-12-21 Thread Nick
Unfortunately, on Mac OS this control does not support click on items
detection, which makes it useless on Macs.

from README.md:
On Mac OS there is no easy way to detect clicks on carousel items
currently. You cannot just supply an NSButton as or inside your item
view because the transforms applied to the item views mean that hit
detection doesn't work properly. I'm investigating possible solutions
to this (if you know a good way to fix this, please get in touch, or
fork the project on github).


2011/12/20 Tom Hohensee tom...@me.com:
 Have a look at iCarousel.  Has a port for iOS as well as Mac OS.

 Tom

 On Dec 20, 2011, at 3:00 PM, Nick wrote:

 Hello
 I am wondering, if a component exists similar to this
 http://www.ajaxdaddy.com/demo-jquery-carousel.html
 for Mac OS.

 Basically, what I need is just next and previous buttons (and
 these images smoothly scrolled one image per next or prev button
 click).

 At the moment I am trying to implement it on my own.
 This seems to be a simple NSScrollView with hidden scroll bars whose
 inner view has these image views added as subviews.

 However, I am not sure how to implement smooth scrolling of one image
 per click. I guess I need to use Core Animation?
 Are there any simple examples that I could look at?
 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/tomhoh%40mac.com

 This email sent to tom...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Carousel - like control for Mac OS

2011-12-21 Thread Stephen J. Butler
On Tue, Dec 20, 2011 at 3:00 PM, Nick eveningn...@gmail.com wrote:
 Hello
 I am wondering, if a component exists similar to this
 http://www.ajaxdaddy.com/demo-jquery-carousel.html
 for Mac OS.

 Basically, what I need is just next and previous buttons (and
 these images smoothly scrolled one image per next or prev button
 click).

This is an awful lot like the coverflow animation/display. Are you
sure that coverflow wouldn't be more appropriate for OS X?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Carousel - like control for Mac OS

2011-12-21 Thread Nick
Coverflow seems to be even more difficult to implement than just a
simple smoothly scrollable strip with clickable items. Coverflow can
be implemented using this iCarousel, but, again, with non-clickable
items.
And then, I do not have much space on the window to put this
coverflow (while a strip can be small and still look good), plus a
strip can display more than 1 item at once, and the user can click on
any of these items without too much of scrolling).

2011/12/21 Stephen J. Butler stephen.but...@gmail.com:
 On Tue, Dec 20, 2011 at 3:00 PM, Nick eveningn...@gmail.com wrote:
 Hello
 I am wondering, if a component exists similar to this
 http://www.ajaxdaddy.com/demo-jquery-carousel.html
 for Mac OS.

 Basically, what I need is just next and previous buttons (and
 these images smoothly scrolled one image per next or prev button
 click).

 This is an awful lot like the coverflow animation/display. Are you
 sure that coverflow wouldn't be more appropriate for OS X?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Carousel - like control for Mac OS

2011-12-21 Thread Vincent Habchi
 And then, I do not have much space on the window to put this
 coverflow (while a strip can be small and still look good), plus a
 strip can display more than 1 item at once, and the user can click on
 any of these items without too much of scrolling).

Why don’t you use CALayers (more specifically a CATileLayer and sublayers 
containing your images)?

Vincent___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Carousel - like control for Mac OS

2011-12-21 Thread Nick
I am not sure how to do this.
Currently, I have an NSScrollView (whose document view has all the
item views), with hidden scroll bars, and buttons next and
previous. When next and prev  are clicked, I -scrollToPoint
NSScrollView's content view a bit to the right or to the left.
It seems to be working as I need, except that it doesn't scroll
smoothly (I guess I need to use somehow). I suppose I need to attach a
core animation layer to NSScrollView? Or use somehow CAScrollView?
I've never worked with Core Animation before, except using animator
proxy, however
myscrollview] contentView] animator] scrollToPoint:nextPoint];
doesn't add any animation..
What would be the quickest way to make it work?

2011/12/21 Vincent Habchi vi...@macports.org:
 And then,  I do not have much space on the window to put this
 coverflow (while a strip can be small and still look good), plus a
 strip can display more than 1 item at once, and the user can click on
 any of these items without too much of scrolling).

 Why don’t you use CALayers (more specifically a CATileLayer and sublayers 
 containing your images)?

 Vincent
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Carousel - like control for Mac OS

2011-12-21 Thread Olivier Palliere
HI Nick,

In my app, I have two IKImageBrowserView subclasses (thumbnailsBrowser) that I 
populate with the pictures I need. It supports scrolling out of the box with 
the mouse or trackpad when needed. For one of my subclass, I resize the popover 
because it can only have up to 5 pictures in it, so I in fact disable 
scrolling. The other one however, can have up to 50 images, so to also allow 
scrolling with clicking a button, I wired two NSButton to this method:


- (IBAction)coverBrowserGo:(id)sender
{

NSIndexSet *currentlyVisible = [thumbnailsBrowser visibleItemIndexes];

if(debugging)
NSLog(@current IndexSet: %@, currentlyVisible);


if ([sender tag] == 0) //Go Left
{
// Are we already showing the first item?
if ([currentlyVisible firstIndex]==0)
return;

[thumbnailsBrowser scrollIndexToVisible:[currentlyVisible firstIndex] 
-1];

}
else //Go Right
{
if(debugging)
{
NSLog(@resultMatchArray: %lu, [resultMatchArray count]);
NSLog(@lastIndex: %lu, [currentlyVisible lastIndex]);
}

// Are we already showing the last item?
if ([currentlyVisible lastIndex]+1==[resultMatchArray count])
return;

[thumbnailsBrowser scrollIndexToVisible:[currentlyVisible lastIndex] 
+1];

}
}

To support clicking on an image, I have two choices. In one case I add the 
IKImageBrowserController delegate method, where I can then get the index of the 
currently selected index for aBrowser:

- (void) imageBrowserSelectionDidChange:(IKImageBrowserView *)aBrowser;

In the other case, I subclass the mouseUp method in my IKImageBrowserView 
subclass, then pass data back to the delegate:

- (void) mouseUp:(NSEvent*)inEvent
{

id delegate = self.delegate;
if (delegate)
{
NSPoint mouse = [self convertPoint:[inEvent locationInWindow] 
fromView:nil];
NSInteger objectIndex = [self indexOfItemAtPoint: mouse];

if (objectIndex == NSNotFound)
[delegate toggleCoverFloatingWindow:nil];
else
[delegate displayCoverFloatingWindow: objectIndex];

}

[super mouseUp:inEvent];

}

Hope that helps,
Olivier./.
Molowa.

On Dec 21, 2011, at 10:22 AM, Nick wrote:

 I am not sure how to do this.
 Currently, I have an NSScrollView (whose document view has all the
 item views), with hidden scroll bars, and buttons next and
 previous. When next and prev  are clicked, I -scrollToPoint
 NSScrollView's content view a bit to the right or to the left.
 It seems to be working as I need, except that it doesn't scroll
 smoothly (I guess I need to use somehow). I suppose I need to attach a
 core animation layer to NSScrollView? Or use somehow CAScrollView?
 I've never worked with Core Animation before, except using animator
 proxy, however
 myscrollview] contentView] animator] scrollToPoint:nextPoint];
 doesn't add any animation..
 What would be the quickest way to make it work?
 
 2011/12/21 Vincent Habchi vi...@macports.org:
 And then,  I do not have much space on the window to put this
 coverflow (while a strip can be small and still look good), plus a
 strip can display more than 1 item at once, and the user can click on
 any of these items without too much of scrolling).
 
 Why don’t you use CALayers (more specifically a CATileLayer and sublayers 
 containing your images)?
 
 Vincent
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/olivier%40sunprotectingfactory.com
 
 This email sent to oliv...@sunprotectingfactory.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Carousel - like control for Mac OS

2011-12-21 Thread vincent habchi
Nick,

I cannot elaborate much on this and give you code (not because it is somehow 
confidential, but just because it is a general idea I don’t have implemented, 
though I’m familiar with CAScrollLayers). The idea is thus:

1. Draw a normal NSView that you back with a CAScrollLayer. Give it the right 
size.
2. Generate a NSArray of CALayers, each one initialized with a single image.
3. Put as sublayers of your CAScrollLayer as many CALayers as you want images 
displayed, giving each CALayer origin the right position (ex: (0,0) - (0, 100) 
- (0, 200) if you display three images of 100x100 pixels each). Your 
CAScrollLayer should have its origin at (0, 0).
4. Use standard event handling methods to detect mouse click.
5. If you want to scroll, say leftwards, add a new sublayer with the proper 
image at (0, 300), then animate the origin of the CAScrollLayer from (0,0) to 
(0, 100). Once the animation is done, you can safely remove the (0, 0) sublayer.
6. Go back to 4.

The NSArray is a sort of cache where the CALayer live. This is more efficient 
than generating a CALayer on the fly each time you scroll.

Vincent___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Carousel - like control for Mac OS

2011-12-20 Thread Nick
Hello
I am wondering, if a component exists similar to this
http://www.ajaxdaddy.com/demo-jquery-carousel.html
for Mac OS.

Basically, what I need is just next and previous buttons (and
these images smoothly scrolled one image per next or prev button
click).

At the moment I am trying to implement it on my own.
This seems to be a simple NSScrollView with hidden scroll bars whose
inner view has these image views added as subviews.

However, I am not sure how to implement smooth scrolling of one image
per click. I guess I need to use Core Animation?
Are there any simple examples that I could look at?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Carousel - like control for Mac OS

2011-12-20 Thread Tom Hohensee
Have a look at iCarousel.  Has a port for iOS as well as Mac OS.  
This can be done with ImageKit in IB as well.  Just disable the scroll view and 
setup forward and back buttons that call the image index (nextIndex, etc). See 
imageKit docs.

Tom
 

On Dec 20, 2011, at 3:00 PM, Nick wrote:

 Hello
 I am wondering, if a component exists similar to this
 http://www.ajaxdaddy.com/demo-jquery-carousel.html
 for Mac OS.
 
 Basically, what I need is just next and previous buttons (and
 these images smoothly scrolled one image per next or prev button
 click).
 
 At the moment I am trying to implement it on my own.
 This seems to be a simple NSScrollView with hidden scroll bars whose
 inner view has these image views added as subviews.
 
 However, I am not sure how to implement smooth scrolling of one image
 per click. I guess I need to use Core Animation?
 Are there any simple examples that I could look at?
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/tom.hohensee%40gmail.com
 
 This email sent to tom.hohen...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Carousel - like control for Mac OS

2011-12-20 Thread Nick
Thanks!

2011/12/20 Tom Hohensee tom...@me.com:
 Have a look at iCarousel.  Has a port for iOS as well as Mac OS.

 Tom

 On Dec 20, 2011, at 3:00 PM, Nick wrote:

 Hello
 I am wondering, if a component exists similar to this
 http://www.ajaxdaddy.com/demo-jquery-carousel.html
 for Mac OS.

 Basically, what I need is just next and previous buttons (and
 these images smoothly scrolled one image per next or prev button
 click).

 At the moment I am trying to implement it on my own.
 This seems to be a simple NSScrollView with hidden scroll bars whose
 inner view has these image views added as subviews.

 However, I am not sure how to implement smooth scrolling of one image
 per click. I guess I need to use Core Animation?
 Are there any simple examples that I could look at?
 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/tomhoh%40mac.com

 This email sent to tom...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com