Skip to content

Commit

Permalink
Apply Guichan's changes from 063dc975e98dfc74c2565229ce175cccc70fa4dd…
Browse files Browse the repository at this point in the history
… (Apr 12th 2008)

ScrollArea::isOpaque and ScrollArea::setOpaque have been added to control if a scroll area should draw its background or not.
  • Loading branch information
Jarod42 committed Aug 22, 2024
1 parent 0bb8561 commit 543fe48
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 4 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Version 1.1.0
=============
* ScrollArea::isOpaque and ScrollArea::setOpaque have been added to
control if a scroll area should draw its background or not.
* Widget::showPart has been added to be used when a specific
part of a widget should be visible. An example is when a text
area wants a specific text part to be visible in a scroll area.
Expand Down
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* Continue rebasing from 063dc975e98dfc74c2565229ce175cccc70fa4dd
* Continue rebasing from ba5109fdd43281372247cf4259c5cf19376271ce
* Add a focus listener interface.
* Make focus apply synchronously.
* Graphics and input objects for DirectX.
Expand Down
2 changes: 1 addition & 1 deletion include/guisan/widgets/container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace gcn
/**
* Checks if the container is opaque or not.
*
* @return true if the container is opaque, false otherwise.
* @return True if the container is opaque, false otherwise.
* @see setOpaque
*/
bool isOpaque() const;
Expand Down
22 changes: 22 additions & 0 deletions include/guisan/widgets/scrollarea.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,21 @@ namespace gcn
*/
int getDownButtonScrollAmount() const;

/**
* Sets the scroll area to be opaque, that is sets the scoll area
* to display its background.
*
* @param opaque True if the scoll area should be opaque, false otherwise.
*/
void setOpaque(bool opaque);

/**
* Checks if the scroll area is opaque, that is if the scroll area
* displays its background.
*
* @return True if the scroll area is opaque, false otherwise.
*/
bool isOpaque() const;

// Inherited from BasicContainer

Expand Down Expand Up @@ -548,6 +563,13 @@ namespace gcn
* Holds the vertical markers drag offset.
*/
int mVerticalMarkerDragOffset;

/**
* True if the scroll area should be opaque
* (that is display its background),
* false otherwise.
*/
bool mOpaque;
};
}

Expand Down
20 changes: 18 additions & 2 deletions src/widgets/scrollarea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ namespace gcn
mRightButtonScrollAmount = 10;
mIsVerticalMarkerDragged = false;
mIsHorizontalMarkerDragged =false;
mOpaque = true;

addMouseListener(this);
}
Expand All @@ -103,6 +104,7 @@ namespace gcn
mRightButtonScrollAmount = 10;
mIsVerticalMarkerDragged = false;
mIsHorizontalMarkerDragged =false;
mOpaque = true;

setContent(content);
addMouseListener(this);
Expand All @@ -125,6 +127,7 @@ namespace gcn
mRightButtonScrollAmount = 10;
mIsVerticalMarkerDragged = false;
mIsHorizontalMarkerDragged =false;
mOpaque = true;

setContent(content);
addMouseListener(this);
Expand Down Expand Up @@ -498,8 +501,11 @@ namespace gcn

void ScrollArea::drawBackground(Graphics *graphics)
{
graphics->setColor(getBackgroundColor());
graphics->fillRectangle(getChildrenArea());
if (isOpaque())
{
graphics->setColor(getBackgroundColor());
graphics->fillRectangle(getChildrenArea());
}
}

void ScrollArea::drawUpButton(Graphics* graphics)
Expand Down Expand Up @@ -1241,6 +1247,16 @@ namespace gcn
{
return mDownButtonScrollAmount;
}

void ScrollArea::setOpaque(bool opaque)
{
mOpaque = opaque;
}

bool ScrollArea::isOpaque() const
{
return mOpaque;
}
}

/*
Expand Down

0 comments on commit 543fe48

Please sign in to comment.