repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/shared/timer.rs | druid-shell/src/backend/shared/timer.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use crate::TimerToken;
use std::{cmp::Ordering, time::Instant};
/// A timer is a deadline (`std::Time::Instant`) and a `TimerToken`.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) struct Timer<T> {
deadline: Instant,
token: Ti... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/shared/mod.rs | druid-shell/src/backend/shared/mod.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Logic that is shared by more than one backend.
cfg_if::cfg_if! {
if #[cfg(any(target_os = "freebsd", target_os = "macos", target_os = "linux", target_os = "openbsd"))] {
mod keyboard;
pub use keyboard::*;
}
}
cfg_if... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/shared/keyboard.rs | druid-shell/src/backend/shared/keyboard.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Keyboard logic that is shared by more than one backend.
#[allow(unused)]
use keyboard_types::{Code, Location};
#[cfg(any(
all(
any(feature = "x11", feature = "wayland"),
any(target_os = "freebsd", target_os = "linux", ... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/shared/linux/env.rs | druid-shell/src/backend/shared/linux/env.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
pub fn locale() -> String {
fn locale_env_var(var: &str) -> Option<String> {
match std::env::var(var) {
Ok(s) if s.is_empty() => {
tracing::debug!("locale: ignoring empty env var {}", var);
... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/shared/linux/mod.rs | druid-shell/src/backend/shared/linux/mod.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
// environment based utilities
pub mod env;
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/shared/xkb/keycodes.rs | druid-shell/src/backend/shared/xkb/keycodes.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
#![allow(non_upper_case_globals)]
use keyboard_types::Key;
use super::xkbcommon_sys::*;
/// Map from an xkb_common key code to a key, if possible.
pub fn map_key(keysym: u32) -> Key {
use Key::*;
match keysym {
XKB_KEY_v => K... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/shared/xkb/mod.rs | druid-shell/src/backend/shared/xkb/mod.rs | // Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A minimal wrapper around Xkb for our use.
mod keycodes;
mod xkbcommon_sys;
use crate::{
backend::shared::{code_to_location, hardware_keycode_to_code},
KeyEvent, KeyState, Modifiers,
};
use keyboard_types::{Code, Key};
use std::conv... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/shared/xkb/xkbcommon_sys.rs | druid-shell/src/backend/shared/xkb/xkbcommon_sys.rs | // Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
#![allow(unused, non_upper_case_globals, non_camel_case_types, non_snake_case)]
// unknown lints to make compile on older rust versions
#![cfg_attr(test, allow(unknown_lints, deref_nullptr))]
// generated code has some redundant static lifetime... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/web/keycodes.rs | druid-shell/src/backend/web/keycodes.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Web keycode handling.
use web_sys::KeyboardEvent;
use crate::keyboard::{Code, KbKey, KeyEvent, KeyState, Location, Modifiers};
/// Convert a web-sys KeyboardEvent into a keyboard-types one.
pub(crate) fn convert_keyboard_event(
event... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/web/clipboard.rs | druid-shell/src/backend/web/clipboard.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Interactions with the browser pasteboard.
use crate::clipboard::{ClipboardFormat, FormatId};
/// The browser clipboard.
#[derive(Debug, Clone, Default)]
pub struct Clipboard;
impl Clipboard {
/// Put a string onto the system clipboar... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/web/menu.rs | druid-shell/src/backend/web/menu.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Safe wrapper for menus.
use crate::hotkey::HotKey;
/// A menu object, which can be either a top-level menubar or a
/// submenu.
pub struct Menu;
impl Drop for Menu {
fn drop(&mut self) {
// TODO
}
}
impl Menu {
pub f... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/web/error.rs | druid-shell/src/backend/web/error.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Web backend errors.
use wasm_bindgen::JsValue;
#[derive(Debug, Clone)]
pub enum Error {
NoWindow,
NoDocument,
Js(JsValue),
JsCast,
NoElementById(String),
NoContext,
Unimplemented,
}
impl std::fmt::Display for ... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/web/application.rs | druid-shell/src/backend/web/application.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Web implementation of features at the application scope.
use crate::application::AppHandler;
use super::clipboard::Clipboard;
use super::error::Error;
#[derive(Clone)]
pub(crate) struct Application;
impl Application {
pub fn new() -... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/web/mod.rs | druid-shell/src/backend/web/mod.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Web-based backend support
pub mod application;
pub mod clipboard;
pub mod error;
pub mod keycodes;
pub mod menu;
pub mod screen;
pub mod window;
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/web/window.rs | druid-shell/src/backend/web/window.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Web window creation and management.
use std::cell::{Cell, RefCell};
use std::ffi::OsString;
use std::rc::{Rc, Weak};
use std::sync::{Arc, Mutex};
use instant::Instant;
use tracing::{error, warn};
use wasm_bindgen::prelude::*;
use wasm_bin... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/backend/web/screen.rs | druid-shell/src/backend/web/screen.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Monitor and Screen information ignored for web.
use crate::screen::Monitor;
pub(crate) fn get_monitors() -> Vec<Monitor> {
tracing::warn!("Screen::get_monitors() is not implemented for web.");
Vec::new()
}
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/platform/linux.rs | druid-shell/src/platform/linux.rs | // Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Linux specific extensions.
use crate::Clipboard;
/// Linux specific extensions to [`Application`]
///
/// [`Application`]: crate::Application
pub trait ApplicationExt {
/// Returns a handle to the primary system clipboard.
///
... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/platform/mod.rs | druid-shell/src/platform/mod.rs | // Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Platorm specific extensions.
#[cfg(any(
doc,
any(target_os = "freebsd", target_os = "linux", target_os = "openbsd")
))]
pub mod linux;
#[cfg(any(doc, target_os = "macos"))]
pub mod mac;
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/src/platform/mac.rs | druid-shell/src/platform/mac.rs | // Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! macOS specific extensions.
/// macOS specific extensions to [`Application`]
///
/// [`Application`]: crate::Application
pub trait ApplicationExt {
/// Hide the application this window belongs to. (cmd+H)
fn hide(&self);
/// Hi... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/examples/shello.rs | druid-shell/examples/shello.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use std::any::Any;
use druid_shell::kurbo::{Line, Size};
use druid_shell::piet::{Color, RenderContext};
use druid_shell::{
Application, Cursor, FileDialogOptions, FileDialogToken, FileInfo, FileSpec, HotKey, KeyEvent,
Menu, MouseEvent... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/examples/edit_text.rs | druid-shell/examples/edit_text.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! This example shows a how a single-line text field might be implemented for `druid-shell`.
//! Beyond the omission of multiple lines and text wrapping, it also is missing many motions
//! (like "move to previous word") and bidirectional text... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/examples/quit.rs | druid-shell/examples/quit.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use std::any::Any;
use druid_shell::kurbo::{Line, Size};
use druid_shell::piet::{Color, RenderContext};
use druid_shell::{
Application, HotKey, Menu, Region, SysMods, WinHandler, WindowBuilder, WindowHandle,
};
const BG_COLOR: Color = Co... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/examples/perftest.rs | druid-shell/examples/perftest.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use std::any::Any;
use std::time::Instant;
use piet_common::kurbo::{Line, Size};
use piet_common::{Color, FontFamily, Piet, RenderContext, Text, TextLayoutBuilder};
use druid_shell::{Application, KeyEvent, Region, WinHandler, WindowBuilder, W... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid-shell/examples/invalidate.rs | druid-shell/examples/invalidate.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use std::any::Any;
use std::time::Instant;
use druid_shell::kurbo::{Point, Rect, Size};
use druid_shell::piet::{Color, Piet, RenderContext};
use druid_shell::{Application, Region, WinHandler, WindowBuilder, WindowHandle};
struct InvalidateT... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/docs/book_examples/src/lib.rs | docs/book_examples/src/lib.rs | //! Code samples used in the book, stored here so they are easier to test in CI.
#![allow(dead_code, unused_variables)]
mod custom_widgets_md;
mod data_md;
mod env_md;
mod getting_started_2_md;
mod getting_started_md;
mod lens_md;
mod widget_md;
| rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/docs/book_examples/src/getting_started_md.rs | docs/book_examples/src/getting_started_md.rs | #![allow(clippy::let_unit_value)]
// ANCHOR: example_1_imports
use druid::widget::Label;
use druid::{AppLauncher, Widget, WindowDesc};
// ANCHOR_END: example_1_imports
// ANCHOR: example_2_imports
use druid::widget::{Container, Flex, Split};
use druid::Color;
// ANCHOR_END: example_2_imports
// ANCHOR: example_3_imp... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/docs/book_examples/src/env_md.rs | docs/book_examples/src/env_md.rs | use druid::widget::Label;
use druid::{Color, Key, WidgetExt};
// ANCHOR: key_or_value
const IMPORTANT_LABEL_COLOR: Key<Color> = Key::new("org.linebender.example.important-label-color");
const RED: Color = Color::rgb8(0xFF, 0, 0);
fn make_labels() {
let with_value = Label::<()>::new("Warning!").with_text_color(RED... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/docs/book_examples/src/custom_widgets_md.rs | docs/book_examples/src/custom_widgets_md.rs | use druid::keyboard_types::Key;
use druid::widget::{Controller, Label, Painter, SizedBox, TextBox};
use druid::{
Color, Env, Event, EventCtx, PaintCtx, RenderContext, Selector, TimerToken, Widget, WidgetExt,
};
use std::time::Duration;
const CORNER_RADIUS: f64 = 4.0;
const STROKE_WIDTH: f64 = 2.0;
// ANCHOR: colo... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/docs/book_examples/src/lens_md.rs | docs/book_examples/src/lens_md.rs | use druid::{Data, Lens};
#[rustfmt::skip]
mod todo_item_lens {
use druid::Data;
// ANCHOR: todo_item
/// A single todo item.
#[derive(Clone, Data)]
struct TodoItem {
title: String,
completed: bool,
urgent: bool,
}
// ANCHOR_END: todo_item
}
// ANCHOR: todo_item_lens
/// A single todo item.
#[derive(Clone,... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/docs/book_examples/src/getting_started_2_md.rs | docs/book_examples/src/getting_started_2_md.rs | #![allow(unused)]
// ANCHOR: example_1_imports
use druid::widget::Label;
use druid::{AppLauncher, Widget, WindowDesc};
// ANCHOR_END: example_1_imports
// ANCHOR: example_2_imports
use druid::widget::{Container, Flex, Split};
use druid::Color;
// ANCHOR_END: example_2_imports
// ANCHOR: example_3_imports
use im::Vec... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/docs/book_examples/src/data_md.rs | docs/book_examples/src/data_md.rs | #![allow(clippy::rc_buffer)]
#[derive(Clone, PartialEq)]
struct DateTime(std::time::Instant);
// ANCHOR: derive
use druid::Data;
use std::sync::Arc;
#[derive(Clone, Data)]
/// The main model for a todo list application.
struct TodoList {
items: Arc<Vec<TodoItem>>,
}
#[derive(Clone, Data)]
/// A single todo item... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/docs/book_examples/src/widget_md.rs | docs/book_examples/src/widget_md.rs | // ANCHOR: padded_label
use druid::widget::{Label, Padding};
fn padded_label() {
let label: Label<()> = Label::new("Humour me");
let padded = Padding::new((4.0, 8.0), label);
}
// ANCHOR_END: padded_label
// ANCHOR: align_center
use druid::widget::Align;
fn align_center() {
let label: Label<()> = Label::... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/app.rs | druid/src/app.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Window building and app lifecycle.
use crate::ext_event::{ExtEventHost, ExtEventSink};
use crate::kurbo::{Point, Size};
use crate::menu::MenuManager;
use crate::shell::{Application, Error as PlatformError, WindowBuilder, WindowHandle, Wind... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/sub_window.rs | druid/src/sub_window.rs | // Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use crate::app::{PendingWindow, WindowConfig};
use crate::commands::{SUB_WINDOW_HOST_TO_PARENT, SUB_WINDOW_PARENT_TO_HOST};
use crate::lens::Unit;
use crate::widget::prelude::*;
use crate::win_handler::AppState;
use crate::{Data, Point, Widget,... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/event.rs | druid/src/event.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Events.
use std::ops::{Add, Sub};
use druid_shell::{Clipboard, KeyEvent, TimerToken};
use crate::kurbo::{Rect, Size};
use crate::mouse::MouseEvent;
use crate::{Command, Notification, Point, Scale, WidgetId};
/// An event, propagated dow... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/app_delegate.rs | druid/src/app_delegate.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Customizing application-level behaviour.
use std::any::{Any, TypeId};
use crate::{
commands, core::CommandQueue, ext_event::ExtEventHost, Command, Data, Env, Event, ExtEventSink,
Handled, SingleUse, Target, WindowDesc, WindowHandl... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/lib.rs | druid/src/lib.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Simple data-oriented GUI.
//!
//! Druid lets you build simple interactive graphical applications that
//! can be deployed on Windows, macOS, Linux, OpenBSD, FreeBSD and the web.
//!
//! Druid is built on top of [`druid-shell`], which implem... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/command.rs | druid/src/command.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Custom commands.
use std::any::{self, Any};
use std::{
marker::PhantomData,
sync::{Arc, Mutex},
};
use crate::{WidgetId, WindowId};
/// The identity of a [`Selector`].
///
/// [`Selector`]: struct.Selector.html
pub(crate) type Se... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/theme.rs | druid/src/theme.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Theme keys and initial values.
#![allow(missing_docs)]
use crate::kurbo::RoundedRectRadii;
use crate::piet::Color;
use crate::{Env, FontDescriptor, FontFamily, FontStyle, FontWeight, Insets, Key};
pub const WINDOW_BACKGROUND_COLOR: Key... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/mouse.rs | druid/src/mouse.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! The mousey bits
use crate::kurbo::{Point, Vec2};
use crate::{Cursor, Data, Modifiers, MouseButton, MouseButtons};
/// The state of the mouse for a click, mouse-up, move, or wheel event.
///
/// In `druid`, unlike in `druid_shell`, we trea... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/ext_event.rs | druid/src/ext_event.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Simple handle for submitting external events.
use std::any::Any;
use std::collections::VecDeque;
use std::sync::{Arc, Mutex};
use crate::command::SelectorSymbol;
use crate::shell::IdleHandle;
use crate::win_handler::EXT_EVENT_IDLE_TOKEN;
... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/dialog.rs | druid/src/dialog.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Configuration for open and save file dialogs.
//!
//! This is a wrapper around [`druid_shell::FileDialogOptions`] with a few extra Druid specifics.
//! As such, many of the docs are copied from `druid_shell`, and should be kept in sync.
us... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/localization.rs | druid/src/localization.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Localization handling.
//!
//! Localization is backed by [Fluent], via [fluent-rs].
//!
//! In Druid, the main way you will deal with localization is via the
//! [`LocalizedString`] struct.
//!
//! You construct a [`LocalizedString`] with a... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/scroll_component.rs | druid/src/scroll_component.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A component for embedding in another widget to provide consistent and
//! extendable scrolling behavior
use std::time::Duration;
use crate::kurbo::{Point, Rect, Vec2};
use crate::theme;
use crate::widget::{Axis, Viewport};
use crate::{Env... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/core.rs | druid/src/core.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! The fundamental Druid types.
use std::collections::VecDeque;
use tracing::{trace, trace_span, warn};
use crate::bloom::Bloom;
use crate::command::sys::{CLOSE_WINDOW, SUB_WINDOW_HOST_TO_PARENT, SUB_WINDOW_PARENT_TO_HOST};
use crate::comman... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | true |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/env.rs | druid/src/env.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! An environment which is passed downward into the widget tree.
// TODO: Figure out if Env really needs to stay Arc, or if it can be switched to Rc
#![allow(clippy::arc_with_non_send_sync)]
use std::any::{self, Any};
use std::borrow::Borrow... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/contexts.rs | druid/src/contexts.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! The context types that are passed into various widget methods.
use std::{
any::{Any, TypeId},
collections::{HashMap, VecDeque},
ops::{Deref, DerefMut},
rc::Rc,
time::Duration,
};
use tracing::{error, trace, warn};
use ... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | true |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/bloom.rs | druid/src/bloom.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A simple Bloom filter, used to track child widgets.
use std::hash::{Hash, Hasher};
use std::marker::PhantomData;
use fnv::FnvHasher;
const NUM_BITS: u64 = 64;
// the 'offset_basis' for the fnv-1a hash algorithm.
// see http://www.isthe.... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/util.rs | druid/src/util.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Miscellaneous utility functions.
use std::collections::HashMap;
use std::hash::Hash;
use std::mem;
/// Panic in debug and tracing::error in release mode.
///
/// This macro is in some way a combination of `panic` and `debug_assert`,
/// b... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/debug_state.rs | druid/src/debug_state.rs | // Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A data structure for representing widget trees.
use std::collections::HashMap;
/// A description widget and its children, clonable and comparable, meant
/// for testing and debugging. This is extremely not optimized.
#[derive(Default, Clo... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/box_constraints.rs | druid/src/box_constraints.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! The fundamental Druid types.
use crate::kurbo::Size;
use crate::widget::Axis;
/// Constraints for layout.
///
/// The layout strategy for Druid is strongly inspired by Flutter,
/// and this struct is similar to the [Flutter BoxConstraints... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/window.rs | druid/src/window.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Management of multiple windows.
use std::collections::{HashMap, VecDeque};
use std::mem;
use tracing::{error, info, trace_span};
// Automatically defaults to std::time::Instant on non Wasm platforms
use instant::Instant;
use crate::piet:... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/data.rs | druid/src/data.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Traits for handling value types.
use std::ptr;
use std::rc::Rc;
use std::sync::Arc;
use crate::kurbo::{self, ParamCurve};
use crate::piet;
use crate::shell::Scale;
pub use druid_derive::Data;
use piet::ImageBuf;
/// A trait used to repr... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/win_handler.rs | druid/src/win_handler.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! The implementation of the `WinHandler` trait (`druid-shell` integration).
use std::any::{Any, TypeId};
use std::cell::RefCell;
use std::collections::{HashMap, VecDeque};
use std::rc::Rc;
use crate::kurbo::Size;
use crate::piet::Piet;
use ... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | true |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/lens/mod.rs | druid/src/lens/mod.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Implementations of [`Lens`], a way of focusing on subfields of data.
//!
//! Lenses are useful whenever a widget only needs access to a subfield of a larger struct or
//! generally access to part of a larger value.
//!
//! For example: If o... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/lens/lens.rs | druid/src/lens/lens.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use std::marker::PhantomData;
use std::ops;
use std::sync::Arc;
use crate::Data;
/// A lens is a datatype that gives access to a part of a larger
/// data structure.
///
/// A simple example of a lens is a field of a struct; in this case,
///... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/tests/helpers.rs | druid/src/tests/helpers.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Helper types for test writing.
//!
//! This includes tools for making throwaway widgets more easily.
//!
//! Note: Some of these types are undocumented. They're meant to help maintainers of Druid and
//! people trying to build a framework o... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/tests/invalidation_tests.rs | druid/src/tests/invalidation_tests.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Tests related to propagation of invalid rects.
use float_cmp::assert_approx_eq;
use test_log::test;
use super::*;
#[test]
fn invalidate_union() {
let id_child1 = WidgetId::next();
let id_child2 = WidgetId::next();
let id_pare... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/tests/mod.rs | druid/src/tests/mod.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Additional unit tests that cross file or module boundaries.
#![allow(unused_imports)]
pub mod harness;
pub mod helpers;
#[cfg(test)]
mod invalidation_tests;
#[cfg(test)]
mod layout_tests;
use std::cell::Cell;
use std::collections::HashM... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | true |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/tests/layout_tests.rs | druid/src/tests/layout_tests.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Tests related to layout.
use float_cmp::assert_approx_eq;
use test_log::test;
use super::*;
#[test]
fn simple_layout() {
const BOX_WIDTH: f64 = 200.;
const PADDING: f64 = 10.;
let id_1 = WidgetId::next();
let widget = S... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/tests/harness.rs | druid/src/tests/harness.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Tools and infrastructure for testing widgets.
use std::path::Path;
use std::sync::Arc;
use crate::app::PendingWindow;
use crate::core::{CommandQueue, WidgetState};
use crate::ext_event::ExtEventHost;
use crate::piet::{BitmapTarget, Device... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/menu/mod.rs | druid/src/menu/mod.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! ## Window, application, and context menus
//!
//! Menus in Druid follow a data-driven design similar to that of the main widget tree. The main
//! types are [`Menu`] (representing a tree of menus and submenus) and [`MenuItem`] (representing... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/menu/sys.rs | druid/src/menu/sys.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Pre-configured, platform appropriate menus and menu items.
use crate::{commands, LocalizedString, SysMods};
use super::*;
/// Menu items that exist on all platforms.
pub mod common {
use super::*;
/// 'Cut'.
pub fn cut<T: Dat... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/text/attribute.rs | druid/src/text/attribute.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Text attributes and spans.
use std::ops::Range;
use crate::piet::{Color, FontFamily, FontStyle, FontWeight, TextAttribute as PietAttr};
use crate::{Command, Env, FontDescriptor, KeyOrValue};
use super::EnvUpdateCtx;
/// A clickable rang... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/text/rich_text.rs | druid/src/text/rich_text.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Rich text with style spans.
use std::ops::{Range, RangeBounds};
use std::sync::Arc;
use super::attribute::Link;
use super::{Attribute, AttributeSpans, EnvUpdateCtx, TextStorage};
use crate::piet::{
util, Color, FontFamily, FontStyle, ... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/text/input_component.rs | druid/src/text/input_component.rs | // Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A widget component that integrates with the platform text system.
use std::cell::{Cell, Ref, RefCell, RefMut};
use std::ops::Range;
use std::sync::{Arc, Weak};
use tracing::instrument;
use super::{
EditableText, ImeHandlerRef, ImeInv... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | true |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/text/backspace.rs | druid/src/text/backspace.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Calc start of a backspace delete interval
use crate::text::{EditableText, EditableTextCursor, Selection};
use xi_unicode::*;
#[allow(clippy::cognitive_complexity)]
fn backspace_offset(text: &impl EditableText, start: usize) -> usize {
... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/text/storage.rs | druid/src/text/storage.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Storing text.
use std::sync::Arc;
use crate::env::KeyLike;
use crate::piet::{PietTextLayoutBuilder, TextStorage as PietTextStorage};
use crate::{Data, Env};
use super::attribute::Link;
use crate::UpdateCtx;
/// A type that represents te... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/text/input_methods.rs | druid/src/text/input_methods.rs | // Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Types related to input method editing.
//!
//! Most IME-related code is in `druid-shell`; these are helper types used
//! exclusively in `druid`.
use std::rc::Rc;
use crate::shell::text::InputHandler;
use crate::WidgetId;
/// A trait for... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/text/editable_text.rs | druid/src/text/editable_text.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Traits for text editing and a basic String implementation.
use std::borrow::Cow;
use std::ops::{Deref, Range};
use std::sync::Arc;
use unicode_segmentation::{GraphemeCursor, UnicodeSegmentation};
/// An EditableText trait.
pub trait Edit... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/text/mod.rs | druid/src/text/mod.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Editing and displaying text.
mod attribute;
mod backspace;
mod editable_text;
mod font_descriptor;
mod format;
mod input_component;
mod input_methods;
mod layout;
mod movement;
mod rich_text;
mod storage;
pub use crate::piet::{FontFamily,... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/text/layout.rs | druid/src/text/layout.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A type for laying out, drawing, and interacting with text.
use std::ops::Range;
use std::rc::Rc;
use super::{EnvUpdateCtx, Link, TextStorage};
use crate::kurbo::{Line, Point, Rect, Size};
use crate::piet::{
Color, PietText, PietTextLa... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/text/format.rs | druid/src/text/format.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Creating, interpreting, and validating textual representations of values.
use std::str::FromStr;
use std::sync::Arc;
use super::Selection;
use crate::Data;
/// A trait for types that create, interpret, and validate textual representation... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/text/font_descriptor.rs | druid/src/text/font_descriptor.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Font attributes
use crate::{Data, FontFamily, FontStyle, FontWeight};
/// A collection of attributes that describe a font.
///
/// This is provided as a convenience; library consumers may wish to have
/// a single type that represents a s... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/text/movement.rs | druid/src/text/movement.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Text editing movements.
use std::ops::Range;
use unicode_segmentation::UnicodeSegmentation;
use crate::kurbo::Point;
use crate::piet::TextLayout as _;
use crate::text::{
EditableText, Movement, Selection, TextLayout, TextStorage, Ver... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/button.rs | druid/src/widget/button.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A button widget.
use crate::debug_state::DebugState;
use crate::widget::prelude::*;
use crate::widget::{Click, ControllerHost, Label, LabelText};
use crate::{theme, Affine, Data, Insets, LinearGradient, UnitPoint};
use tracing::{instrument... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/z_stack.rs | druid/src/widget/z_stack.rs | // Copyright 2022 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A ZStack widget.
use crate::{
BoxConstraints, Data, Env, Event, EventCtx, InternalEvent, LayoutCtx, LifeCycle, LifeCycleCtx,
PaintCtx, Point, Rect, Size, UnitPoint, UpdateCtx, Vec2, Widget, WidgetExt, WidgetPod,
};
/// A container... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/identity_wrapper.rs | druid/src/widget/identity_wrapper.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A widget that provides an explicit identity to a child.
use crate::debug_state::DebugState;
use crate::kurbo::Size;
use crate::widget::prelude::*;
use crate::widget::WidgetWrapper;
use crate::Data;
use tracing::instrument;
/// A wrapper t... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/widget_ext.rs | druid/src/widget/widget_ext.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Convenience methods for widgets.
use super::invalidation::DebugInvalidation;
#[allow(deprecated)]
use super::Parse;
use super::{
Added, Align, BackgroundBrush, Click, Container, Controller, ControllerHost, EnvScope,
IdentityWrapper... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/scroll.rs | druid/src/widget/scroll.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A container that scrolls its contents.
use crate::commands::SCROLL_TO_VIEW;
use crate::contexts::ChangeCtx;
use crate::debug_state::DebugState;
use crate::widget::prelude::*;
use crate::widget::{Axis, ClipBox};
use crate::{scroll_component... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/flex.rs | druid/src/widget/flex.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A widget that arranges its children in a one-dimensional array.
use std::ops::Add;
use crate::debug_state::DebugState;
use crate::kurbo::{common::FloatExt, Vec2};
use crate::widget::prelude::*;
use crate::{Data, KeyOrValue, Point, Rect, W... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | true |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/tabs.rs | druid/src/widget/tabs.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A widget that can switch between one of many views, hiding the inactive ones.
use instant::Duration;
use std::collections::HashMap;
use std::fmt::Debug;
use std::hash::Hash;
use std::marker::PhantomData;
use std::rc::Rc;
use tracing::{inst... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | true |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/sized_box.rs | druid/src/widget/sized_box.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A widget with predefined size.
use crate::debug_state::DebugState;
use tracing::{instrument, trace, warn};
use crate::widget::prelude::*;
use crate::widget::Axis;
use crate::{Data, KeyOrValue};
/// A widget with predefined size.
///
/// ... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/click.rs | druid/src/widget/click.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A clickable [`Controller`] widget.
use crate::widget::Controller;
use crate::{Data, Env, Event, EventCtx, LifeCycle, LifeCycleCtx, MouseButton, Widget};
use tracing::{instrument, trace};
/// A clickable [`Controller`] widget. Pass this an... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/svg.rs | druid/src/widget/svg.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! An SVG widget.
use std::sync::Arc;
use resvg;
use usvg::Tree;
use crate::piet::{ImageBuf, ImageFormat, InterpolationMode};
use crate::widget::prelude::*;
use crate::{Rect, ScaledArea};
/// A widget that renders a SVG
pub struct Svg {
... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/widget.rs | druid/src/widget/widget.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use std::num::NonZeroU64;
use std::ops::{Deref, DerefMut};
use super::prelude::*;
use crate::debug_state::DebugState;
use crate::widget::Axis;
/// A unique identifier for a single [`Widget`].
///
/// `WidgetId`s are generated automatically fo... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/parse.rs | druid/src/widget/parse.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
// This whole widget was deprecated in Druid 0.7
// https://github.com/linebender/druid/pull/1377
#![allow(deprecated)]
use std::fmt::Display;
use std::mem;
use std::str::FromStr;
use tracing::instrument;
use crate::debug_state::DebugState;
u... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/textbox.rs | druid/src/widget/textbox.rs | // Copyright 2018 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A textbox widget.
use std::time::Duration;
use tracing::{instrument, trace};
use crate::contexts::ChangeCtx;
use crate::debug_state::DebugState;
use crate::kurbo::Insets;
use crate::piet::TextLayout as _;
use crate::text::{
EditableTe... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/image.rs | druid/src/widget/image.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! An Image widget.
//! Please consider using SVG and the SVG widget as it scales much better.
use crate::{
kurbo::Rect,
piet::{Image as _, ImageBuf, InterpolationMode, PietImage},
widget::common::FillStrat,
widget::prelude::*... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/painter.rs | druid/src/widget/painter.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use crate::piet::{FixedGradient, LinearGradient, PaintBrush, RadialGradient};
use crate::widget::prelude::*;
use crate::{Color, Data, Key};
use tracing::instrument;
/// A widget that only handles painting.
///
/// This is useful in a situation... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/invalidation.rs | druid/src/widget/invalidation.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use crate::debug_state::DebugState;
use crate::widget::prelude::*;
use crate::Data;
use tracing::instrument;
/// A widget that draws semi-transparent rectangles of changing colors to help debug invalidation
/// regions.
pub struct DebugInvalid... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/list.rs | druid/src/widget/list.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! Simple list view widget.
use std::cmp::Ordering;
use std::collections::VecDeque;
use std::f64;
use std::ops::Deref;
use std::sync::Arc;
use tracing::{instrument, trace};
#[cfg(feature = "im")]
use crate::im::{OrdMap, Vector};
use crate:... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/container.rs | druid/src/widget/container.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A widget that provides simple visual styling options to a child.
use super::BackgroundBrush;
use crate::debug_state::DebugState;
use crate::kurbo::RoundedRectRadii;
use crate::widget::prelude::*;
use crate::widget::Axis;
use crate::{Color,... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/env_scope.rs | druid/src/widget/env_scope.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A widget that accepts a closure to update the environment for its child.
use crate::debug_state::DebugState;
use crate::widget::prelude::*;
use crate::widget::WidgetWrapper;
use crate::{Data, Point, WidgetPod};
use tracing::instrument;
//... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/stepper.rs | druid/src/widget/stepper.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A stepper widget.
use std::time::Duration;
use tracing::{instrument, trace};
use crate::debug_state::DebugState;
use crate::kurbo::BezPath;
use crate::piet::{LinearGradient, RenderContext, UnitPoint};
use crate::widget::prelude::*;
use cr... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/aspect_ratio_box.rs | druid/src/widget/aspect_ratio_box.rs | // Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use crate::debug_state::DebugState;
use crate::widget::Axis;
use druid::widget::prelude::*;
use druid::Data;
use tracing::{instrument, warn};
/// A widget that preserves the aspect ratio given to it.
///
/// If given a child, this widget forc... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/slider.rs | druid/src/widget/slider.rs | // Copyright 2019 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A slider widget.
use crate::debug_state::DebugState;
use crate::kurbo::{Circle, Line};
use crate::theme::TEXT_COLOR;
use crate::widget::prelude::*;
use crate::widget::Axis;
use crate::{theme, Color, KeyOrValue, LinearGradient, Point, Rect,... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/controller.rs | druid/src/widget/controller.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A widget-controlling widget.
use crate::debug_state::DebugState;
use crate::widget::prelude::*;
use crate::widget::{Axis, WidgetWrapper};
/// A trait for types that modify behaviour of a child widget.
///
/// A `Controller` is a type that... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/value_textbox.rs | druid/src/widget/value_textbox.rs | // Copyright 2021 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
//! A textbox that that parses and validates data.
use tracing::instrument;
use super::TextBox;
use crate::debug_state::DebugState;
use crate::text::{Formatter, Selection, TextComponent, ValidationError};
use crate::widget::prelude::*;
use cr... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
linebender/druid | https://github.com/linebender/druid/blob/b27ea6a618c32f9ea0e8a56822f9487d23401c0d/druid/src/widget/clip_box.rs | druid/src/widget/clip_box.rs | // Copyright 2020 the Druid Authors
// SPDX-License-Identifier: Apache-2.0
use crate::commands::SCROLL_TO_VIEW;
use crate::contexts::ChangeCtx;
use crate::debug_state::DebugState;
use crate::kurbo::{Point, Rect, Size, Vec2};
use crate::widget::prelude::*;
use crate::widget::Axis;
use crate::{Data, InternalLifeCycle, W... | rust | Apache-2.0 | b27ea6a618c32f9ea0e8a56822f9487d23401c0d | 2026-01-04T15:44:39.941670Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.