Skip to content

Commit

Permalink
Add more doc-links in docstrings (#1419)
Browse files Browse the repository at this point in the history
  • Loading branch information
4JX authored Apr 3, 2022
1 parent 861b0e1 commit 6091370
Show file tree
Hide file tree
Showing 60 changed files with 257 additions and 257 deletions.
2 changes: 1 addition & 1 deletion egui/src/containers/area.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Area is a `Ui` that has no parent, it floats on the background.
//! Area is a [`Ui`] that has no parent, it floats on the background.
//! It has no frame or own size. It is potentially movable.
//! It is the foundation for windows and popups.

Expand Down
24 changes: 12 additions & 12 deletions egui/src/containers/collapsing_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ pub struct CollapsingHeader {
}

impl CollapsingHeader {
/// The `CollapsingHeader` starts out collapsed unless you call `default_open`.
/// The [`CollapsingHeader`] starts out collapsed unless you call `default_open`.
///
/// The label is used as an [`Id`] source.
/// If the label is unique and static this is fine,
/// but if it changes or there are several `CollapsingHeader` with the same title
/// but if it changes or there are several [`CollapsingHeader`] with the same title
/// you need to provide a unique id source with [`Self::id_source`].
pub fn new(text: impl Into<WidgetText>) -> Self {
let text = text.into();
Expand All @@ -170,7 +170,7 @@ impl CollapsingHeader {
}
}

/// By default, the `CollapsingHeader` is collapsed.
/// By default, the [`CollapsingHeader`] is collapsed.
/// Call `.default_open(true)` to change this.
pub fn default_open(mut self, open: bool) -> Self {
self.default_open = open;
Expand All @@ -187,29 +187,29 @@ impl CollapsingHeader {
self
}

/// Explicitly set the source of the `Id` of this widget, instead of using title label.
/// Explicitly set the source of the [`Id`] of this widget, instead of using title label.
/// This is useful if the title label is dynamic or not unique.
pub fn id_source(mut self, id_source: impl Hash) -> Self {
self.id_source = Id::new(id_source);
self
}

/// If you set this to `false`, the `CollapsingHeader` will be grayed out and un-clickable.
/// If you set this to `false`, the [`CollapsingHeader`] will be grayed out and un-clickable.
///
/// This is a convenience for [`Ui::set_enabled`].
pub fn enabled(mut self, enabled: bool) -> Self {
self.enabled = enabled;
self
}

/// Can the `CollapsingHeader` be selected by clicking it? Default: `false`.
/// Can the [`CollapsingHeader`] be selected by clicking it? Default: `false`.
///
pub fn selectable(mut self, selectable: bool) -> Self {
self.selectable = selectable;
self
}

/// If you set this to 'true', the `CollapsingHeader` will be shown as selected.
/// If you set this to 'true', the [`CollapsingHeader`] will be shown as selected.
///
/// Example:
/// ```
Expand All @@ -229,9 +229,9 @@ impl CollapsingHeader {
self
}

/// Should the `CollapsingHeader` show a background behind it? Default: `false`.
/// Should the [`CollapsingHeader`] show a background behind it? Default: `false`.
///
/// To show it behind all `CollapsingHeader` you can just use:
/// To show it behind all [`CollapsingHeader`] you can just use:
/// ```
/// # egui::__run_test_ui(|ui| {
/// ui.visuals_mut().collapsing_header_frame = true;
Expand All @@ -242,8 +242,8 @@ impl CollapsingHeader {
self
}

/// Use the provided function to render a different `CollapsingHeader` icon.
/// Defaults to a triangle that animates as the `CollapsingHeader` opens and closes.
/// Use the provided function to render a different [`CollapsingHeader`] icon.
/// Defaults to a triangle that animates as the [`CollapsingHeader`] opens and closes.
///
/// For example:
/// ```
Expand Down Expand Up @@ -397,7 +397,7 @@ impl CollapsingHeader {
add_contents: Box<dyn FnOnce(&mut Ui) -> R + 'c>,
) -> CollapsingResponse<R> {
// Make sure contents are bellow header,
// and make sure it is one unit (necessary for putting a `CollapsingHeader` in a grid).
// and make sure it is one unit (necessary for putting a [`CollapsingHeader`] in a grid).
ui.vertical(|ui| {
ui.set_enabled(self.enabled);

Expand Down
8 changes: 4 additions & 4 deletions egui/src/containers/combo_box.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{style::WidgetVisuals, *};
use epaint::Shape;

/// A function that paints the `ComboBox` icon
/// A function that paints the [`ComboBox`] icon
pub type IconPainter = Box<dyn FnOnce(&Ui, Rect, &WidgetVisuals, bool)>;

/// A drop-down selection menu with a descriptive label.
Expand Down Expand Up @@ -31,7 +31,7 @@ pub struct ComboBox {
}

impl ComboBox {
/// Create new `ComboBox` with id and label
/// Create new [`ComboBox`] with id and label
pub fn new(id_source: impl std::hash::Hash, label: impl Into<WidgetText>) -> Self {
Self {
id_source: Id::new(id_source),
Expand Down Expand Up @@ -77,8 +77,8 @@ impl ComboBox {
self
}

/// Use the provided function to render a different `ComboBox` icon.
/// Defaults to a triangle that expands when the cursor is hovering over the `ComboBox`.
/// Use the provided function to render a different [`ComboBox`] icon.
/// Defaults to a triangle that expands when the cursor is hovering over the [`ComboBox`].
///
/// For example:
/// ```
Expand Down
24 changes: 12 additions & 12 deletions egui/src/containers/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl PanelState {

// ----------------------------------------------------------------------------

/// `Left` or `Right`
/// [`Left`](Side::Left) or [`Right`](Side::Right)
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Side {
Left,
Expand Down Expand Up @@ -132,7 +132,7 @@ impl SidePanel {
self
}

/// The initial wrapping width of the `SidePanel`.
/// The initial wrapping width of the [`SidePanel`].
pub fn default_width(mut self, default_width: f32) -> Self {
self.default_width = default_width;
self
Expand Down Expand Up @@ -162,7 +162,7 @@ impl SidePanel {
}

impl SidePanel {
/// Show the panel inside a `Ui`.
/// Show the panel inside a [`Ui`].
pub fn show_inside<R>(
self,
ui: &mut Ui,
Expand All @@ -171,7 +171,7 @@ impl SidePanel {
self.show_inside_dyn(ui, Box::new(add_contents))
}

/// Show the panel inside a `Ui`.
/// Show the panel inside a [`Ui`].
fn show_inside_dyn<'c, R>(
self,
ui: &mut Ui,
Expand Down Expand Up @@ -321,7 +321,7 @@ impl SidePanel {

// ----------------------------------------------------------------------------

/// `Top` or `Bottom`
/// [`Top`](TopBottomSide::Top) or [`Bottom`](TopBottomSide::Bottom)
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TopBottomSide {
Top,
Expand Down Expand Up @@ -416,7 +416,7 @@ impl TopBottomPanel {
self
}

/// The initial height of the `SidePanel`.
/// The initial height of the [`SidePanel`].
/// Defaults to [`style::Spacing::interact_size`].y.
pub fn default_height(mut self, default_height: f32) -> Self {
self.default_height = Some(default_height);
Expand Down Expand Up @@ -447,7 +447,7 @@ impl TopBottomPanel {
}

impl TopBottomPanel {
/// Show the panel inside a `Ui`.
/// Show the panel inside a [`Ui`].
pub fn show_inside<R>(
self,
ui: &mut Ui,
Expand All @@ -456,7 +456,7 @@ impl TopBottomPanel {
self.show_inside_dyn(ui, Box::new(add_contents))
}

/// Show the panel inside a `Ui`.
/// Show the panel inside a [`Ui`].
fn show_inside_dyn<'c, R>(
self,
ui: &mut Ui,
Expand Down Expand Up @@ -615,9 +615,9 @@ impl TopBottomPanel {
/// A panel that covers the remainder of the screen,
/// i.e. whatever area is left after adding other panels.
///
/// `CentralPanel` must be added after all other panels.
/// [`CentralPanel`] must be added after all other panels.
///
/// NOTE: Any [`Window`]s and [`Area`]s will cover the top-level `CentralPanel`.
/// NOTE: Any [`Window`]s and [`Area`]s will cover the top-level [`CentralPanel`].
///
/// See the [module level docs](crate::containers::panel) for more details.
///
Expand All @@ -643,7 +643,7 @@ impl CentralPanel {
}

impl CentralPanel {
/// Show the panel inside a `Ui`.
/// Show the panel inside a [`Ui`].
pub fn show_inside<R>(
self,
ui: &mut Ui,
Expand All @@ -652,7 +652,7 @@ impl CentralPanel {
self.show_inside_dyn(ui, Box::new(add_contents))
}

/// Show the panel inside a `Ui`.
/// Show the panel inside a [`Ui`].
fn show_inside_dyn<'c, R>(
self,
ui: &mut Ui,
Expand Down
8 changes: 4 additions & 4 deletions egui/src/containers/resize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Default for Resize {
resizable: true,
min_size: Vec2::splat(16.0),
max_size: Vec2::splat(f32::INFINITY),
default_size: vec2(320.0, 128.0), // TODO: preferred size of `Resize` area.
default_size: vec2(320.0, 128.0), // TODO: preferred size of [`Resize`] area.
with_stroke: true,
}
}
Expand All @@ -65,7 +65,7 @@ impl Resize {
self
}

/// A source for the unique `Id`, e.g. `.id_source("second_resize_area")` or `.id_source(loop_index)`.
/// A source for the unique [`Id`], e.g. `.id_source("second_resize_area")` or `.id_source(loop_index)`.
pub fn id_source(mut self, id_source: impl std::hash::Hash) -> Self {
self.id_source = Some(Id::new(id_source));
self
Expand All @@ -85,7 +85,7 @@ impl Resize {
/// Preferred / suggested height. Actual height will depend on contents.
///
/// Examples:
/// * if the contents is a `ScrollArea` then this decides the maximum size.
/// * if the contents is a [`ScrollArea`] then this decides the maximum size.
/// * if the contents is a canvas, this decides the height of it,
/// * if the contents is text and buttons, then the `default_height` is ignored
/// and the height is picked automatically..
Expand Down Expand Up @@ -217,7 +217,7 @@ impl Resize {
} else {
// We are not being actively resized, so auto-expand to include size of last frame.
// This prevents auto-shrinking if the contents contain width-filling widgets (separators etc)
// but it makes a lot of interactions with `Window`s nicer.
// but it makes a lot of interactions with [`Window`]s nicer.
state.desired_size = state.desired_size.max(state.last_content_size);
}

Expand Down
18 changes: 9 additions & 9 deletions egui/src/containers/scroll_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub struct ScrollAreaOutput<R> {
/// What the user closure returned.
pub inner: R,

/// `Id` of the `ScrollArea`.
/// [`Id`] of the [`ScrollArea`].
pub id: Id,

/// The current state of the scroll area.
Expand Down Expand Up @@ -136,7 +136,7 @@ impl ScrollArea {

/// 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).
/// 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 {
Expand All @@ -146,7 +146,7 @@ impl ScrollArea {

/// 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).
/// 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 {
Expand All @@ -156,7 +156,7 @@ impl ScrollArea {

/// The minimum width of a horizontal scroll area which requires scroll bars.
///
/// The `ScrollArea` will only become smaller than this if the content is smaller than this
/// The [`ScrollArea`] will only become smaller than this if the content is smaller than this
/// (and so we don't require scroll bars).
///
/// Default: `64.0`.
Expand All @@ -167,7 +167,7 @@ impl ScrollArea {

/// The minimum height of a vertical scroll area which requires scroll bars.
///
/// The `ScrollArea` will only become smaller than this if the content is smaller than this
/// The [`ScrollArea`] will only become smaller than this if the content is smaller than this
/// (and so we don't require scroll bars).
///
/// Default: `64.0`.
Expand All @@ -183,7 +183,7 @@ impl ScrollArea {
self
}

/// A source for the unique `Id`, e.g. `.id_source("second_scroll_area")` or `.id_source(loop_index)`.
/// A source for the unique [`Id`], e.g. `.id_source("second_scroll_area")` or `.id_source(loop_index)`.
pub fn id_source(mut self, id_source: impl std::hash::Hash) -> Self {
self.id_source = Some(Id::new(id_source));
self
Expand Down Expand Up @@ -241,7 +241,7 @@ impl ScrollArea {
/// If `false`, the scroll area will not respond to user scrolling
///
/// This can be used, for example, to optionally freeze scrolling while the user
/// is inputing text in a `TextEdit` widget contained within the scroll area.
/// is inputing text in a [`TextEdit`] widget contained within the scroll area.
///
/// This controls both scrolling directions.
pub fn enable_scrolling(mut self, enable: bool) -> Self {
Expand Down Expand Up @@ -358,7 +358,7 @@ impl ScrollArea {
let mut inner_size = outer_size - current_bar_use;

// Don't go so far that we shrink to zero.
// In particular, if we put a `ScrollArea` inside of a `ScrollArea`, the inner
// In particular, if we put a [`ScrollArea`] inside of a [`ScrollArea`], the inner
// one shouldn't collapse into nothingness.
// See https://github.com/emilk/egui/issues/1097
for d in 0..2 {
Expand Down Expand Up @@ -414,7 +414,7 @@ impl ScrollArea {
}
}

/// Show the `ScrollArea`, and add the contents to the viewport.
/// Show the [`ScrollArea`], and add the contents to the viewport.
///
/// If the inner area can be very long, consider using [`Self::show_rows`] instead.
pub fn show<R>(
Expand Down
4 changes: 2 additions & 2 deletions egui/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl ContextImpl {
/// [`Context`] is cheap to clone, and any clones refers to the same mutable data
/// ([`Context`] uses refcounting internally).
///
/// All methods are marked `&self`; `Context` has interior mutability (protected by a mutex).
/// All methods are marked `&self`; [`Context`] has interior mutability (protected by a mutex).
///
///
/// You can store
Expand Down Expand Up @@ -287,7 +287,7 @@ impl Context {
self.interact_with_hovered(layer_id, id, rect, sense, enabled, hovered)
}

/// You specify if a thing is hovered, and the function gives a `Response`.
/// You specify if a thing is hovered, and the function gives a [`Response`].
pub(crate) fn interact_with_hovered(
&self,
layer_id: LayerId,
Expand Down
4 changes: 2 additions & 2 deletions egui/src/data/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ pub enum Event {
Paste(String),
/// Text input, e.g. via keyboard.
///
/// When the user presses enter/return, do not send a `Text` (just [`Key::Enter`]).
/// When the user presses enter/return, do not send a [`Text`](Event::Text) (just [`Key::Enter`]).
Text(String),
/// A key was pressed or released.
Key {
Expand Down Expand Up @@ -255,7 +255,7 @@ pub const NUM_POINTER_BUTTONS: usize = 3;

/// State of the modifier keys. These must be fed to egui.
///
/// The best way to compare `Modifiers` is by using [`Modifiers::matches`].
/// The best way to compare [`Modifiers`] is by using [`Modifiers::matches`].
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct Modifiers {
Expand Down
4 changes: 2 additions & 2 deletions egui/src/data/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub struct PlatformOutput {
/// Events that may be useful to e.g. a screen reader.
pub events: Vec<OutputEvent>,

/// Is there a mutable `TextEdit` under the cursor?
/// Is there a mutable [`TextEdit`](crate::TextEdit) under the cursor?
/// Use by `egui_web` to show/hide mobile keyboard and IME agent.
pub mutable_text_under_cursor: bool,

Expand Down Expand Up @@ -321,7 +321,7 @@ pub struct WidgetInfo {
pub enabled: bool,
/// The text on labels, buttons, checkboxes etc.
pub label: Option<String>,
/// The contents of some editable text (for `TextEdit` fields).
/// The contents of some editable text (for [`TextEdit`](crate::TextEdit) fields).
pub current_text_value: Option<String>,
// The previous text value.
pub prev_text_value: Option<String>,
Expand Down
Loading

0 comments on commit 6091370

Please sign in to comment.