Hi Christopher and happy new year to everybody, Le 31 déc. 2010 à 06:55, Christopher Armstrong a écrit :
> I'm working with EtoileUI, and I'm trying to setup a ETLayoutItemGroup so > that it displays its sub-items with a minimum width. No matter what I try, I > can't seem to stop it from displaying at the minimum 50x50 layout. For now, there is no real minimum size/width/height support in EtoileUI, except in ETIconLayout but it's rather specialized class that intends to mimick a Mac OS X Finder-like icon view closely. So it's probably not the best choice if you want to obtain a column/stack of views, images etc. Various bugs/limitations exists in the ETLayoutItem geometry support, so don't be suprised if things don't work as expected. > It would ideally resize the layout items so that they have a width equal to > the width of the layout item group, and then just size the height > proportionately. To size the height proportionately in this case is not possible currently. To support that, I could add a (delegate) method to ETLayout that lets you control the item size and position when their parent item is resized. For the item frame resizing, EtoileUI provides the traditional -setAutoresizingMask: in a vein similar to the AppKit/UIKit. See ETAutoresizing enum in ETLayoutItem. For how the content reacts to the item resizing, it provides -setContentAspect: which makes possible to resize the content in various ways (some options respect the proportions). When you use a ETBasicItemStyle as a style, the style checks the content aspect to draw the image as requested. New styles can be implemented that check the content aspect in the same way at drawing time (in ETGeometry.h, there is a function ETScaledRect() that takes a content aspect as argument to compute the constrained rect size) When the layout item manages a view, ETLayoutItem will try to convert the content aspect into an autoresizing mask… However this won't work well in all cases, because autoresizing mask are not expressive enough. In the long run, I intend to have some real constraint support to support all content aspects on a view, or possibly to add new autoresizing options to achieve the same. > I've tried setting the minimum icon size and the > "iconSizeForScaleFactorUnit", and even the size of the template item I'm > creating, but I can't seem to get it to work. May be I'm completely off, but I have the feeling you shouldn't be using ETIconLayout but just a simple ETColumnLayout. ETTemplateItemLayout main use is to make a presentation that alters item properties completely reusable. Could you describe me precisely the view/presentation you'd like to obtain from the various perspectives listed below? - Enclosing parent item (fixed size, scrollable etc.) - Item resizing policy - User interaction (click, label editing, drag and drop, rubber-band selection or not etc.) - Drawn content (text, image, view etc.) > Here is the code that I'm trying to use: > > ETLayoutItemGroup *viewSwitcher = [[ETLayoutItemFactory factory] > layoutItemGroup]; This line should call -itemGroup and not -layoutItemGroup. I'm even suprised it compiles, given that I removed -[ETLayoutItemFactory layoutItemGroup] this fall. > [viewSwitcher setSize: NSMakeSize(200, 400)]; > > ETIconLayout *layout = [ETIconLayout layout]; ok > ETLayoutItem *templateItem = [[ETLayoutItemFactory factory] item]; > [templateItem setStyle: [[[ETIconAndLabelStyle alloc] init] autorelease]]; > [templateItem setSize: NSMakeSize(128, 128)]; > [layout setTemplateItem: templateItem]; You shouldn't need to do that. There is already a template item instantiated in every new ETIconLayout. Just customize the aspects set on [layout templateItem] and declare the customized properties as template keys. > [layout setPositionalLayout: [ETColumnLayout layout]]; ok > [layout setItemSizeConstraintStyle: ETSizeConstraintStyleNone]; This is useless, -[ETIconLayout resizeLayoutItems:toScaleFactor:] ignores -constrainedItemSize and -itemSizeConstraintStyle. > [layout setTemplateKeys: A(kETStyleProperty, kETFrameProperty)]; Ditto, ETIconLayout initializer declares the template keys. On each layout update, ETIconLayout recomputes the item frame based on the -iconSizeForScaleFactorUnit and -minIconSize, so the 128 * 128 size from the template item will be never be visible. It's weird you report items sized to 50 * 50 instead of 256 * 256 though, this looks like a bug related to the fact that 50 * 50 is the default item size used by ETLayoutItemFactory. I'll take a look at that. > [layout setIconSizeForScaleFactorUnit: NSMakeSize(256, 256)]; > [layout setMinIconSize: NSMakeSize(256, 256)]; > > //[[layout positionalLayout] setItemMargin: 20]; > [viewSwitcher setLayout: layout]; > [[[ETLayoutItemFactory factory] windowGroup] > addItem: viewSwitcher]; > [viewSwitcher reloadAndUpdateLayout]; ok. I'll update the doc a bit based on your feedback. Cheers, Quentin. _______________________________________________ Etoile-discuss mailing list [email protected] https://mail.gna.org/listinfo/etoile-discuss
