1
0
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:
Emil Ernerfeldt
2026-08-04 14:20:07 +02:00
parent f05ca409ff
commit 1f3e6386b2
3 changed files with 5 additions and 6 deletions

View File

@@ -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,

View File

@@ -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,
{

View File

@@ -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;
}