Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fltk-rs/fltk-anchor
An anchoring mechanism for fltk-rs widgets
https://github.com/fltk-rs/fltk-anchor
Last synced: about 2 months ago
JSON representation
An anchoring mechanism for fltk-rs widgets
- Host: GitHub
- URL: https://github.com/fltk-rs/fltk-anchor
- Owner: fltk-rs
- License: mit
- Created: 2021-09-01T13:30:09.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-31T22:16:43.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T05:52:48.245Z (3 months ago)
- Language: Rust
- Size: 12.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fltk-anchor
An anchoring mechanism for fltk-rs widgets, useful when resizing the parent to override FLTK's default resizing defaults.
## Usage
```toml
[dependencies]
fltk = 1.1
fltk-anchor = "0.1"
```## Example
```rust
use fltk::{prelude::*, *};
use fltk_anchor::{Anchor, Anchored};const PADDING: i32 = 8;
fn main() {
let a = app::App::default();
let mut win = window::Window::default().with_size(400, 300);button::Button::new(PADDING, PADDING, 80, 40, "Click").with_anchor(Anchor::Left | Anchor::Top);
input::MultilineInput::new(
PADDING,
PADDING * 2 + 40,
400 - PADDING * 2,
300 - 40 - PADDING * 3,
"",
)
.with_anchor(Anchor::Left | Anchor::Right | Anchor::Top | Anchor::Bottom);win.end();
win.make_resizable(true);
win.show();a.run().unwrap();
}
```
This indicates to fltk that when resizing, the button has a fixed size and position, while the input fills the remaining part of the window.