zoukankan      html  css  js  c++  java
  • chromuim 源代码分析 GIS

    先看ui,ui的基础控件在

    ui文件夹—views-control-views项目-control文件夹

    先看button

    image

    image button 继承view

    image view继承了好多啊

    我们思考一下 一个控件需要涉及到那些东西

    (1) 控件在屏幕上的位置

    (2) 控件的高 ,宽

    (3) 控件的容器(父控件,子控件)

    (4) 控件获取焦点

    (5) 如何获得这个控件(控件的 id)

    (6) 控件的样式(背景色,字体,border,前景色)

    这些都已经定义在view类里面了,

    image

    这些方法应该是 怎么将控件显示在屏幕上

    如果在往下分析就要看

    public ui::LayerDelegate,
                              public ui::LayerOwner,
                              public ui::AcceleratorTarget,
                              public ui::EventTarget

    这几个类了

    看一下view 公开的方法,这些方法 都是我们在程序里面要调用的

    virtual const Widget* GetWidget() const;
    virtual Widget* GetWidget();

    // Adds |view| as a child of this view, optionally at |index|.
    void AddChildView(View* view);
    void AddChildViewAt(View* view, int index);

    // Moves |view| to the specified |index|. A negative value for |index| moves
    // the view at the end.
    void ReorderChildView(View* view, int index);

    // Removes |view| from this view. The view's parent will change to NULL.
    void RemoveChildView(View* view);

    // Removes all the children from this view. If |delete_children| is true,
    // the views are deleted, unless marked as not parent owned.
    void RemoveAllChildViews(bool delete_children);

    int child_count() const { return static_cast<int>(children_.size()); }
    bool has_children() const { return !children_.empty(); }

    // Returns the child view at |index|.
    const View* child_at(int index) const {
       DCHECK_GE(index, 0);
       DCHECK_LT(index, child_count());
       return children_[index];
    }
    View* child_at(int index) {
       return const_cast<View*>(const_cast<const View*>(this)->child_at(index));
    }

    // Returns the parent view.
    const View* parent() const { return parent_; }
    View* parent() { return parent_; }

    // Returns true if |view| is contained within this View's hierarchy, even as
    // an indirect descendant. Will return true if child is also this view.
    bool Contains(const View* view) const;

    // Returns the index of |view|, or -1 if |view| is not a child of this view.
    int GetIndexOf(const View* view) const;

    // Size and disposition ------------------------------------------------------
    // Methods for obtaining and modifying the position and size of the view.
    // Position is in the coordinate system of the view's parent.
    // Position is NOT flipped for RTL. See "RTL positioning" for RTL-sensitive
    // position accessors.
    // Transformations are not applied on the size/position. For example, if
    // bounds is (0, 0, 100, 100) and it is scaled by 0.5 along the X axis, the
    // width will still be 100 (although when painted, it will be 50x50, painted
    // at location (0, 0)).

    void SetBounds(int x, int y, int width, int height);
    void SetBoundsRect(const gfx::Rect& bounds);
    void SetSize(const gfx::Size& size);
    void SetPosition(const gfx::Point& position);
    void SetX(int x);
    void SetY(int y);

    // No transformation is applied on the size or the locations.
    const gfx::Rect& bounds() const { return bounds_; }
    int x() const { return bounds_.x(); }
    int y() const { return bounds_.y(); }
    int width() const { return bounds_.width(); }
    int height() const { return bounds_.height(); }
    const gfx::Size& size() const { return bounds_.size(); }

    // Returns the bounds of the content area of the view, i.e. the rectangle
    // enclosed by the view's border.
    gfx::Rect GetContentsBounds() const;

    // Returns the bounds of the view in its own coordinates (i.e. position is
    // 0, 0).
    gfx::Rect GetLocalBounds() const;

    以下还有很多方法。。。。。

    Button::Button(ButtonListener* listener)
        : listener_(listener),
          tag_(-1) {
      set_accessibility_focusable(true);
    }

    button 添加响应方法

  • 相关阅读:
    我看到的我未曾是你们看到的我。
    nagios状态数据更新不及时问题
    Ubuntu下安装 nagiosgraph报错处理
    禁止、允许PING
    windows批量关机
    [转载]div仿框架(B/S结构软件界面)详解[非quirks模式全兼容]
    rrdtool错误attempt to put segment in horiz list twice
    命令参考大全 iostat
    SAP学习手册
    顾问成长之路
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/2852398.html
Copyright © 2011-2022 走看看