diff options
author | crupest <crupest@outlook.com> | 2019-04-04 23:08:22 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-04-04 23:08:22 +0800 |
commit | 6268f3ca09afef812cf288f323cacff22fbfcffc (patch) | |
tree | 86e89d3b4212ae069075f799a5278c120e258e73 /src | |
parent | dbda5a8e4f0d59ad95be8fc3ee7b21e9122cc474 (diff) | |
download | cru-6268f3ca09afef812cf288f323cacff22fbfcffc.tar.gz cru-6268f3ca09afef812cf288f323cacff22fbfcffc.tar.bz2 cru-6268f3ca09afef812cf288f323cacff22fbfcffc.zip |
Finish refactor!!!
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/main.cpp | 29 | ||||
-rw-r--r-- | src/platform_win/win_application.cpp | 2 | ||||
-rw-r--r-- | src/platform_win/win_native_window.cpp | 6 | ||||
-rw-r--r-- | src/platform_win/win_painter.cpp | 1 | ||||
-rw-r--r-- | src/platform_win/win_text_layout.cpp | 15 | ||||
-rw-r--r-- | src/platform_win/window_manager.cpp | 9 | ||||
-rw-r--r-- | src/ui/content_control.cpp | 2 | ||||
-rw-r--r-- | src/ui/control.cpp | 2 | ||||
-rw-r--r-- | src/ui/controls/button.cpp | 10 | ||||
-rw-r--r-- | src/ui/controls/button.hpp | 39 | ||||
-rw-r--r-- | src/ui/controls/flex_layout.cpp | 4 | ||||
-rw-r--r-- | src/ui/controls/flex_layout.hpp | 41 | ||||
-rw-r--r-- | src/ui/controls/text_block.cpp | 14 | ||||
-rw-r--r-- | src/ui/controls/text_block.hpp | 39 | ||||
-rw-r--r-- | src/ui/layout_control.cpp | 2 | ||||
-rw-r--r-- | src/ui/render/border_render_object.cpp | 2 | ||||
-rw-r--r-- | src/ui/render/flex_layout_render_object.cpp | 4 | ||||
-rw-r--r-- | src/ui/render/window_render_object.cpp | 11 | ||||
-rw-r--r-- | src/ui/ui_manager.cpp | 15 | ||||
-rw-r--r-- | src/ui/window.cpp | 23 |
21 files changed, 90 insertions, 183 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4155e800..8f29ddc9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,7 +22,6 @@ target_link_libraries(cru_ui PUBLIC cru_platform_win) endif() - -add_executable(demo WIN32 main.cpp) +add_executable(demo main.cpp) target_link_libraries(demo PRIVATE cru_ui) diff --git a/src/main.cpp b/src/main.cpp index c35213f7..c0c90002 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,28 +1,27 @@ -#include "pre.hpp" - -#include "application.hpp" -#include "ui/controls/button.hpp" -#include "ui/controls/flex_layout.hpp" -#include "ui/controls/text_block.hpp" -#include "ui/window.hpp" - -using cru::Application; -using cru::String; -using cru::StringView; +#include "cru/platform/native_window.hpp" +#include "cru/platform/ui_applicaition.hpp" +#include "cru/ui/controls/button.hpp" +#include "cru/ui/controls/flex_layout.hpp" +#include "cru/ui/controls/text_block.hpp" +#include "cru/ui/window.hpp" + +using cru::platform::UiApplication; using cru::ui::Rect; using cru::ui::Thickness; using cru::ui::Window; using cru::ui::controls::Button; using cru::ui::controls::FlexLayout; using cru::ui::controls::TextBlock; - +/* int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) { #ifdef CRU_DEBUG _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif +*/ - Application application(hInstance); +int main() { + auto application = UiApplication::GetInstance(); const auto window = Window::CreateOverlapped(); @@ -40,7 +39,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, text_block2->SetText(L"Hello World!"); flex_layout->AddChild(text_block2, 1); - window->Show(); + window->GetNativeWindow()->SetVisible(true); - return application.Run(); + return application->Run(); } diff --git a/src/platform_win/win_application.cpp b/src/platform_win/win_application.cpp index 31d8c990..ce187136 100644 --- a/src/platform_win/win_application.cpp +++ b/src/platform_win/win_application.cpp @@ -40,7 +40,7 @@ WinApplication::WinApplication(HINSTANCE h_instance) : h_instance_(h_instance) { timer_manager_ = std::make_shared<TimerManager>(god_window_.get()); window_manager_ = std::make_shared<WindowManager>(this); graph_manager_ = std::make_shared<GraphManager>(); - graph_factory_ = std::make_shared<GraphFactory>(graph_manager_.get()); + graph_factory_ = std::make_shared<WinGraphFactory>(graph_manager_.get()); } WinApplication::~WinApplication() { instance_ = nullptr; } diff --git a/src/platform_win/win_native_window.cpp b/src/platform_win/win_native_window.cpp index 12c25674..3f34717f 100644 --- a/src/platform_win/win_native_window.cpp +++ b/src/platform_win/win_native_window.cpp @@ -34,6 +34,9 @@ WinNativeWindow::WinNativeWindow(WinApplication* application, throw Win32Error(::GetLastError(), "Failed to create window."); window_manager->RegisterWindow(hwnd_, this); + + window_render_target_.reset( + new WindowRenderTarget(application->GetGraphManager(), hwnd_)); } WinNativeWindow::~WinNativeWindow() { @@ -113,7 +116,8 @@ void WinNativeWindow::SetWindowRect(const ui::Rect& rect) { } } -Painter* WinNativeWindow::BeginPaint() { return new WinPainter(this); } +Painter* WinNativeWindow::BeginPaint() { + return new WinPainter(this); } bool WinNativeWindow::HandleNativeWindowMessage(HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param, diff --git a/src/platform_win/win_painter.cpp b/src/platform_win/win_painter.cpp index 6ce5f4de..7c99146a 100644 --- a/src/platform_win/win_painter.cpp +++ b/src/platform_win/win_painter.cpp @@ -97,6 +97,7 @@ void WinPainter::EndDraw() { if (!IsDisposed()) { ThrowIfFailed(render_target_->EndDraw()); render_target_ = nullptr; + window_->GetWindowRenderTarget()->Present(); is_disposed = true; } } diff --git a/src/platform_win/win_text_layout.cpp b/src/platform_win/win_text_layout.cpp index 7ae87a80..04b5e928 100644 --- a/src/platform_win/win_text_layout.cpp +++ b/src/platform_win/win_text_layout.cpp @@ -17,8 +17,9 @@ WinTextLayout::WinTextLayout(GraphManager* graph_manager, font_descriptor_.swap(font); ThrowIfFailed(graph_manager_->GetDWriteFactory()->CreateTextLayout( - text_.c_str(), text_.size(), font_descriptor_->GetDWriteTextFormat(), - max_width_, max_height_, &text_layout_)); + text_.c_str(), static_cast<UINT32>(text_.size()), + font_descriptor_->GetDWriteTextFormat(), max_width_, max_height_, + &text_layout_)); } std::wstring WinTextLayout::GetText() { return text_; } @@ -26,8 +27,9 @@ std::wstring WinTextLayout::GetText() { return text_; } void WinTextLayout::SetText(std::wstring new_text) { text_.swap(new_text); ThrowIfFailed(graph_manager_->GetDWriteFactory()->CreateTextLayout( - text_.c_str(), text_.size(), font_descriptor_->GetDWriteTextFormat(), - max_width_, max_height_, &text_layout_)); + text_.c_str(), static_cast<UINT32>(text_.size()), + font_descriptor_->GetDWriteTextFormat(), max_width_, max_height_, + &text_layout_)); } std::shared_ptr<FontDescriptor> WinTextLayout::GetFont() { @@ -39,8 +41,9 @@ void WinTextLayout::SetFont(std::shared_ptr<FontDescriptor> font) { assert(f); f.swap(font_descriptor_); ThrowIfFailed(graph_manager_->GetDWriteFactory()->CreateTextLayout( - text_.c_str(), text_.size(), font_descriptor_->GetDWriteTextFormat(), - max_width_, max_height_, &text_layout_)); + text_.c_str(), static_cast<UINT32>(text_.size()), + font_descriptor_->GetDWriteTextFormat(), max_width_, max_height_, + &text_layout_)); } void WinTextLayout::SetMaxWidth(float max_width) { diff --git a/src/platform_win/window_manager.cpp b/src/platform_win/window_manager.cpp index 62a73499..e6c255c3 100644 --- a/src/platform_win/window_manager.cpp +++ b/src/platform_win/window_manager.cpp @@ -2,13 +2,15 @@ #include "cru/platform/win/win_application.hpp" #include "cru/platform/win/win_native_window.hpp" +#include "cru/platform/win/window_class.hpp" #include <assert.h> namespace cru::platform::win { LRESULT __stdcall GeneralWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { - auto window = WinApplication::GetInstance()->GetWindowManager()->FromHandle(hWnd); + auto window = + WinApplication::GetInstance()->GetWindowManager()->FromHandle(hWnd); LRESULT result; if (window != nullptr && @@ -21,8 +23,7 @@ LRESULT __stdcall GeneralWndProc(HWND hWnd, UINT Msg, WPARAM wParam, WindowManager::WindowManager(WinApplication* application) { application_ = application; general_window_class_ = std::make_shared<WindowClass>( - L"CruUIWindowClass", GeneralWndProc, - application->GetInstanceHandle()); + L"CruUIWindowClass", GeneralWndProc, application->GetInstanceHandle()); } void WindowManager::RegisterWindow(HWND hwnd, WinNativeWindow* window) { @@ -50,4 +51,4 @@ std::vector<WinNativeWindow*> WindowManager::GetAllWindows() const { for (auto [key, value] : window_map_) windows.push_back(value); return windows; } -} +} // namespace cru::platform::win diff --git a/src/ui/content_control.cpp b/src/ui/content_control.cpp index 3a23164c..6383a10e 100644 --- a/src/ui/content_control.cpp +++ b/src/ui/content_control.cpp @@ -1,6 +1,6 @@ #include "cru/ui/content_control.hpp" -#include "window.hpp" +#include "cru/ui/window.hpp" #include <cassert> diff --git a/src/ui/control.cpp b/src/ui/control.cpp index c5d02d40..f915af07 100644 --- a/src/ui/control.cpp +++ b/src/ui/control.cpp @@ -1,6 +1,6 @@ #include "cru/ui/control.hpp" -#include "window.hpp" +#include "cru/ui/window.hpp" #include <cassert> diff --git a/src/ui/controls/button.cpp b/src/ui/controls/button.cpp index a6578251..0ac65d26 100644 --- a/src/ui/controls/button.cpp +++ b/src/ui/controls/button.cpp @@ -1,7 +1,7 @@ -#include "button.hpp" +#include "cru/ui/controls/button.hpp" -#include "ui/render/border_render_object.hpp" -#include "ui/ui_manager.hpp" +#include "cru/ui/render/border_render_object.hpp" +#include "cru/ui/ui_manager.hpp" namespace cru::ui::controls { Button::Button() { @@ -14,7 +14,9 @@ Button::Button() { render_object_->SetCornerRadius(render::CornerRadius{Point{10, 5}}); } -render::RenderObject* Button::GetRenderObject() const { return render_object_.get(); } +render::RenderObject* Button::GetRenderObject() const { + return render_object_.get(); +} void Button::OnChildChanged(Control* old_child, Control* new_child) { if (old_child != nullptr) render_object_->RemoveChild(0); diff --git a/src/ui/controls/button.hpp b/src/ui/controls/button.hpp deleted file mode 100644 index 3f313dfc..00000000 --- a/src/ui/controls/button.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once -#include "pre.hpp" - -#include <memory> - -#include "ui/content_control.hpp" - -namespace cru::ui::render { -class BorderRenderObject; -} - -namespace cru::ui::controls { -class Button : public ContentControl { - public: - static constexpr auto control_type = L"Button"; - - static Button* Create() { return new Button(); } - - protected: - Button(); - - public: - Button(const Button& other) = delete; - Button(Button&& other) = delete; - Button& operator=(const Button& other) = delete; - Button& operator=(Button&& other) = delete; - ~Button() override = default; - - StringView GetControlType() const override final { return control_type; } - - render::RenderObject* GetRenderObject() const override; - - protected: - void OnChildChanged(Control* old_child, Control* new_child) override; - - private: - std::shared_ptr<render::BorderRenderObject> render_object_{}; -}; -} // namespace cru::ui::controls diff --git a/src/ui/controls/flex_layout.cpp b/src/ui/controls/flex_layout.cpp index bdbe2d73..3b70c98c 100644 --- a/src/ui/controls/flex_layout.cpp +++ b/src/ui/controls/flex_layout.cpp @@ -1,6 +1,6 @@ -#include "flex_layout.hpp" +#include "cru/ui/controls/flex_layout.hpp" -#include "ui/render/flex_layout_render_object.hpp" +#include "cru/ui/render/flex_layout_render_object.hpp" namespace cru::ui::controls { using render::FlexLayoutRenderObject; diff --git a/src/ui/controls/flex_layout.hpp b/src/ui/controls/flex_layout.hpp deleted file mode 100644 index 9ceef1f6..00000000 --- a/src/ui/controls/flex_layout.hpp +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once -#include "pre.hpp" - -#include <memory> - -#include "ui/layout_control.hpp" - -namespace cru::ui::render { -class FlexLayoutRenderObject; -} - -namespace cru::ui::controls { - -class FlexLayout : public LayoutControl { - public: - static constexpr auto control_type = L"FlexLayout"; - - static FlexLayout* Create() { return new FlexLayout(); } - - protected: - FlexLayout(); - - public: - FlexLayout(const FlexLayout& other) = delete; - FlexLayout(FlexLayout&& other) = delete; - FlexLayout& operator=(const FlexLayout& other) = delete; - FlexLayout& operator=(FlexLayout&& other) = delete; - ~FlexLayout() override = default; - - StringView GetControlType() const override final { return control_type; } - - render::RenderObject* GetRenderObject() const override; - - protected: - void OnAddChild(Control* child, int position) override; - void OnRemoveChild(Control* child, int position) override; - - private: - std::shared_ptr<render::FlexLayoutRenderObject> render_object_; -}; -} // namespace cru::ui::controls diff --git a/src/ui/controls/text_block.cpp b/src/ui/controls/text_block.cpp index c2f8cd8e..55d83acc 100644 --- a/src/ui/controls/text_block.cpp +++ b/src/ui/controls/text_block.cpp @@ -1,7 +1,7 @@ -#include "text_block.hpp" +#include "cru/ui/controls/text_block.hpp" -#include "ui/render/text_render_object.hpp" -#include "ui/ui_manager.hpp" +#include "cru/ui/render/text_render_object.hpp" +#include "cru/ui/ui_manager.hpp" namespace cru::ui::controls { using render::TextRenderObject; @@ -11,7 +11,7 @@ TextBlock::TextBlock() { UiManager::GetInstance()->GetPredefineResources(); render_object_.reset( new TextRenderObject(predefined_resources->text_block_text_brush, - predefined_resources->text_block_text_format, + predefined_resources->text_block_font, predefined_resources->text_block_selection_brush)); } @@ -19,7 +19,9 @@ render::RenderObject* TextBlock::GetRenderObject() const { return render_object_.get(); } -String TextBlock::GetText() const { return render_object_->GetText(); } +std::wstring TextBlock::GetText() const { return render_object_->GetText(); } -void TextBlock::SetText(const String& text) { render_object_->SetText(text); } +void TextBlock::SetText(std::wstring text) { + render_object_->SetText(std::move(text)); +} } // namespace cru::ui::controls diff --git a/src/ui/controls/text_block.hpp b/src/ui/controls/text_block.hpp deleted file mode 100644 index 0d65dd67..00000000 --- a/src/ui/controls/text_block.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once -#include "pre.hpp" - -#include <memory> - -#include "ui/no_child_control.hpp" - -namespace cru::ui::render { -class TextRenderObject; -} - -namespace cru::ui::controls { -class TextBlock : public NoChildControl { - public: - static constexpr auto control_type = L"TextBlock"; - - static TextBlock* Create() { return new TextBlock(); } - - protected: - TextBlock(); - - public: - TextBlock(const TextBlock& other) = delete; - TextBlock(TextBlock&& other) = delete; - TextBlock& operator=(const TextBlock& other) = delete; - TextBlock& operator=(TextBlock&& other) = delete; - ~TextBlock() override = default; - - StringView GetControlType() const override final { return control_type; } - - render::RenderObject* GetRenderObject() const override; - - String GetText() const; - void SetText(const String& text); - - private: - std::shared_ptr<render::TextRenderObject> render_object_; -}; -} // namespace cru::ui::controls diff --git a/src/ui/layout_control.cpp b/src/ui/layout_control.cpp index 9d789670..00215a8e 100644 --- a/src/ui/layout_control.cpp +++ b/src/ui/layout_control.cpp @@ -1,6 +1,6 @@ #include "cru/ui/layout_control.hpp" -#include "window.hpp" +#include "cru/ui/window.hpp" #include <cassert> diff --git a/src/ui/render/border_render_object.cpp b/src/ui/render/border_render_object.cpp index 93e87c90..97e386dd 100644 --- a/src/ui/render/border_render_object.cpp +++ b/src/ui/render/border_render_object.cpp @@ -192,7 +192,7 @@ void BorderRenderObject::RecreateGeometry() { builder.reset(graph_factory->CreateGeometryBuilder()); f(builder.get(), outer_rect, corner_radius_); f(builder.get(), inner_rect, corner_radius_); - border_outer_geometry_.reset(builder->Build()); + geometry_.reset(builder->Build()); builder.reset(); } } // namespace cru::ui::render diff --git a/src/ui/render/flex_layout_render_object.cpp b/src/ui/render/flex_layout_render_object.cpp index 99368c23..e7840b7e 100644 --- a/src/ui/render/flex_layout_render_object.cpp +++ b/src/ui/render/flex_layout_render_object.cpp @@ -188,7 +188,7 @@ void FlexLayoutRenderObject::OnLayoutContent(const Rect& content_rect) { const float content_anchor_x = calculate_anchor( content_main_align_, 0, content_rect.width, actual_content_width); - auto anchor_x = 0; + float anchor_x = 0; for (int i = 0; i < children.size(); i++) { const auto child = children[i]; const auto size = child->GetPreferredSize(); @@ -215,7 +215,7 @@ void FlexLayoutRenderObject::OnLayoutContent(const Rect& content_rect) { const float content_anchor_y = calculate_anchor( content_main_align_, 0, content_rect.height, actual_content_height); - auto anchor_y = 0; + float anchor_y = 0; for (int i = 0; i < children.size(); i++) { const auto child = children[i]; const auto size = child->GetPreferredSize(); diff --git a/src/ui/render/window_render_object.cpp b/src/ui/render/window_render_object.cpp index ca1ab707..781087aa 100644 --- a/src/ui/render/window_render_object.cpp +++ b/src/ui/render/window_render_object.cpp @@ -1,22 +1,25 @@ #include "cru/ui/render/window_render_object.hpp" +#include "cru/platform/native_window.hpp" #include "cru/platform/painter_util.hpp" +#include "cru/ui/window.hpp" #include <cassert> namespace cru::ui::render { void WindowRenderObject::MeasureAndLayout() { - const auto client_size = window_->GetClientSize(); + const auto client_size = window_->GetNativeWindow()->GetClientSize(); Measure(client_size); Layout(Rect{Point{}, client_size}); } void WindowRenderObject::Draw(platform::Painter* painter) { + painter->Clear(colors::white); if (const auto child = GetChild()) { auto offset = child->GetOffset(); - platform::util::WithTransform(painter, - platform::Matrix::Translation(offset.x, offset.y), - [child](auto rt) { child->Draw(rt); }); + platform::util::WithTransform( + painter, platform::Matrix::Translation(offset.x, offset.y), + [child](auto rt) { child->Draw(rt); }); } } diff --git a/src/ui/ui_manager.cpp b/src/ui/ui_manager.cpp index 9c3c00d2..b1132ea8 100644 --- a/src/ui/ui_manager.cpp +++ b/src/ui/ui_manager.cpp @@ -1,5 +1,7 @@ #include "cru/ui/ui_manager.hpp" +#include "cru/platform/brush.hpp" +#include "cru/platform/font.hpp" #include "cru/platform/graph_factory.hpp" #include "cru/platform/ui_applicaition.hpp" @@ -8,13 +10,12 @@ PredefineResources::PredefineResources() { const auto graph_factory = platform::UiApplication::GetInstance()->GetGraphFactory(); - button_normal_border_brush.reset( - graph_factory->CreateSolidColorBrush(colors::black)); - - text_block_selection_brush.reset( - graph_factory->CreateSolidColorBrush(colors::skyblue)); - text_block_text_brush.reset( - graph_factory->CreateSolidColorBrush(colors::black)); + button_normal_border_brush.reset(static_cast<platform::Brush*>( + graph_factory->CreateSolidColorBrush(colors::black))); + text_block_selection_brush.reset(static_cast<platform::Brush*>( + graph_factory->CreateSolidColorBrush(colors::skyblue))); + text_block_text_brush.reset(static_cast<platform::Brush*>( + graph_factory->CreateSolidColorBrush(colors::black))); text_block_font.reset(graph_factory->CreateFontDescriptor(L"等线", 24.0f)); } diff --git a/src/ui/window.cpp b/src/ui/window.cpp index c0ee1a83..23bda285 100644 --- a/src/ui/window.cpp +++ b/src/ui/window.cpp @@ -99,6 +99,8 @@ Window* Window::CreateOverlapped() { } Window::Window(tag_overlapped_constructor) { + using namespace std::placeholders; + native_window_ = platform::UiApplication::GetInstance()->CreateWindow(nullptr); render_object_.reset(new render::WindowRenderObject(this)); @@ -108,12 +110,21 @@ Window::Window(tag_overlapped_constructor) { event_revokers_.push_back(native_window_->PaintEvent()->AddHandler( std::bind(&Window::OnNativePaint, this))); event_revokers_.push_back(native_window_->ResizeEvent()->AddHandler( - std::bind(&Window::OnNativeResize, this))); - event_revokers_.push_back(native_window_->FocusEvent()->AddHandler( - std::bind(&Window::OnNativeFocus, this))); + std::bind(&Window::OnNativeResize, this, _1))); event_revokers_.push_back(native_window_->FocusEvent()->AddHandler( - std::bind(&Window::OnNativeFocus, this))); - //TODO! + std::bind(&Window::OnNativeFocus, this, _1))); + event_revokers_.push_back(native_window_->MouseEnterLeaveEvent()->AddHandler( + std::bind(&Window::OnNativeMouseEnterLeave, this, _1))); + event_revokers_.push_back(native_window_->MouseMoveEvent()->AddHandler( + std::bind(&Window::OnNativeMouseMove, this, _1))); + event_revokers_.push_back(native_window_->MouseDownEvent()->AddHandler( + std::bind(&Window::OnNativeMouseDown, this, _1, _2))); + event_revokers_.push_back(native_window_->MouseUpEvent()->AddHandler( + std::bind(&Window::OnNativeMouseUp, this, _1, _2))); + event_revokers_.push_back(native_window_->KeyDownEvent()->AddHandler( + std::bind(&Window::OnNativeKeyDown, this, _1))); + event_revokers_.push_back(native_window_->KeyUpEvent()->AddHandler( + std::bind(&Window::OnNativeKeyUp, this, _1))); } Window::~Window() { @@ -157,7 +168,7 @@ void Window::OnNativeDestroy() { delete this; } void Window::OnNativePaint() { const auto painter = - std::make_unique<platform::Painter>(native_window_->BeginPaint()); + std::unique_ptr<platform::Painter>(native_window_->BeginPaint()); render_object_->Draw(painter.get()); painter->EndDraw(); } |