mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: make api::View methods const, private (#46545)
* refactor: make api::View::GetBounds() const * refactor: make api::View::OnViewBoundsChanged() private refactor: make api::View::OnViewIsDeleting() private refactor: make api::View::OnChildViewRemoved() private * refactor: make ChildPair private
This commit is contained in:
@@ -280,7 +280,7 @@ void View::SetBounds(const gfx::Rect& bounds) {
|
||||
view_->SetBoundsRect(bounds);
|
||||
}
|
||||
|
||||
gfx::Rect View::GetBounds() {
|
||||
gfx::Rect View::GetBounds() const {
|
||||
if (!view_)
|
||||
return {};
|
||||
return view_->bounds();
|
||||
|
||||
@@ -21,8 +21,6 @@ class Handle;
|
||||
|
||||
namespace electron::api {
|
||||
|
||||
using ChildPair = std::pair<raw_ptr<views::View>, v8::Global<v8::Object>>;
|
||||
|
||||
class View : public gin_helper::EventEmitter<View>,
|
||||
private views::ViewObserver {
|
||||
public:
|
||||
@@ -39,7 +37,7 @@ class View : public gin_helper::EventEmitter<View>,
|
||||
void RemoveChildView(gin::Handle<View> child);
|
||||
|
||||
void SetBounds(const gfx::Rect& bounds);
|
||||
gfx::Rect GetBounds();
|
||||
gfx::Rect GetBounds() const;
|
||||
void SetLayout(v8::Isolate* isolate, v8::Local<v8::Object> value);
|
||||
std::vector<v8::Local<v8::Value>> GetChildren();
|
||||
void SetBackgroundColor(std::optional<WrappedSkColor> color);
|
||||
@@ -47,12 +45,6 @@ class View : public gin_helper::EventEmitter<View>,
|
||||
void SetVisible(bool visible);
|
||||
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_; }
|
||||
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; }
|
||||
|
||||
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 ReorderChildView(gin::Handle<View> child, size_t index);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user