aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-11-19 17:27:39 +0800
committercrupest <crupest@outlook.com>2018-11-19 17:27:39 +0800
commita8f9fac512cf3e4884cee3b7f655429ece89a025 (patch)
tree1fe286351460e13af044346fc444e2189d49a0f4
parentf78359cc042f089b2f99b23dd3df7ae02ecdabec (diff)
downloadcru-a8f9fac512cf3e4884cee3b7f655429ece89a025.tar.gz
cru-a8f9fac512cf3e4884cee3b7f655429ece89a025.tar.bz2
cru-a8f9fac512cf3e4884cee3b7f655429ece89a025.zip
Rename two methods in Control.
-rw-r--r--CruUI-Generate/cru_ui.cpp56
-rw-r--r--CruUI-Generate/cru_ui.hpp10
-rw-r--r--src/main.cpp4
-rw-r--r--src/ui/control.cpp14
-rw-r--r--src/ui/control.hpp8
-rw-r--r--src/ui/controls/button.cpp4
-rw-r--r--src/ui/controls/list_item.cpp2
-rw-r--r--src/ui/controls/text_box.cpp6
-rw-r--r--src/ui/controls/text_control.cpp18
-rw-r--r--src/ui/controls/toggle_button.cpp4
-rw-r--r--src/ui/window.cpp4
-rw-r--r--src/ui/window.hpp2
12 files changed, 66 insertions, 66 deletions
diff --git a/CruUI-Generate/cru_ui.cpp b/CruUI-Generate/cru_ui.cpp
index 19c09c6e..3436f3f4 100644
--- a/CruUI-Generate/cru_ui.cpp
+++ b/CruUI-Generate/cru_ui.cpp
@@ -335,10 +335,10 @@ int APIENTRY wWinMain(
});
cru::SetTimeout(2.0, [&window]() {
- window.Repaint();
+ window.InvalidateDraw();
auto task = cru::SetInterval(0.5, [&window]() {
- window.Repaint();
+ window.InvalidateDraw();
});
cru::SetTimeout(4, [task]() {
@@ -949,7 +949,7 @@ namespace cru::ui
LayoutManager::GetInstance()->InvalidateControlPositionCache(this);
if (auto window = GetWindow())
{
- window->Repaint();
+ window->InvalidateDraw();
}
}
}
@@ -966,7 +966,7 @@ namespace cru::ui
SizeChangedEventArgs args(this, this, old_size, size);
RaiseSizeChangedEvent(args);
if (auto window = GetWindow())
- window->Repaint();
+ window->InvalidateDraw();
}
Point Control::GetPositionAbsolute() const
@@ -1024,10 +1024,10 @@ namespace cru::ui
device_context->SetTransform(old_transform);
}
- void Control::Repaint()
+ void Control::InvalidateDraw()
{
if (window_ != nullptr)
- window_->Repaint();
+ window_->InvalidateDraw();
}
bool Control::RequestFocus()
@@ -1130,11 +1130,11 @@ namespace cru::ui
return p;
}
- void Control::InvalidateBorder()
+ void Control::UpdateBorder()
{
RegenerateBorderGeometry();
InvalidateLayout();
- Repaint();
+ InvalidateDraw();
}
void Control::SetBordered(const bool bordered)
@@ -1142,7 +1142,7 @@ namespace cru::ui
if (bordered != is_bordered_)
{
is_bordered_ = bordered;
- InvalidateBorder();
+ UpdateBorder();
}
}
@@ -2291,7 +2291,7 @@ namespace cru::ui
DestroyWindow(hwnd_);
}
- void Window::Repaint() {
+ void Window::InvalidateDraw() {
if (IsWindowValid()) {
InvalidateRect(hwnd_, nullptr, false);
}
@@ -2686,7 +2686,7 @@ namespace cru::ui
if (debug_layout_ != value)
{
debug_layout_ = value;
- Repaint();
+ InvalidateDraw();
}
}
#endif
@@ -3070,13 +3070,13 @@ namespace cru::ui::controls
void Button::OnMouseClickBegin(MouseButton button)
{
GetBorderProperty() = pressed_border_;
- InvalidateBorder();
+ UpdateBorder();
}
void Button::OnMouseClickEnd(MouseButton button)
{
GetBorderProperty() = normal_border_;
- InvalidateBorder();
+ UpdateBorder();
}
}
//--------------------------------------------------------
@@ -3273,7 +3273,7 @@ namespace cru::ui::controls
void ListItem::SetState(const State state)
{
state_ = state;
- Repaint();
+ InvalidateDraw();
}
void ListItem::OnDrawForeground(ID2D1DeviceContext* device_context)
@@ -3443,7 +3443,7 @@ namespace cru::ui::controls
caret_timer_ = SetInterval(UiManager::GetInstance()->GetCaretInfo().caret_blink_duration, [this]
{
is_caret_show_ = !is_caret_show_;
- Repaint();
+ InvalidateDraw();
});
}
@@ -3479,7 +3479,7 @@ namespace cru::ui::controls
else
caret_position_--;
}
- Repaint();
+ InvalidateDraw();
}
if (args.GetVirtualCode() == VK_RIGHT && caret_position_ < GetText().size())
@@ -3561,7 +3561,7 @@ namespace cru::ui::controls
void TextBox::RequestChangeCaretPosition(const unsigned position)
{
caret_position_ = position;
- Repaint();
+ InvalidateDraw();
}
bool TextBox::GetCaretSelectionSide() const
@@ -3631,14 +3631,14 @@ namespace cru::ui::controls
void TextControl::SetBrush(const Microsoft::WRL::ComPtr<ID2D1Brush>& brush)
{
brush_ = brush;
- Repaint();
+ InvalidateDraw();
}
void TextControl::SetTextFormat(const Microsoft::WRL::ComPtr<IDWriteTextFormat>& text_format)
{
text_format_ = text_format;
RecreateTextLayout();
- Repaint();
+ InvalidateDraw();
}
void TextControl::SetSelectable(const bool is_selectable)
@@ -3653,7 +3653,7 @@ namespace cru::ui::controls
GetWindow()->ReleaseCurrentMouseCapture();
}
selected_range_ = std::nullopt;
- Repaint();
+ InvalidateDraw();
}
is_selectable_ = is_selectable;
UpdateCursor(std::nullopt);
@@ -3665,7 +3665,7 @@ namespace cru::ui::controls
if (is_selectable_)
{
selected_range_ = text_range;
- Repaint();
+ InvalidateDraw();
}
}
@@ -3675,7 +3675,7 @@ namespace cru::ui::controls
const auto content = GetRect(RectRange::Content);
ThrowIfFailed(text_layout_->SetMaxWidth(content.width));
ThrowIfFailed(text_layout_->SetMaxHeight(content.height));
- Repaint();
+ InvalidateDraw();
}
namespace
@@ -3729,7 +3729,7 @@ namespace cru::ui::controls
mouse_down_position_ = hit_test_result;
is_selecting_ = true;
GetWindow()->CaptureMouseFor(this);
- Repaint();
+ InvalidateDraw();
}
}
@@ -3741,7 +3741,7 @@ namespace cru::ui::controls
const auto hit_test_result = TextLayoutHitTest(text_layout_.Get(), args.GetPoint(this));
RequestChangeCaretPosition(hit_test_result);
selected_range_ = TextRange::FromTwoSides(hit_test_result, mouse_down_position_);
- Repaint();
+ InvalidateDraw();
}
UpdateCursor(args.GetPoint(this, RectRange::Margin));
}
@@ -3770,7 +3770,7 @@ namespace cru::ui::controls
if (!args.IsWindow()) // If the focus lose is triggered window-wide, then save the selection state. Otherwise, clear selection.
{
selected_range_ = std::nullopt;
- Repaint();
+ InvalidateDraw();
}
}
@@ -3798,7 +3798,7 @@ namespace cru::ui::controls
{
RecreateTextLayout();
InvalidateLayout();
- Repaint();
+ InvalidateDraw();
}
void TextControl::RecreateTextLayout()
@@ -3919,12 +3919,12 @@ namespace cru::ui::controls
.AddStepHandler([=](auto, const double percentage)
{
current_circle_position_ = static_cast<float>(previous_position + delta * percentage);
- Repaint();
+ InvalidateDraw();
})
.Start();
RaiseToggleEvent(state);
- Repaint();
+ InvalidateDraw();
}
}
diff --git a/CruUI-Generate/cru_ui.hpp b/CruUI-Generate/cru_ui.hpp
index 35c7abeb..ddfd8d9e 100644
--- a/CruUI-Generate/cru_ui.hpp
+++ b/CruUI-Generate/cru_ui.hpp
@@ -1606,7 +1606,7 @@ namespace cru::ui
//Draw this control and its child controls.
void Draw(ID2D1DeviceContext* device_context);
- virtual void Repaint();
+ virtual void InvalidateDraw();
Microsoft::WRL::ComPtr<ID2D1Brush> GetForegroundBrush() const
{
@@ -1616,7 +1616,7 @@ namespace cru::ui
void SetForegroundBrush(Microsoft::WRL::ComPtr<ID2D1Brush> foreground_brush)
{
foreground_brush_ = std::move(foreground_brush);
- Repaint();
+ InvalidateDraw();
}
Microsoft::WRL::ComPtr<ID2D1Brush> GetBackgroundBrush() const
@@ -1627,7 +1627,7 @@ namespace cru::ui
void SetBackgroundBrush(Microsoft::WRL::ComPtr<ID2D1Brush> background_brush)
{
background_brush_ = std::move(background_brush);
- Repaint();
+ InvalidateDraw();
}
@@ -1675,7 +1675,7 @@ namespace cru::ui
return border_property_;
}
- void InvalidateBorder();
+ void UpdateBorder();
bool IsBordered() const
{
@@ -2072,7 +2072,7 @@ namespace cru::ui
void Close();
//Send a repaint message to the window's message queue which may make the window repaint.
- void Repaint() override;
+ void InvalidateDraw() override final;
//Show the window.
void Show();
diff --git a/src/main.cpp b/src/main.cpp
index d4194f45..8815b3ac 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -77,10 +77,10 @@ int APIENTRY wWinMain(
});
cru::SetTimeout(2.0, [&window]() {
- window.Repaint();
+ window.InvalidateDraw();
auto task = cru::SetInterval(0.5, [&window]() {
- window.Repaint();
+ window.InvalidateDraw();
});
cru::SetTimeout(4, [task]() {
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index 0595bf5d..8b91b25a 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -152,7 +152,7 @@ namespace cru::ui
LayoutManager::GetInstance()->InvalidateControlPositionCache(this);
if (auto window = GetWindow())
{
- window->Repaint();
+ window->InvalidateDraw();
}
}
}
@@ -169,7 +169,7 @@ namespace cru::ui
SizeChangedEventArgs args(this, this, old_size, size);
RaiseSizeChangedEvent(args);
if (auto window = GetWindow())
- window->Repaint();
+ window->InvalidateDraw();
}
Point Control::GetPositionAbsolute() const
@@ -227,10 +227,10 @@ namespace cru::ui
device_context->SetTransform(old_transform);
}
- void Control::Repaint()
+ void Control::InvalidateDraw()
{
if (window_ != nullptr)
- window_->Repaint();
+ window_->InvalidateDraw();
}
bool Control::RequestFocus()
@@ -333,11 +333,11 @@ namespace cru::ui
return p;
}
- void Control::InvalidateBorder()
+ void Control::UpdateBorder()
{
RegenerateBorderGeometry();
InvalidateLayout();
- Repaint();
+ InvalidateDraw();
}
void Control::SetBordered(const bool bordered)
@@ -345,7 +345,7 @@ namespace cru::ui
if (bordered != is_bordered_)
{
is_bordered_ = bordered;
- InvalidateBorder();
+ UpdateBorder();
}
}
diff --git a/src/ui/control.hpp b/src/ui/control.hpp
index a1ad7ea7..2ca5fa9e 100644
--- a/src/ui/control.hpp
+++ b/src/ui/control.hpp
@@ -127,7 +127,7 @@ namespace cru::ui
//Draw this control and its child controls.
void Draw(ID2D1DeviceContext* device_context);
- virtual void Repaint();
+ virtual void InvalidateDraw();
Microsoft::WRL::ComPtr<ID2D1Brush> GetForegroundBrush() const
{
@@ -137,7 +137,7 @@ namespace cru::ui
void SetForegroundBrush(Microsoft::WRL::ComPtr<ID2D1Brush> foreground_brush)
{
foreground_brush_ = std::move(foreground_brush);
- Repaint();
+ InvalidateDraw();
}
Microsoft::WRL::ComPtr<ID2D1Brush> GetBackgroundBrush() const
@@ -148,7 +148,7 @@ namespace cru::ui
void SetBackgroundBrush(Microsoft::WRL::ComPtr<ID2D1Brush> background_brush)
{
background_brush_ = std::move(background_brush);
- Repaint();
+ InvalidateDraw();
}
@@ -196,7 +196,7 @@ namespace cru::ui
return border_property_;
}
- void InvalidateBorder();
+ void UpdateBorder();
bool IsBordered() const
{
diff --git a/src/ui/controls/button.cpp b/src/ui/controls/button.cpp
index 0bd6a70d..a9f101f8 100644
--- a/src/ui/controls/button.cpp
+++ b/src/ui/controls/button.cpp
@@ -23,12 +23,12 @@ namespace cru::ui::controls
void Button::OnMouseClickBegin(MouseButton button)
{
GetBorderProperty() = pressed_border_;
- InvalidateBorder();
+ UpdateBorder();
}
void Button::OnMouseClickEnd(MouseButton button)
{
GetBorderProperty() = normal_border_;
- InvalidateBorder();
+ UpdateBorder();
}
}
diff --git a/src/ui/controls/list_item.cpp b/src/ui/controls/list_item.cpp
index bdd44273..bf61010d 100644
--- a/src/ui/controls/list_item.cpp
+++ b/src/ui/controls/list_item.cpp
@@ -25,7 +25,7 @@ namespace cru::ui::controls
void ListItem::SetState(const State state)
{
state_ = state;
- Repaint();
+ InvalidateDraw();
}
void ListItem::OnDrawForeground(ID2D1DeviceContext* device_context)
diff --git a/src/ui/controls/text_box.cpp b/src/ui/controls/text_box.cpp
index 6eeb7abb..83311548 100644
--- a/src/ui/controls/text_box.cpp
+++ b/src/ui/controls/text_box.cpp
@@ -50,7 +50,7 @@ namespace cru::ui::controls
caret_timer_ = SetInterval(UiManager::GetInstance()->GetCaretInfo().caret_blink_duration, [this]
{
is_caret_show_ = !is_caret_show_;
- Repaint();
+ InvalidateDraw();
});
}
@@ -86,7 +86,7 @@ namespace cru::ui::controls
else
caret_position_--;
}
- Repaint();
+ InvalidateDraw();
}
if (args.GetVirtualCode() == VK_RIGHT && caret_position_ < GetText().size())
@@ -168,7 +168,7 @@ namespace cru::ui::controls
void TextBox::RequestChangeCaretPosition(const unsigned position)
{
caret_position_ = position;
- Repaint();
+ InvalidateDraw();
}
bool TextBox::GetCaretSelectionSide() const
diff --git a/src/ui/controls/text_control.cpp b/src/ui/controls/text_control.cpp
index ff8346ee..f7f88d4e 100644
--- a/src/ui/controls/text_control.cpp
+++ b/src/ui/controls/text_control.cpp
@@ -35,14 +35,14 @@ namespace cru::ui::controls
void TextControl::SetBrush(const Microsoft::WRL::ComPtr<ID2D1Brush>& brush)
{
brush_ = brush;
- Repaint();
+ InvalidateDraw();
}
void TextControl::SetTextFormat(const Microsoft::WRL::ComPtr<IDWriteTextFormat>& text_format)
{
text_format_ = text_format;
RecreateTextLayout();
- Repaint();
+ InvalidateDraw();
}
void TextControl::SetSelectable(const bool is_selectable)
@@ -57,7 +57,7 @@ namespace cru::ui::controls
GetWindow()->ReleaseCurrentMouseCapture();
}
selected_range_ = std::nullopt;
- Repaint();
+ InvalidateDraw();
}
is_selectable_ = is_selectable;
UpdateCursor(std::nullopt);
@@ -69,7 +69,7 @@ namespace cru::ui::controls
if (is_selectable_)
{
selected_range_ = text_range;
- Repaint();
+ InvalidateDraw();
}
}
@@ -79,7 +79,7 @@ namespace cru::ui::controls
const auto content = GetRect(RectRange::Content);
ThrowIfFailed(text_layout_->SetMaxWidth(content.width));
ThrowIfFailed(text_layout_->SetMaxHeight(content.height));
- Repaint();
+ InvalidateDraw();
}
namespace
@@ -133,7 +133,7 @@ namespace cru::ui::controls
mouse_down_position_ = hit_test_result;
is_selecting_ = true;
GetWindow()->CaptureMouseFor(this);
- Repaint();
+ InvalidateDraw();
}
}
@@ -145,7 +145,7 @@ namespace cru::ui::controls
const auto hit_test_result = TextLayoutHitTest(text_layout_.Get(), args.GetPoint(this));
RequestChangeCaretPosition(hit_test_result);
selected_range_ = TextRange::FromTwoSides(hit_test_result, mouse_down_position_);
- Repaint();
+ InvalidateDraw();
}
UpdateCursor(args.GetPoint(this, RectRange::Margin));
}
@@ -174,7 +174,7 @@ namespace cru::ui::controls
if (!args.IsWindow()) // If the focus lose is triggered window-wide, then save the selection state. Otherwise, clear selection.
{
selected_range_ = std::nullopt;
- Repaint();
+ InvalidateDraw();
}
}
@@ -202,7 +202,7 @@ namespace cru::ui::controls
{
RecreateTextLayout();
InvalidateLayout();
- Repaint();
+ InvalidateDraw();
}
void TextControl::RecreateTextLayout()
diff --git a/src/ui/controls/toggle_button.cpp b/src/ui/controls/toggle_button.cpp
index b16eca23..e3d8662a 100644
--- a/src/ui/controls/toggle_button.cpp
+++ b/src/ui/controls/toggle_button.cpp
@@ -68,12 +68,12 @@ namespace cru::ui::controls
.AddStepHandler([=](auto, const double percentage)
{
current_circle_position_ = static_cast<float>(previous_position + delta * percentage);
- Repaint();
+ InvalidateDraw();
})
.Start();
RaiseToggleEvent(state);
- Repaint();
+ InvalidateDraw();
}
}
diff --git a/src/ui/window.cpp b/src/ui/window.cpp
index 39b574bd..87656cdc 100644
--- a/src/ui/window.cpp
+++ b/src/ui/window.cpp
@@ -206,7 +206,7 @@ namespace cru::ui
DestroyWindow(hwnd_);
}
- void Window::Repaint() {
+ void Window::InvalidateDraw() {
if (IsWindowValid()) {
InvalidateRect(hwnd_, nullptr, false);
}
@@ -601,7 +601,7 @@ namespace cru::ui
if (debug_layout_ != value)
{
debug_layout_ = value;
- Repaint();
+ InvalidateDraw();
}
}
#endif
diff --git a/src/ui/window.hpp b/src/ui/window.hpp
index 2955cd32..d98e60e2 100644
--- a/src/ui/window.hpp
+++ b/src/ui/window.hpp
@@ -140,7 +140,7 @@ namespace cru::ui
void Close();
//Send a repaint message to the window's message queue which may make the window repaint.
- void Repaint() override;
+ void InvalidateDraw() override final;
//Show the window.
void Show();