Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabbed area #65

Merged
merged 3 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* Continue rebasing from 5e37d507e8345c425131c2ade8e6823cacb74035
* Continue rebasing from f0e7bcb9b32c2fddfcc8c76c16cbd06e136caa07
* Add a focus listener interface.
* Make focus apply synchronously.
* Graphics and input objects for DirectX.
Expand Down
4 changes: 2 additions & 2 deletions include/guisan/widgets/tabbedarea.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ namespace gcn

virtual void draw(Graphics *graphics);

virtual void logic();

void setWidth(int width);

void setHeight(int height);
Expand All @@ -224,6 +222,8 @@ namespace gcn

void setDimension(const Rectangle& dimension);

void setBaseColor(const Color& color);

// Inherited from ActionListener

void action(const ActionEvent& actionEvent);
Expand Down
46 changes: 37 additions & 9 deletions src/widgets/tabbedarea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,6 @@ namespace gcn
drawChildren(graphics);
}

void TabbedArea::logic()
{
}

void TabbedArea::adjustSize()
{
int maxTabHeight = 0;
Expand Down Expand Up @@ -363,26 +359,51 @@ namespace gcn

void TabbedArea::setWidth(int width)
{
Widget::setWidth(width);
// This may seem odd, but we want the TabbedArea to adjust
// its size properly before we call Widget::setWidth as
// Widget::setWidth might distribute a resize event.
gcn::Rectangle dim = mDimension;
mDimension.width = width;
adjustSize();
mDimension = dim;
Widget::setWidth(width);
}

void TabbedArea::setHeight(int height)
{
Widget::setHeight(height);
// This may seem odd, but we want the TabbedArea to adjust
// its size properly before we call Widget::setHeight as
// Widget::setHeight might distribute a resize event.
gcn::Rectangle dim = mDimension;
mDimension.height = height;
adjustSize();
mDimension = dim;
Widget::setHeight(height);
}

void TabbedArea::setSize(int width, int height)
{
Widget::setSize(width, height);
// This may seem odd, but we want the TabbedArea to adjust
// its size properly before we call Widget::setSize as
// Widget::setSize might distribute a resize event.
gcn::Rectangle dim = mDimension;
mDimension.width = width;
mDimension.height = height;
adjustSize();
mDimension = dim;
Widget::setSize(width, height);
}

void TabbedArea::setDimension(const Rectangle& dimension)
{
Widget::setDimension(dimension);
// This may seem odd, but we want the TabbedArea to adjust
// it's size properly before we call Widget::setDimension as
// Widget::setDimension might distribute a resize event.
gcn::Rectangle dim = mDimension;
mDimension = dimension;
adjustSize();
mDimension = dim;
Widget::setDimension(dimension);
}

void TabbedArea::keyPressed(KeyEvent& keyEvent)
Expand Down Expand Up @@ -480,4 +501,11 @@ namespace gcn

setSelectedTab(tab);
}
}

void TabbedArea::setBaseColor(const Color& color)
{
Widget::setBaseColor(color);
mWidgetContainer->setBaseColor(color);
mTabContainer->setBaseColor(color);
}
} // namespace gcn