1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-03 15:20:05 -04:00

Misc doc improvements

This commit is contained in:
Emil Ernerfeldt
2022-04-13 22:05:19 +02:00
parent 2ae93c40ab
commit a7b6334784
14 changed files with 48 additions and 16 deletions

View File

@@ -122,7 +122,6 @@ pub type IconPainter = Box<dyn FnOnce(&mut Ui, f32, &Response)>;
/// A header which can be collapsed/expanded, revealing a contained [`Ui`] region.
///
///
/// ```
/// # egui::__run_test_ui(|ui| {
/// egui::CollapsingHeader::new("Heading")

View File

@@ -3,7 +3,17 @@
use crate::{layers::ShapeIdx, style::Margin, *};
use epaint::*;
/// Color and margin of a rectangular background of a [`Ui`].
/// Add a background, frame and/or margin to a rectangular background of a [`Ui`].
///
/// ```
/// # egui::__run_test_ui(|ui| {
/// egui::Frame::none()
/// .fill(egui::Color32::RED)
/// .show(ui, |ui| {
/// ui.label("Label with red background");
/// });
/// # });
/// ```
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[must_use = "You should call .show()"]
pub struct Frame {

View File

@@ -74,6 +74,8 @@ pub struct ScrollAreaOutput<R> {
/// });
/// # });
/// ```
///
/// You can scroll to an element using [`Response::scroll_to_me`], [`Ui::scroll_to_cursor`] and [`Ui::scroll_to_rect`].
#[derive(Clone, Debug)]
#[must_use = "You should call .show()"]
pub struct ScrollArea {

View File

@@ -176,6 +176,9 @@
//! by how much the slider has been dragged in the previous few milliseconds.
//! This means it is responsibility of the egui user to store the state (`value`) so that it persists between frames.
//!
//! It can be useful to read the code for the toggle switch example widget to get a better understanding
//! of how egui works: <https://github.com/emilk/egui/blob/master/egui_demo_lib/src/apps/demo/toggle_switch.rs>.
//!
//! Read more about the pros and cons of immediate mode at <https://github.com/emilk/egui#why-immediate-mode>.
//!
//! # Misc

View File

@@ -918,7 +918,7 @@ impl Ui {
///
/// If `align` is `None`, it'll scroll enough to bring the cursor into view.
///
/// See also: [`Response::scroll_to_me`], [`Ui::scroll_to_rect`].
/// See also: [`Response::scroll_to_me`], [`Ui::scroll_to_cursor`].
///
/// ```
/// # use egui::Align;

View File

@@ -46,6 +46,9 @@ use super::{CCursorRange, CursorRange, TextEditOutput, TextEditState};
///
/// ## Advanced usage
/// See [`TextEdit::show`].
///
/// ## Other
/// The background color of a [`TextEdit`] is [`Visuals::extreme_bg_color`].
#[must_use = "You should put this widget in an ui with `ui.add(widget);`"]
pub struct TextEdit<'t> {
text: &'t mut dyn TextBuffer,