diff options
Diffstat (limited to 'dw')
-rw-r--r-- | dw/widget.cc | 17 | ||||
-rw-r--r-- | dw/widget.hh | 21 |
2 files changed, 38 insertions, 0 deletions
diff --git a/dw/widget.cc b/dw/widget.cc index edabce51..865023a1 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -1361,6 +1361,23 @@ style::Color *Widget::getBgColor () return layout->getBgColor (); } +/** + * \brief Get the actual foreground color of a widget. + */ +style::Color *Widget::getFgColor () +{ + Widget *widget = this; + + while (widget != NULL) { + if (widget->style->color) + return widget->style->color; + + widget = widget->parent; + } + + return NULL; +} + /** * \brief Draw borders and background of a widget part, which allocation is diff --git a/dw/widget.hh b/dw/widget.hh index cf0ffe46..d1957d4f 100644 --- a/dw/widget.hh +++ b/dw/widget.hh @@ -1,3 +1,23 @@ +/* + * Dillo Widget + * + * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org> + * Copyright 2023-2024 Rodrigo Arias Mallo <rodarima@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + #ifndef __DW_WIDGET_HH__ #define __DW_WIDGET_HH__ @@ -540,6 +560,7 @@ public: virtual void setStyle (style::Style *style); void setBgColor (style::Color *bgColor); style::Color *getBgColor (); + style::Color *getFgColor (); void drawBox (View *view, style::Style *style, Rectangle *area, int x, int y, int width, int height, bool inverse); |