mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-16 23:04:19 +01:00
Also add some thread methods for fetching new notes Signed-off-by: William Casarin <jb55@jb55.com>
75 lines
2.2 KiB
Rust
75 lines
2.2 KiB
Rust
pub mod account_login_view;
|
|
pub mod account_management;
|
|
pub mod account_switcher;
|
|
pub mod anim;
|
|
pub mod fixed_window;
|
|
pub mod global_popup;
|
|
pub mod mention;
|
|
pub mod note;
|
|
pub mod preview;
|
|
pub mod profile;
|
|
pub mod relay;
|
|
pub mod side_panel;
|
|
pub mod thread;
|
|
pub mod timeline;
|
|
pub mod username;
|
|
|
|
pub use account_management::AccountManagementView;
|
|
pub use account_switcher::AccountSelectionWidget;
|
|
pub use fixed_window::{FixedWindow, FixedWindowResponse};
|
|
pub use global_popup::DesktopGlobalPopup;
|
|
pub use mention::Mention;
|
|
pub use note::{NoteResponse, NoteView, PostReplyView, PostView};
|
|
pub use preview::{Preview, PreviewApp, PreviewConfig};
|
|
pub use profile::{profile_preview_controller, ProfilePic, ProfilePreview};
|
|
pub use relay::RelayView;
|
|
pub use side_panel::{DesktopSidePanel, SidePanelAction};
|
|
pub use thread::ThreadView;
|
|
pub use timeline::TimelineView;
|
|
pub use username::Username;
|
|
|
|
use egui::Margin;
|
|
|
|
/// This is kind of like the Widget trait but is meant for larger top-level
|
|
/// views that are typically stateful. The Widget trait forces us to add mutable
|
|
/// implementations at the type level, which screws us when generating Previews
|
|
/// for a Widget. I would have just Widget instead of making this Trait otherwise.
|
|
///
|
|
/// There is some precendent for this, it looks like there's a similar trait
|
|
/// in the egui demo library.
|
|
pub trait View {
|
|
fn ui(&mut self, ui: &mut egui::Ui);
|
|
}
|
|
|
|
pub fn padding<R>(
|
|
amount: impl Into<Margin>,
|
|
ui: &mut egui::Ui,
|
|
add_contents: impl FnOnce(&mut egui::Ui) -> R,
|
|
) -> egui::InnerResponse<R> {
|
|
egui::Frame::none()
|
|
.inner_margin(amount)
|
|
.show(ui, add_contents)
|
|
}
|
|
|
|
pub fn hline(ui: &egui::Ui) {
|
|
// pixel perfect horizontal line
|
|
let rect = ui.available_rect_before_wrap();
|
|
let resize_y = ui.painter().round_to_pixel(rect.top()) - 0.5;
|
|
let stroke = ui.style().visuals.widgets.noninteractive.bg_stroke;
|
|
ui.painter().hline(rect.x_range(), resize_y, stroke);
|
|
}
|
|
|
|
#[inline]
|
|
#[allow(unreachable_code)]
|
|
pub fn is_compiled_as_mobile() -> bool {
|
|
#[cfg(any(target_os = "android", target_os = "ios"))]
|
|
{
|
|
true
|
|
}
|
|
|
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
|
{
|
|
false
|
|
}
|
|
}
|