1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 21:30:03 -04:00

Improve docs

This commit is contained in:
Emil Ernerfeldt
2021-10-23 05:58:10 +02:00
parent 4194a83a5e
commit a3ba85dbb3
9 changed files with 115 additions and 24 deletions

View File

@@ -105,7 +105,8 @@ impl SidePanel {
}
}
/// Switch resizable on/off.
/// Can panel be resized by dragging the edge of it?
///
/// Default is `true`.
pub fn resizable(mut self, resizable: bool) -> Self {
self.resizable = resizable;
@@ -381,7 +382,8 @@ impl TopBottomPanel {
}
}
/// Switch resizable on/off.
/// Can panel be resized by dragging the edge of it?
///
/// Default is `false`.
pub fn resizable(mut self, resizable: bool) -> Self {
self.resizable = resizable;

View File

@@ -116,17 +116,21 @@ impl ScrollArea {
Self::vertical().max_height(max_height)
}
/// The desired width of the outer frame of the scroll area.
/// The maximum width of the outer frame of the scroll area.
///
/// Use `f32::INFINITY` if you want the scroll area to expand to fit the surrounding `Ui` (default).
///
/// See also [`Self::auto_shrink`].
pub fn max_width(mut self, max_width: f32) -> Self {
self.max_size.x = max_width;
self
}
/// The desired height of the outer frame of the scroll area.
/// The maximum height of the outer frame of the scroll area.
///
/// Use `f32::INFINITY` if you want the scroll area to expand to fit the surrounding `Ui` (default).
///
/// See also [`Self::auto_shrink`].
pub fn max_height(mut self, max_height: f32) -> Self {
self.max_size.y = max_height;
self
@@ -185,8 +189,7 @@ impl ScrollArea {
self
}
/// For each enabled axis, should the containing area shrink
/// if the content is small?
/// For each axis, should the containing area shrink if the content is small?
///
/// If true, egui will add blank space outside the scroll area.
/// If false, egui will add blank space inside the scroll area.

View File

@@ -243,20 +243,20 @@
//! # let mut some_bool = true;
//! // Miscellaneous tips and tricks
//!
//! ui.horizontal_wrapped(|ui|{
//! ui.horizontal_wrapped(|ui| {
//! ui.spacing_mut().item_spacing.x = 0.0; // remove spacing between widgets
//! // `radio_value` also works for enums, integers, and more.
//! ui.radio_value(&mut some_bool, false, "Off");
//! ui.radio_value(&mut some_bool, true, "On");
//! });
//!
//! ui.group(|ui|{
//! ui.group(|ui| {
//! ui.label("Within a frame");
//! ui.set_min_height(200.0);
//! });
//!
//! // A `scope` creates a temporary [`Ui`] in which you can change settings:
//! ui.scope(|ui|{
//! ui.scope(|ui| {
//! ui.visuals_mut().override_text_color = Some(egui::Color32::RED);
//! ui.style_mut().override_text_style = Some(egui::TextStyle::Monospace);
//! ui.style_mut().wrap = Some(false);

View File

@@ -227,7 +227,7 @@ impl Ui {
/// ```
/// # let ui = &mut egui::Ui::__test();
/// # let mut enabled = true;
/// ui.group(|ui|{
/// ui.group(|ui| {
/// ui.checkbox(&mut enabled, "Enable subsection");
/// ui.set_enabled(enabled);
/// if ui.button("Button that is not always clickable").clicked() {
@@ -260,7 +260,7 @@ impl Ui {
/// ```
/// # let ui = &mut egui::Ui::__test();
/// # let mut visible = true;
/// ui.group(|ui|{
/// ui.group(|ui| {
/// ui.checkbox(&mut visible, "Show subsection");
/// ui.set_visible(visible);
/// if ui.button("Button that is not always shown").clicked() {
@@ -1333,7 +1333,7 @@ impl Ui {
///
/// ```
/// # let ui = &mut egui::Ui::__test();
/// ui.group(|ui|{
/// ui.group(|ui| {
/// ui.label("Within a frame");
/// });
/// ```
@@ -1349,7 +1349,7 @@ impl Ui {
///
/// ```
/// # let ui = &mut egui::Ui::__test();
/// ui.scope(|ui|{
/// ui.scope(|ui| {
/// ui.spacing_mut().slider_width = 200.0; // Temporary change
/// // …
/// });
@@ -1467,7 +1467,7 @@ impl Ui {
///
/// ```
/// # let ui = &mut egui::Ui::__test();
/// ui.horizontal(|ui|{
/// ui.horizontal(|ui| {
/// ui.label("Same");
/// ui.label("row");
/// });
@@ -1541,7 +1541,7 @@ impl Ui {
///
/// ```
/// # let ui = &mut egui::Ui::__test();
/// ui.vertical(|ui|{
/// ui.vertical(|ui| {
/// ui.label("over");
/// ui.label("under");
/// });
@@ -1558,7 +1558,7 @@ impl Ui {
///
/// ```
/// # let ui = &mut egui::Ui::__test();
/// ui.vertical_centered(|ui|{
/// ui.vertical_centered(|ui| {
/// ui.label("over");
/// ui.label("under");
/// });
@@ -1576,7 +1576,7 @@ impl Ui {
///
/// ```
/// # let ui = &mut egui::Ui::__test();
/// ui.vertical_centered_justified(|ui|{
/// ui.vertical_centered_justified(|ui| {
/// ui.label("over");
/// ui.label("under");
/// });