mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:27:35 +00:00
Userland: Allow the Analog Clock window border to be hidden
Introduce the ability to hide the Analog Clock window borde. With this feature enabled it looks like the clock is floating and integrated into the desktop. The "Cube Demo" has the same feature, and was used as inspiration when implementing the feature in the Analog Clock.
This commit is contained in:
parent
3be9af7695
commit
1674d06f78
3 changed files with 39 additions and 3 deletions
|
@ -110,7 +110,7 @@ void AnalogClock::draw_seconds_hand(GUI::Painter& painter, double angle)
|
|||
void AnalogClock::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
GUI::Painter painter(*this);
|
||||
painter.clear_rect(event.rect(), palette().window());
|
||||
painter.clear_rect(event.rect(), m_show_window_frame ? palette().window() : Gfx::Color::Transparent);
|
||||
|
||||
draw_face(painter);
|
||||
|
||||
|
@ -132,3 +132,20 @@ void AnalogClock::update_title_date()
|
|||
{
|
||||
window()->set_title(Core::DateTime::now().to_string("Clock %d-%m-%Y"));
|
||||
}
|
||||
|
||||
void AnalogClock::context_menu_event(GUI::ContextMenuEvent& event)
|
||||
{
|
||||
if (on_context_menu_request)
|
||||
on_context_menu_request(event);
|
||||
}
|
||||
|
||||
void AnalogClock::set_show_window_frame(bool show)
|
||||
{
|
||||
if (show == m_show_window_frame)
|
||||
return;
|
||||
m_show_window_frame = show;
|
||||
auto& w = *window();
|
||||
w.set_frameless(!m_show_window_frame);
|
||||
w.set_has_alpha_channel(!m_show_window_frame);
|
||||
w.set_alpha_hit_threshold(m_show_window_frame ? 0 : 1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue