1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:47:34 +00:00

Big, possibly complete sweep of naming changes.

This commit is contained in:
Andreas Kling 2019-01-31 17:31:23 +01:00
parent 27fa09aee4
commit ffab6897aa
93 changed files with 830 additions and 885 deletions

View file

@ -1,37 +0,0 @@
#include "ClockWidget.h"
#include <SharedGraphics/Painter.h>
#include <time.h>
ClockWidget::ClockWidget(GWidget* parent)
: GWidget(parent)
{
setWindowRelativeRect({ 0, 0, 100, 40 });
startTimer(250);
}
ClockWidget::~ClockWidget()
{
}
void ClockWidget::paintEvent(PaintEvent&)
{
auto now = time(nullptr);
auto& tm = *localtime(&now);
char timeBuf[128];
sprintf(timeBuf, "%02u:%02u:%02u ", tm.tm_hour, tm.tm_min, tm.tm_sec);
Painter painter(*this);
painter.fill_rect(rect(), Color::MidGray);
painter.draw_text(rect(), timeBuf, Painter::TextAlignment::Center, Color::Black);
}
void ClockWidget::timerEvent(TimerEvent&)
{
auto now = time(nullptr);
if (now == m_lastSeenTimestamp)
return;
m_lastSeenTimestamp = now;
update();
}

View file

@ -1,16 +0,0 @@
#pragma once
#include "Widget.h"
class ClockWidget final : public Widget {
public:
explicit ClockWidget(Widget* parent = nullptr);
virtual ~ClockWidget() override;
private:
virtual void paintEvent(PaintEvent&) override;
virtual void timerEvent(TimerEvent&) override;
dword m_lastSeenTimestamp { 0 };
};

View file

@ -27,7 +27,7 @@ GCheckBox::GCheckBox(GWidget* parent)
: GWidget(parent)
{
if (!s_checked_bitmap)
s_checked_bitmap = CharacterBitmap::create_from_ascii(s_checked_bitmap_data, s_checked_bitmap_width, s_checked_bitmap_height).leakRef();
s_checked_bitmap = CharacterBitmap::create_from_ascii(s_checked_bitmap_data, s_checked_bitmap_width, s_checked_bitmap_height).leak_ref();
}
GCheckBox::~GCheckBox()

View file

@ -7,15 +7,15 @@ GObject::GObject(GObject* parent)
: m_parent(parent)
{
if (m_parent)
m_parent->addChild(*this);
m_parent->add_child(*this);
}
GObject::~GObject()
{
if (m_parent)
m_parent->removeChild(*this);
auto childrenToDelete = move(m_children);
for (auto* child : childrenToDelete)
m_parent->remove_child(*this);
auto children_to_delete = move(m_children);
for (auto* child : children_to_delete)
delete child;
}
@ -35,12 +35,12 @@ void GObject::event(GEvent& event)
}
}
void GObject::addChild(GObject& object)
void GObject::add_child(GObject& object)
{
m_children.append(&object);
}
void GObject::removeChild(GObject& object)
void GObject::remove_child(GObject& object)
{
for (unsigned i = 0; i < m_children.size(); ++i) {
if (m_children[i] == &object) {
@ -54,19 +54,19 @@ void GObject::timer_event(GTimerEvent&)
{
}
void GObject::startTimer(int ms)
void GObject::start_timer(int ms)
{
if (m_timerID) {
if (m_timer_id) {
dbgprintf("GObject{%p} already has a timer!\n", this);
ASSERT_NOT_REACHED();
}
}
void GObject::stopTimer()
void GObject::stop_timer()
{
if (!m_timerID)
if (!m_timer_id)
return;
m_timerID = 0;
m_timer_id = 0;
}
void GObject::delete_later()

View file

@ -20,12 +20,12 @@ public:
GObject* parent() { return m_parent; }
const GObject* parent() const { return m_parent; }
void startTimer(int ms);
void stopTimer();
bool hasTimer() const { return m_timerID; }
void start_timer(int ms);
void stop_timer();
bool has_timer() const { return m_timer_id; }
void addChild(GObject&);
void removeChild(GObject&);
void add_child(GObject&);
void remove_child(GObject&);
void delete_later();
@ -34,7 +34,7 @@ private:
GObject* m_parent { nullptr };
int m_timerID { 0 };
int m_timer_id { 0 };
Vector<GObject*> m_children;
};

View file

@ -8,7 +8,7 @@
GTextBox::GTextBox(GWidget* parent)
: GWidget(parent)
{
startTimer(500);
start_timer(500);
}
GTextBox::~GTextBox()
@ -73,12 +73,12 @@ void GTextBox::handle_backspace()
}
char* buffer;
auto newText = StringImpl::create_uninitialized(m_text.length() - 1, buffer);
auto new_text = StringImpl::create_uninitialized(m_text.length() - 1, buffer);
memcpy(buffer, m_text.characters(), m_cursor_position - 1);
memcpy(buffer + m_cursor_position - 1, m_text.characters() + m_cursor_position, m_text.length() - (m_cursor_position - 1));
m_text = move(newText);
m_text = move(new_text);
--m_cursor_position;
update();
}
@ -110,13 +110,13 @@ void GTextBox::keydown_event(GKeyEvent& event)
ASSERT(event.text().length() == 1);
char* buffer;
auto newText = StringImpl::create_uninitialized(m_text.length() + 1, buffer);
auto new_text = StringImpl::create_uninitialized(m_text.length() + 1, buffer);
memcpy(buffer, m_text.characters(), m_cursor_position);
buffer[m_cursor_position] = event.text()[0];
memcpy(buffer + m_cursor_position + 1, m_text.characters() + m_cursor_position, m_text.length() - m_cursor_position);
m_text = move(newText);
m_text = move(new_text);
++m_cursor_position;
update();
return;

View file

@ -207,6 +207,6 @@ void GWindow::set_global_cursor_tracking_widget(GWidget* widget)
ASSERT(m_window_id);
if (widget == m_global_cursor_tracking_widget.ptr())
return;
m_global_cursor_tracking_widget = widget ? widget->makeWeakPtr() : nullptr;
m_global_cursor_tracking_widget = widget ? widget->make_weak_ptr() : nullptr;
gui_set_global_cursor_tracking_enabled(m_window_id, widget != nullptr);
}