Skip to content

Commit

Permalink
Add global color options for widgets
Browse files Browse the repository at this point in the history
This adds a few more global options for widgets, to set Base, Foreground, Background and Selection color values
  • Loading branch information
midwan committed Nov 9, 2024
1 parent 265fde6 commit 0fb68c3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/guisan/widget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ namespace gcn
* @since 0.1.0
*/
static void setGlobalFont(Font* font);
static void setGlobalBaseColor(Color color);
static void setGlobalForegroundColor(Color color);
static void setGlobalBackgroundColor(Color color);
static void setGlobalSelectionColor(Color color);

/**
* Sets the font for the widget. If nullptr is passed, the global font
Expand Down
32 changes: 32 additions & 0 deletions src/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,38 @@ namespace gcn
}
}

void Widget::setGlobalBaseColor(Color color)
{
for (Widget* w : mWidgetInstances)
{
w->setBaseColor(color);
}
}

void Widget::setGlobalForegroundColor(Color color)
{
for (Widget* w : mWidgetInstances)
{
w->setForegroundColor(color);
}
}

void Widget::setGlobalBackgroundColor(Color color)
{
for (Widget* w : mWidgetInstances)
{
w->setBackgroundColor(color);
}
}

void Widget::setGlobalSelectionColor(Color color)
{
for (Widget* w : mWidgetInstances)
{
w->setSelectionColor(color);
}
}

void Widget::setFont(Font* font)
{
mCurrentFont = font;
Expand Down

0 comments on commit 0fb68c3

Please sign in to comment.