mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Address review comments on the theme module
* Rename `StyleProvider::theme_type_id` to `type_id` * Reword the `Ui::widget_style` docstring Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,9 +12,8 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
impl Ui {
|
impl Ui {
|
||||||
/// Access the register theme and fetch the requested [`WidgetStyle`].
|
/// The style of the widget with the given [`crate::Id`] and [`Classes`],
|
||||||
///
|
/// as computed by the registered theme.
|
||||||
/// Requested widget style must implement [`WidgetStyle`].
|
|
||||||
pub fn widget_style<S: WidgetStyle + Clone + 'static>(
|
pub fn widget_style<S: WidgetStyle + Clone + 'static>(
|
||||||
&self,
|
&self,
|
||||||
id: crate::Id,
|
id: crate::Id,
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ pub trait StyleProvider<S> {
|
|||||||
/// The style according to the classes and state of the widget
|
/// The style according to the classes and state of the widget
|
||||||
fn style(&mut self, modifiers: &StyleArgs<'_>) -> S;
|
fn style(&mut self, modifiers: &StyleArgs<'_>) -> S;
|
||||||
|
|
||||||
/// Help to differ the different themes
|
/// Used to tell different themes apart
|
||||||
fn theme_type_id(&self) -> TypeId
|
fn type_id(&self) -> TypeId
|
||||||
where
|
where
|
||||||
Self: 'static,
|
Self: 'static,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ impl Themes {
|
|||||||
&& self
|
&& self
|
||||||
.themes
|
.themes
|
||||||
.get_temp::<ThemeWrap<S>>(Id::NULL)
|
.get_temp::<ThemeWrap<S>>(Id::NULL)
|
||||||
.is_some_and(|t| t.lock().theme_type_id() == theme.theme_type_id())
|
.is_some_and(|t| t.lock().type_id() == theme.type_id())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user