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 添加响应方法

  • 相关阅读:
    Python 入门的一些练习题
    Parallel Data Augmentation for Formality Style Transfer 阅读
    Windows Internals 笔记——用户模式下的线程同步
    RSA算法原理(转)
    Ubuntu Git Server 搭建(Gitosis)
    Linux Make 报错:make: *** /lib/modules/3.10.0-1127.el7.x86_64/build: no such file or directory. stop.
    Centos 配置串口连接
    编写一个程序,将字符数组s2中的全部字符复制到字符数组s1中,不用strcpy函数。复制时,‘’也要赋值过去。''之后的字符不复制
    编写一个程序,将连个字符串s1和s2比较,如果s1 > s2,输出一个整数;若s1 = s2,输出0;若s1 < s2,输出一个负数。不要用strcpy函数。两个字符串用gets函数读入。输出的正数或负数的绝对值应是相比较的两个字符串相对应字符的ASCII码的差值。
    编一程序,将两个字符串连接起来,不要用strcat函数
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/2852398.html
Copyright © 2011-2022 走看看