Giter Site home page Giter Site logo

fltkl's Introduction

This library provides a method for widget layout without requiring explicit pixel geometry to be specified and should be a good alternative to using fluid for creating nice interfaces without the clutter of automatically generated code.

This is influenced from years of working with Qt. Unlike Qt's layout this is much lighter weight and should work for most general interfaces.

Using these layouts:

  • Create widgets, configure their contents, optionally call "fltkl::presize" on each one.
  • Create any leading/trailing labels.
  • Create main layout, add layout(s) and widget(s) to them (nested also works).
  • Create GroupLayout, set the main layout.
  • Set border and internal spacing for GroupLayout.

Classes include:

  • fltkl::GroupLayout: derives from fltk::Group
  • fltkl::LayoutLinear: base class for linear layouts
  • fltkl::LayoutVert: vertical layout
  • fltkl::LayoutHorz: horizontal layout
  • fltkl::LayoutSpace: resizable/fixed space
  • fltkl::LayoutAdder: allows for very compact layout code
  • fltkl::LayoutWidget: widget wrapper, mostly hidden

Utilities:

  • fltkl: defines constant values for typical spacing
  • presize: sizes a widget based on content
  • widgets: make presized labels and attach to (check)buttons

How this works:

  • Calling presize on all the widgets gives them an initial size.
  • Adding the Widgets to layouts results in the wrapping LayoutWidget recording the widget's initial size.
  • Layout classes recursively can compute a minimum size and can also recursively direct the widgets for size and placement.

Limitations:

  • Only decoupled linear layouts are implemented. Leading labels can be handled by using to "presizeToMaxWide" on a vector of labels to line up. These labels then should NOT be set resizable.
  • Layouts are designed to be static once created. They should not be changed on the fly (I haven't tested the effects of this yet). Consider using fltkl::Stack to swap out various configurations.

Why should I use this?

  • Allows you to build Groups without hard coding geometries.
  • Allows UI contents to be shuffled around by only changing the way the layouts are built (sans gui builder).
  • Begin/End calls not required. GroupLayout::setLayout recursively calls add() on each containing widget.
  • A single GroupLayout can typically be used for a whole multi widget window.

Other features:

  • Recursed fltk::Groups are replaced by recursed Layout classes.

fltkl's People

Contributors

traeak avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

fltkl's Issues

MIT license for code copyrighted by Stellacore

Coming from an old Qt programmer myself, I think you may have done some really nice work here with these layout classes. I wish there were lots more of that Qt -> FLTK bridge code developed in the world.

I am grateful you have chosen MIT license for your work, per your LICENSE file. But in terms of possibly trying to use your code in my work, I am a bit uncomfortable after finding copyright references to "Stellacore" in comments in various files. Are you able to remove those so as to clean things up for the MIT license terms? Or are those files not covered by the MIT license perhaps? Please clarify. (I am not a lawyer and you probably aren't either, but I would appreciate your feedback on this subject anyway.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.