FLTK logo

Re: [fltk.coredev] Fl_Flex method name question

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Fl_Flex method name question "'melcher.... Oct 25, 2022  
  I have been "coding around" a little bit more and implemented what I think is a decent Fluid GUI for Fl_Flex. Please check out https://github.com/fltk/fltk/pull/523 .

Sorry for being so late to the game after Albrecht already released the code, particularly because I checked the code much earlier, but in retrospect wasn't focussed enough. So here are my suggestions for an API, but this will probably break existing code.

So, Albrecht, if you want to keep the API, I am ok with that too.

We have `margin(int, int, int int)` and `margins(int*, int*, int*, int*)`, one to set and one to retrieve all margins, and `margin()` to get the left margin, and `margin(int, int=0)` to set all margins equally and optionally the gap. Shouldn't we either use the singular `margin` for all cases, or use `margins(int, int, int int)` instead of `margin(int, int, int int)`?

We have `set_size(Widget*)`, `set_size(Widget*,int)`, and `set_size(Widget&, int)`. `int` has a double meaning here. If it's 0, don't use a fixed size, else be fixed. My suggestion is `int fixed(Widget*) const`, `void fixed(Widget*, int yes)`, and `void fixed_size(Widget*, int size)`. This takes away the special meaning of size 0. The naming seem more explanatory to me, and it follows the FLTK rule that getters and setters have no get and set prefix.

The first form returns 0 or 1 if a widget is flexible or fixed.

The second form sets a widget fixed to its current size. This is neat because the constructer requires a width and height anyway, so just use that.

The third form can set a fixed size of 0 as well, because `fixed(w, 0)` can make a widget flexible again.

And finally, I would like a `int size(Widget*)` that returns `w()` or `h()`, depending on `Fl_Flex::horizontal()`.

Thanks for reading.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/59ed32f8-ffc7-4c8a-af75-88680a7c3cb7n%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.