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 {
|
||||
/// Access the register theme and fetch the requested [`WidgetStyle`].
|
||||
///
|
||||
/// Requested widget style must implement [`WidgetStyle`].
|
||||
/// The style of the widget with the given [`crate::Id`] and [`Classes`],
|
||||
/// as computed by the registered theme.
|
||||
pub fn widget_style<S: WidgetStyle + Clone + 'static>(
|
||||
&self,
|
||||
id: crate::Id,
|
||||
|
||||
@@ -7,8 +7,8 @@ pub trait StyleProvider<S> {
|
||||
/// The style according to the classes and state of the widget
|
||||
fn style(&mut self, modifiers: &StyleArgs<'_>) -> S;
|
||||
|
||||
/// Help to differ the different themes
|
||||
fn theme_type_id(&self) -> TypeId
|
||||
/// Used to tell different themes apart
|
||||
fn type_id(&self) -> TypeId
|
||||
where
|
||||
Self: 'static,
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ impl Themes {
|
||||
&& self
|
||||
.themes
|
||||
.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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user