refactor: make api::View
methods const, private (#46551)
* refactor: make api::View::GetBounds() const Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: make api::View::OnViewBoundsChanged() private refactor: make api::View::OnViewIsDeleting() private refactor: make api::View::OnChildViewRemoved() private Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: make ChildPair private Co-authored-by: Charles Kerr <charles@charleskerr.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
de933233e6
commit
feaa9ec5b9
2 changed files with 10 additions and 10 deletions
|
@ -280,7 +280,7 @@ void View::SetBounds(const gfx::Rect& bounds) {
|
||||||
view_->SetBoundsRect(bounds);
|
view_->SetBoundsRect(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Rect View::GetBounds() {
|
gfx::Rect View::GetBounds() const {
|
||||||
if (!view_)
|
if (!view_)
|
||||||
return {};
|
return {};
|
||||||
return view_->bounds();
|
return view_->bounds();
|
||||||
|
|
|
@ -21,8 +21,6 @@ class Handle;
|
||||||
|
|
||||||
namespace electron::api {
|
namespace electron::api {
|
||||||
|
|
||||||
using ChildPair = std::pair<raw_ptr<views::View>, v8::Global<v8::Object>>;
|
|
||||||
|
|
||||||
class View : public gin_helper::EventEmitter<View>,
|
class View : public gin_helper::EventEmitter<View>,
|
||||||
private views::ViewObserver {
|
private views::ViewObserver {
|
||||||
public:
|
public:
|
||||||
|
@ -39,7 +37,7 @@ class View : public gin_helper::EventEmitter<View>,
|
||||||
void RemoveChildView(gin::Handle<View> child);
|
void RemoveChildView(gin::Handle<View> child);
|
||||||
|
|
||||||
void SetBounds(const gfx::Rect& bounds);
|
void SetBounds(const gfx::Rect& bounds);
|
||||||
gfx::Rect GetBounds();
|
gfx::Rect GetBounds() const;
|
||||||
void SetLayout(v8::Isolate* isolate, v8::Local<v8::Object> value);
|
void SetLayout(v8::Isolate* isolate, v8::Local<v8::Object> value);
|
||||||
std::vector<v8::Local<v8::Value>> GetChildren();
|
std::vector<v8::Local<v8::Value>> GetChildren();
|
||||||
void SetBackgroundColor(std::optional<WrappedSkColor> color);
|
void SetBackgroundColor(std::optional<WrappedSkColor> color);
|
||||||
|
@ -47,12 +45,6 @@ class View : public gin_helper::EventEmitter<View>,
|
||||||
void SetVisible(bool visible);
|
void SetVisible(bool visible);
|
||||||
bool GetVisible() const;
|
bool GetVisible() const;
|
||||||
|
|
||||||
// views::ViewObserver
|
|
||||||
void OnViewBoundsChanged(views::View* observed_view) override;
|
|
||||||
void OnViewIsDeleting(views::View* observed_view) override;
|
|
||||||
void OnChildViewRemoved(views::View* observed_view,
|
|
||||||
views::View* child) override;
|
|
||||||
|
|
||||||
views::View* view() const { return view_; }
|
views::View* view() const { return view_; }
|
||||||
std::optional<int> border_radius() const { return border_radius_; }
|
std::optional<int> border_radius() const { return border_radius_; }
|
||||||
|
|
||||||
|
@ -69,6 +61,14 @@ class View : public gin_helper::EventEmitter<View>,
|
||||||
void set_delete_view(bool should) { delete_view_ = should; }
|
void set_delete_view(bool should) { delete_view_ = should; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
using ChildPair = std::pair<raw_ptr<views::View>, v8::Global<v8::Object>>;
|
||||||
|
|
||||||
|
// views::ViewObserver
|
||||||
|
void OnViewBoundsChanged(views::View* observed_view) override;
|
||||||
|
void OnViewIsDeleting(views::View* observed_view) override;
|
||||||
|
void OnChildViewRemoved(views::View* observed_view,
|
||||||
|
views::View* child) override;
|
||||||
|
|
||||||
void ApplyBorderRadius();
|
void ApplyBorderRadius();
|
||||||
void ReorderChildView(gin::Handle<View> child, size_t index);
|
void ReorderChildView(gin::Handle<View> child, size_t index);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue