libcdos-fw
|
CFBox 该控件会以矩形区域来组织其所容纳的控件。 更多...
#include <CFBox.h>
Public 成员函数 | |
CFBox (CFOrientation orientation=CFORIENTATION_HORIZONTAL, int spacing=0) | |
构造函数. 更多... | |
void | packEnd (CFWidget &child, bool expand, bool fill, CFUInt padding=0) |
将控件插入到CFBox中。 更多... | |
void | packStart (CFWidget &child, bool expand, bool fill, CFUInt padding=0) |
将控件插入到CFBox中。 更多... | |
virtual | ~CFBox () |
析构函数. | |
![]() | |
virtual void | add (CFWidget &widget) |
virtual void | addCssStyleData (const Glib::ustring &data, CFUInt priority) |
virtual void | addCssStylePath (const Glib::ustring &path, CFUInt priority) |
void | forall (ForeachSlot slot) |
void | foreach (ForeachSlot slot) |
bool | isContainer () |
判断控件是否为容器。 更多... | |
virtual void | remove (CFWidget &widget) |
![]() | |
void | addEvents (Gdk::EventMask events) |
将 events 位字段添加到控件的事件监听掩码中。 更多... | |
int | getAllocatedHeight () |
返回当前给控件分配的高度。 更多... | |
int | getAllocatedWidth () |
返回当前给控件分配的宽度。 更多... | |
bool | getCanFocus () |
获取控件是否可以拥有输入焦点。 更多... | |
CFAlign | getHalign () |
获取横向对齐方式。 更多... | |
bool | getHasTooltip () |
获取是否使用提示信息。 更多... | |
int | getMarginBottom () |
获取控件的下边距 更多... | |
int | getMarginLeft () |
获取控件的左边距 更多... | |
int | getMarginRight () |
获取控件的右边距 更多... | |
int | getMarginTop () |
获取控件的上边距 更多... | |
bool | getSensitive () |
获取控件可用状态 更多... | |
Glib::ustring | getTooltipMarkup () |
获取当前控件提示信息的内容。 更多... | |
Glib::ustring | getTooltipText () |
获取当前控件提示信息的内容。 更多... | |
CFAlign | getValign () |
获取纵向对齐方式。 更多... | |
bool | getVisible () |
判断本控件是否为可见状态。 更多... | |
void | grabFocus () |
控件获取键盘输入焦点。 更多... | |
bool | hasFocus () |
判断控件是否拥有全局输入焦点。 更多... | |
void | hide () |
隐藏控件 更多... | |
bool | isFocus () |
判断控件是否当前拥有焦点的控件。 更多... | |
bool | isSensitive () |
获取控件及其所在容器控件的可用状态 更多... | |
bool | isVisible () |
判断本控件以及控件所在容器(直到顶层容器)是否为可见状态。 更多... | |
void | queueDraw () |
请求重新描画控件 更多... | |
void | queueDrawArea (int x, int y, int width, int height) |
请求重新描画的指定区域 更多... | |
void | reparent (CFWidget &new_parent) |
将控件从当前的容器中移动到 newParent 指定的容器中。 更多... | |
void | setCanFocus (bool can_focus=true) |
指定控件是否可以获取输入焦点。 更多... | |
void | setEvents (Gdk::EventMask events) |
设置控件的事件监听掩码。 更多... | |
void | setHalign (CFAlign align) |
设置控件横向对齐方式。 更多... | |
void | setHasTooltip (bool has_tooltip=true) |
设置是否使用提示信息。 更多... | |
void | setMarginBottom (int margin) |
设置控件的下边距 更多... | |
void | setMarginLeft (int margin) |
设置控件的左边距 更多... | |
void | setMarginRight (int margin) |
设置控件的右边距 更多... | |
void | setMarginTop (int margin) |
设置控件的上边距 更多... | |
void | setName (const Glib::ustring &name) |
设置控件的名称,以便于使用CSS文件来控制样式。 更多... | |
void | setSensitive (bool sensitive=true) |
设置控件是否可用。 更多... | |
void | setSizeRequest (int width=-1, int height=-1) |
设置控件的最小尺寸。 更多... | |
void | setTooltipMarkup (const Glib::ustring &markup) |
设置提示信息的内容。 更多... | |
void | setTooltipText (const Glib::ustring &text) |
设置提示信息的内容。 更多... | |
void | setValign (CFAlign align) |
设置控件纵向对齐方式。 更多... | |
void | setVisible (bool visible=true) |
设置控件的可见状态。 更多... | |
void | show () |
显示控件。 更多... | |
void | showAll () |
显示控件以及控件所容纳的所有控件(包括所容纳容器控件的所有子控件) 更多... | |
virtual | ~CFWidget () |
析构函数 更多... | |
virtual void | addCssStyleName (const Glib::ustring &name) |
virtual void | addCssStyleFromPath (const Glib::ustring &css_file_path, const Glib::ustring &name, CFUInt priority) |
通过自定义css样式文件路径设置样式 更多... | |
virtual void | listCssStyle () |
查看样式列表 更多... | |
virtual std::vector< Glib::ustring > | getCssStyleVector () |
获取控件样式列表 更多... | |
virtual void | removeCssStyle (const Glib::ustring &name) |
通过样式名移除样式 更多... | |
Glib::RefPtr< Gdk::Window > | getWindow () |
sigc::signal< bool, const ::Cairo::RefPtr< ::Cairo::Context > &> | signalDraw () |
sigc::signal< bool, GdkEvent *> | signalEvent () |
sigc::signal< bool, GdkEventButton *> | signalButtonPressEvent () |
sigc::signal< bool, GdkEventButton *> | signalButtonReleaseEvent () |
sigc::signal< bool, GdkEventAny *> | signalDeleteEvent () |
sigc::signal< bool, GdkEventKey *> | signalKeyPressEvent () |
sigc::signal< bool, GdkEventKey *> | signalKeyReleaseEvent () |
sigc::signal< void > | signalShow () |
![]() | |
void * | getObj () |
获取支持库类实例所绑定的对象实例。 更多... | |
virtual | ~CFObject () |
析构函数。 更多... | |
额外继承的成员函数 | |
![]() | |
typedef sigc::slot< void, CFWidget * > | ForeachSlot |
![]() | |
static CFObject * | getCFObject (void *realObj) |
通过对象实例获取所对应的 CFObject的子类对象实例。 更多... | |
![]() | |
void | onApplyCssData (CFWidget *widget) |
void | onApplyCssPath (CFWidget *widget) |
![]() | |
virtual void | onRealObjectInit () |
对象绑定后进行初始化的回调函数。 更多... | |
virtual void | onRealObjectFinalize () |
对象解除绑定前的回调函数。 更多... | |
virtual bool | onDraw (const ::Cairo::RefPtr< ::Cairo::Context > &cr) |
virtual bool | onEvent (GdkEvent *event) |
virtual bool | onButtonPressEvent (GdkEventButton *event) |
virtual bool | onButtonReleaseEvent (GdkEventButton *event) |
virtual bool | onDeleteEvent (GdkEventAny *event) |
virtual bool | onKeyPressEvent (GdkEventKey *event) |
virtual bool | onKeyReleaseEvent (GdkEventKey *event) |
virtual void | onShow () |
CFWidget () | |
![]() | |
CFObject () | |
构造函数 更多... | |
void | setRealObject (void *obj) |
将自身实例与需要使用的对象实例进行绑定。 更多... | |
CFBox 该控件会以矩形区域来组织其所容纳的控件。
CFBox容纳的子控件会被组织成一行或一列,这取决到 orientation 参数。
因此当CFBox被组织成一列时,所有CFBox容纳的子控件会被分配同样的宽度;
当CFBox被组织成一行时,所有CFBox容纳的子控件会被分配同样的高度。
CFBox使用一种打包的概念。 打包的实现是将控件的实例添加到CFContainer的特定位置。
CFBox支持两种指定的位置类型: 从CFBox的起始位置开始打包和从CFBox的结束位置开始打包。
如:纵向的CFBox,起始位置为最上端,而结束位置为最下端; 横向的CFBox,起始位置为最左端,
而结束位置为最右端。重复调用 pack_start() 函数可以从起始位置到结束位置打包控件。
重复调用 pack_end() 函数可以从结束位置到起始位置打包控件。也可以混合使用这两个函数进行布局。
使用 pack_start() 添加的最后一个控件会正好在使用 pack_end() 添加的最后一个控件的前面。
由于CFBox也是一个CFContainer类, 也可以使用 CFContainer::add() 来添加控件,它的行会与使用
pack_start() 一样。 也可以使用 CFContainer::remove() 来移除控件。
CFBox::CFBox | ( | CFOrientation | orientation = CFORIENTATION_HORIZONTAL , |
int | spacing = 0 |
||
) |
构造函数.
构造一个新的CFBox;
[in] | orientation | CFBox的方向。 |
[in] | spacing | 所容纳控件间的距离,以像素为单位。 |
void CFBox::packEnd | ( | CFWidget & | child, |
bool | expand, | ||
bool | fill, | ||
CFUInt | padding = 0 |
||
) |
将控件插入到CFBox中。
方向为从结束位置到起始位置。
[in] | child | 需要加入到 CFBox 的控件对象。 |
[in] | expand | true: child 会随着CFBox拉伸而缩放, false: child不会随着CFBox拉伸而缩放。 |
[in] | fill | 若expand为false时,则该参数无效; true: child会填充CFBox的剩余空间, false: child不会填充CFBox的剩余空间。 |
[in] | padding | 在child对象两边附加的以像素为单位的空间。 |
void CFBox::packStart | ( | CFWidget & | child, |
bool | expand, | ||
bool | fill, | ||
CFUInt | padding = 0 |
||
) |
将控件插入到CFBox中。
方向为从起始位置到结束位置。
pack_start() 或 pack_end() 的 expand 参数, 指定了 child 控件
是否会随着 CFBox 的拉伸而进行缩放。
pack_start() 或 pack_end() 的 fill 参数, 指定了child控件是否
填充 CFBox 的剩余空间。
spacing(构造时的参数)和 padding 参数的区别是:spacing会被加到两个对象之间,
而 padding 会被加到对象的两边。
[in] | child | 需要加入到 CFBox 的控件对象。 |
[in] | expand | true: child 会随着CFBox拉伸而缩放, false: child不会随着CFBox拉伸而缩放。 |
[in] | fill | 若expand为false时,则该参数无效; true: child会填充CFBox的剩余空间, false: child不会填充CFBox的剩余空间。 |
[in] | padding | 在child对象两边附加的以像素为单位的空间。 |