mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:37:45 +00:00
LibGfx+Overall: Remove is_null
from Point
, Rect
and Size
Having a `Point`, `Rect` or `Size` claim it's `null` is silly. We have `Optional<T>` for that. For `Point`, rename `is_null` to `is_zero` to better reflect what we're testing. For `Rect` and `Size`, `is_null` is removed outright. Also, remove `is_empty` from `Point`. Points can't be empty.
This commit is contained in:
parent
d5630bd20e
commit
7b0adee487
12 changed files with 20 additions and 22 deletions
|
@ -796,7 +796,7 @@ void AbstractView::drag_move_event(DragEvent& event)
|
|||
|
||||
if (acceptable) {
|
||||
m_automatic_scroll_delta = automatic_scroll_delta_from_position(event.position());
|
||||
set_automatic_scrolling_timer_active(!m_automatic_scroll_delta.is_null());
|
||||
set_automatic_scrolling_timer_active(!m_automatic_scroll_delta.is_zero());
|
||||
}
|
||||
|
||||
if (m_drop_candidate_index != new_drop_candidate_index) {
|
||||
|
@ -819,7 +819,7 @@ void AbstractView::drag_leave_event(Event&)
|
|||
|
||||
void AbstractView::automatic_scrolling_timer_did_fire()
|
||||
{
|
||||
if (m_automatic_scroll_delta.is_null())
|
||||
if (m_automatic_scroll_delta.is_zero())
|
||||
return;
|
||||
|
||||
vertical_scrollbar().increase_slider_by(m_automatic_scroll_delta.y());
|
||||
|
|
|
@ -13,7 +13,7 @@ constexpr float wheel_zoom_factor = 8.0f;
|
|||
|
||||
void AbstractZoomPanWidget::set_scale(float new_scale)
|
||||
{
|
||||
if (m_original_rect.is_null())
|
||||
if (m_original_rect.is_empty())
|
||||
return;
|
||||
|
||||
m_scale = clamp(new_scale, m_min_scale, m_max_scale);
|
||||
|
@ -36,7 +36,7 @@ void AbstractZoomPanWidget::scale_by(float delta)
|
|||
|
||||
void AbstractZoomPanWidget::scale_centered(float new_scale, Gfx::IntPoint center)
|
||||
{
|
||||
if (m_original_rect.is_null())
|
||||
if (m_original_rect.is_empty())
|
||||
return;
|
||||
|
||||
new_scale = clamp(new_scale, m_min_scale, m_max_scale);
|
||||
|
@ -154,7 +154,7 @@ void AbstractZoomPanWidget::mouseup_event(GUI::MouseEvent& event)
|
|||
|
||||
void AbstractZoomPanWidget::relayout()
|
||||
{
|
||||
if (m_original_rect.is_null())
|
||||
if (m_original_rect.is_empty())
|
||||
return;
|
||||
|
||||
m_content_rect.set_location({
|
||||
|
|
|
@ -329,7 +329,7 @@ void IconView::mousemove_event(MouseEvent& event)
|
|||
|
||||
if (m_rubber_banding) {
|
||||
m_out_of_view_position = event.position();
|
||||
set_automatic_scrolling_timer_active(!m_rubber_band_scroll_delta.is_null());
|
||||
set_automatic_scrolling_timer_active(!m_rubber_band_scroll_delta.is_zero());
|
||||
|
||||
if (update_rubber_banding(event.position()))
|
||||
return;
|
||||
|
@ -342,7 +342,7 @@ void IconView::automatic_scrolling_timer_did_fire()
|
|||
{
|
||||
AbstractView::automatic_scrolling_timer_did_fire();
|
||||
|
||||
if (m_rubber_band_scroll_delta.is_null())
|
||||
if (m_rubber_band_scroll_delta.is_zero())
|
||||
return;
|
||||
|
||||
vertical_scrollbar().increase_slider_by(m_rubber_band_scroll_delta.y());
|
||||
|
|
|
@ -175,7 +175,7 @@ void Scrollbar::paint_event(PaintEvent& event)
|
|||
hovered_component_for_painting = Component::None;
|
||||
|
||||
painter.fill_rect_with_dither_pattern(rect(), palette().button().lightened(1.3f), palette().button());
|
||||
if (m_gutter_click_state != GutterClickState::NotPressed && has_scrubber() && !scrubber_rect().is_null() && hovered_component_for_painting == Component::Gutter) {
|
||||
if (m_gutter_click_state != GutterClickState::NotPressed && has_scrubber() && !scrubber_rect().is_empty() && hovered_component_for_painting == Component::Gutter) {
|
||||
Gfx::IntRect rect_to_fill = rect();
|
||||
if (orientation() == Orientation::Vertical) {
|
||||
if (m_gutter_click_state == GutterClickState::BeforeScrubber) {
|
||||
|
@ -221,7 +221,7 @@ void Scrollbar::paint_event(PaintEvent& event)
|
|||
painter.draw_triangle(increment_location, orientation() == Orientation::Vertical ? s_down_arrow_coords : s_right_arrow_coords, (has_scrubber() && is_enabled() && !is_max()) ? palette().button_text() : palette().threed_shadow1());
|
||||
}
|
||||
|
||||
if (has_scrubber() && !scrubber_rect().is_null())
|
||||
if (has_scrubber() && !scrubber_rect().is_empty())
|
||||
Gfx::StylePainter::paint_button(painter, scrubber_rect(), palette(), Gfx::ButtonStyle::ThickCap, false, hovered_component_for_painting == Component::Scrubber || m_pressed_component == Component::Scrubber);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,8 @@ public:
|
|||
[](Detail::Boolean v) { return v.value; },
|
||||
[](DeprecatedString const& v) { return !v.is_null(); },
|
||||
[](Integral auto v) { return v != 0; },
|
||||
[](OneOf<Gfx::IntRect, Gfx::IntPoint, Gfx::IntSize> auto const& v) { return !v.is_null(); },
|
||||
[](Gfx::IntPoint const& v) { return !v.is_zero(); },
|
||||
[](OneOf<Gfx::IntRect, Gfx::IntSize> auto const& v) { return !v.is_empty(); },
|
||||
[](Enum auto const&) { return true; },
|
||||
[](OneOf<float, DeprecatedString, Color, NonnullRefPtr<Gfx::Font>, NonnullRefPtr<Gfx::Bitmap>, GUI::Icon> auto const&) { return true; });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue