From 723739dafe91a156fef527f3b53a483195695cf1 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 20 Dec 2002 15:26:34 +0000 Subject: [PATCH] api cleanups --- otk/appwidget.cc | 2 +- otk/button.cc | 8 ++++---- otk/focuslabel.cc | 18 +++++++++--------- otk/focuswidget.cc | 6 +++--- otk/label.cc | 14 +++++++------- otk/widget.cc | 10 +++++----- otk/widget.hh | 26 +++++++++++++------------- 7 files changed, 42 insertions(+), 42 deletions(-) diff --git a/otk/appwidget.cc b/otk/appwidget.cc index bd1acbf8..fd25f161 100644 --- a/otk/appwidget.cc +++ b/otk/appwidget.cc @@ -27,7 +27,7 @@ OtkAppWidget::OtkAppWidget(OtkApplication *app, Direction direction, Atom protocols[2]; protocols[0] = _wm_protocols; protocols[1] = _wm_delete; - XSetWMProtocols(OBDisplay::display, getWindow(), protocols, 2); + XSetWMProtocols(OBDisplay::display, window(), protocols, 2); } OtkAppWidget::~OtkAppWidget() diff --git a/otk/button.cc b/otk/button.cc index 2b174582..9f393087 100644 --- a/otk/button.cc +++ b/otk/button.cc @@ -23,10 +23,10 @@ void OtkButton::setStyle(Style *style) { OtkFocusLabel::setStyle(style); - setTexture(getStyle()->getButtonFocus()); - setUnfocusTexture(getStyle()->getButtonUnfocus()); - _pressed_focus_tx = getStyle()->getButtonPressedFocus(); - _pressed_unfocus_tx = getStyle()->getButtonPressedUnfocus(); + setTexture(style->getButtonFocus()); + setUnfocusTexture(style->getButtonUnfocus()); + _pressed_focus_tx = style->getButtonPressedFocus(); + _pressed_unfocus_tx = style->getButtonPressedUnfocus(); } diff --git a/otk/focuslabel.cc b/otk/focuslabel.cc index c4f124e6..5b9fcb30 100644 --- a/otk/focuslabel.cc +++ b/otk/focuslabel.cc @@ -13,8 +13,8 @@ namespace otk { OtkFocusLabel::OtkFocusLabel(OtkWidget *parent) : OtkFocusWidget(parent), _text("") { - const ScreenInfo *info = OBDisplay::screenInfo(getScreen()); - _xftdraw = XftDrawCreate(OBDisplay::display, getWindow(), info->getVisual(), + const ScreenInfo *info = OBDisplay::screenInfo(screen()); + _xftdraw = XftDrawCreate(OBDisplay::display, window(), info->getVisual(), info->getColormap()); } @@ -28,18 +28,18 @@ void OtkFocusLabel::setStyle(Style *style) { OtkFocusWidget::setStyle(style); - setTexture(getStyle()->getLabelFocus()); - setUnfocusTexture(getStyle()->getLabelUnfocus()); + setTexture(style->getLabelFocus()); + setUnfocusTexture(style->getLabelUnfocus()); } void OtkFocusLabel::update(void) { if (_dirty) { - const BFont &ft = getStyle()->getFont(); - BColor *text_color = (isFocused() ? getStyle()->getTextFocus() - : getStyle()->getTextUnfocus()); - unsigned int sidemargin = getStyle()->getBevelWidth() * 2; + const BFont &ft = style()->getFont(); + BColor *text_color = (isFocused() ? style()->getTextFocus() + : style()->getTextUnfocus()); + unsigned int sidemargin = style()->getBevelWidth() * 2; std::string t = _text; // the actual text to draw int x = sidemargin; // x coord for the text @@ -58,7 +58,7 @@ void OtkFocusLabel::update(void) } while (length > max_length && text_len-- > 0); // justify the text - switch (getStyle()->textJustify()) { + switch (style()->textJustify()) { case Style::RightJustify: x += max_length - length; break; diff --git a/otk/focuswidget.cc b/otk/focuswidget.cc index f5b176bf..a5d2696d 100644 --- a/otk/focuswidget.cc +++ b/otk/focuswidget.cc @@ -12,8 +12,8 @@ OtkFocusWidget::OtkFocusWidget(OtkWidget *parent, Direction direction) : OtkWidget(parent, direction), _unfocus_texture(0), _unfocus_bcolor(0) { _focused = true; - _focus_texture = parent->getTexture(); - _focus_bcolor = parent->getBorderColor(); + _focus_texture = parent->texture(); + _focus_bcolor = parent->borderColor(); } OtkFocusWidget::~OtkFocusWidget() @@ -50,7 +50,7 @@ void OtkFocusWidget::unfocus(void) OtkWidget::setTexture(_unfocus_texture); OtkWidget::update(); - OtkWidget::OtkWidgetList children = OtkWidget::getChildren(); + OtkWidget::OtkWidgetList children = OtkWidget::children(); OtkWidget::OtkWidgetList::iterator it = children.begin(), end = children.end(); diff --git a/otk/label.cc b/otk/label.cc index ceb6a49c..bbc8a6b7 100644 --- a/otk/label.cc +++ b/otk/label.cc @@ -11,8 +11,8 @@ namespace otk { OtkLabel::OtkLabel(OtkWidget *parent) : OtkWidget(parent), _text("") { - const ScreenInfo *info = OBDisplay::screenInfo(getScreen()); - _xftdraw = XftDrawCreate(OBDisplay::display, getWindow(), info->getVisual(), + const ScreenInfo *info = OBDisplay::screenInfo(screen()); + _xftdraw = XftDrawCreate(OBDisplay::display, window(), info->getVisual(), info->getColormap()); } @@ -25,15 +25,15 @@ void OtkLabel::setStyle(Style *style) { OtkWidget::setStyle(style); - setTexture(getStyle()->getLabelUnfocus()); + setTexture(style->getLabelUnfocus()); } void OtkLabel::update(void) { if (_dirty) { - const BFont &ft = getStyle()->getFont(); - unsigned int sidemargin = getStyle()->getBevelWidth() * 2; + const BFont &ft = style()->getFont(); + unsigned int sidemargin = style()->getBevelWidth() * 2; std::string t = _text; // the actual text to draw int x = sidemargin; // x coord for the text @@ -52,7 +52,7 @@ void OtkLabel::update(void) } while (length > max_length && text_len-- > 0); // justify the text - switch (getStyle()->textJustify()) { + switch (style()->textJustify()) { case Style::RightJustify: x += max_length - length; break; @@ -66,7 +66,7 @@ void OtkLabel::update(void) OtkWidget::update(); - ft.drawString(_xftdraw, x, 0, *getStyle()->getTextUnfocus(), t); + ft.drawString(_xftdraw, x, 0, *style()->getTextUnfocus(), t); } else OtkWidget::update(); } diff --git a/otk/widget.cc b/otk/widget.cc index fec463fd..f303c3e4 100644 --- a/otk/widget.cc +++ b/otk/widget.cc @@ -17,14 +17,14 @@ namespace otk { OtkWidget::OtkWidget(OtkWidget *parent, Direction direction) : OtkEventHandler(), _dirty(false), _focused(false), - _parent(parent), _style(parent->getStyle()), _direction(direction), - _cursor(parent->getCursor()), _bevel_width(parent->getBevelWidth()), + _parent(parent), _style(parent->style()), _direction(direction), + _cursor(parent->cursor()), _bevel_width(parent->bevelWidth()), _ignore_config(0), _visible(false), _grabbed_mouse(false), _grabbed_keyboard(false), _stretchable_vert(false), _stretchable_horz(false), _texture(0), _bg_pixmap(0), _bg_pixel(0), - _bcolor(0), _bwidth(0), _screen(parent->getScreen()), _fixed_width(false), - _fixed_height(false), _event_dispatcher(parent->getEventDispatcher()) + _bcolor(0), _bwidth(0), _screen(parent->screen()), _fixed_width(false), + _fixed_height(false), _event_dispatcher(parent->eventDispatcher()) { assert(parent); parent->addChild(this); @@ -70,7 +70,7 @@ OtkWidget::~OtkWidget() void OtkWidget::create(void) { const ScreenInfo *scr_info = otk::OBDisplay::screenInfo(_screen); - Window p_window = _parent ? _parent->getWindow() : scr_info->getRootWindow(); + Window p_window = _parent ? _parent->window() : scr_info->getRootWindow(); _rect.setRect(0, 0, 1, 1); // just some initial values diff --git a/otk/widget.hh b/otk/widget.hh index 5a40f4e9..608d8e58 100644 --- a/otk/widget.hh +++ b/otk/widget.hh @@ -37,11 +37,11 @@ public: void exposeHandler(const XExposeEvent &e); void configureHandler(const XConfigureEvent &e); - inline Window getWindow(void) const { return _window; } - inline const OtkWidget *getParent(void) const { return _parent; } - inline const OtkWidgetList &getChildren(void) const { return _children; } - inline unsigned int getScreen(void) const { return _screen; } - inline const Rect &getRect(void) const { return _rect; } + inline Window window(void) const { return _window; } + inline const OtkWidget *parent(void) const { return _parent; } + inline const OtkWidgetList &children(void) const { return _children; } + inline unsigned int screen(void) const { return _screen; } + inline const Rect &rect(void) const { return _rect; } void move(const Point &to); void move(int x, int y); @@ -75,17 +75,17 @@ public: bool grabKeyboard(void); void ungrabKeyboard(void); - inline BTexture *getTexture(void) const { return _texture; } + inline BTexture *texture(void) const { return _texture; } virtual void setTexture(BTexture *texture) { _texture = texture; _dirty = true; } - inline const BColor *getBorderColor(void) const { return _bcolor; } + inline const BColor *borderColor(void) const { return _bcolor; } virtual void setBorderColor(const BColor *color) { assert(color); _bcolor = color; XSetWindowBorder(OBDisplay::display, _window, color->pixel()); } - inline int getBorderWidth(void) const { return _bwidth; } + inline int borderWidth(void) const { return _bwidth; } void setBorderWidth(int width) { _bwidth = width; XSetWindowBorderWidth(OBDisplay::display, _window, width); @@ -100,23 +100,23 @@ public: inline bool isStretchableVert(void) const { return _stretchable_vert; } void setStretchableVert(bool s_vert = true) { _stretchable_vert = s_vert; } - inline Cursor getCursor(void) const { return _cursor; } + inline Cursor cursor(void) const { return _cursor; } void setCursor(Cursor cursor) { _cursor = cursor; XDefineCursor(OBDisplay::display, _window, _cursor); } - inline int getBevelWidth(void) const { return _bevel_width; } + inline int bevelWidth(void) const { return _bevel_width; } void setBevelWidth(int bevel_width) { assert(bevel_width > 0); _bevel_width = bevel_width; } - inline Direction getDirection(void) const { return _direction; } + inline Direction direction(void) const { return _direction; } void setDirection(Direction dir) { _direction = dir; } - inline Style *getStyle(void) const { return _style; } + inline Style *style(void) const { return _style; } virtual void setStyle(Style *style); - inline OtkEventDispatcher *getEventDispatcher(void) + inline OtkEventDispatcher *eventDispatcher(void) { return _event_dispatcher; } void setEventDispatcher(OtkEventDispatcher *disp); -- 2.39.2