Skip to content

Commit

Permalink
Widgets|libappfw: Added utility methods for Margins
Browse files Browse the repository at this point in the history
Setting left/right or top/bottom margins at once.
  • Loading branch information
skyjake committed Jan 29, 2016
1 parent ae4322d commit 1e65efd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions doomsday/sdk/libappfw/include/de/framework/margins.h
Expand Up @@ -45,6 +45,8 @@ class LIBAPPFW_PUBLIC Margins
Margins &setRight (DotPath const &rightMarginId);
Margins &setTop (DotPath const &topMarginId);
Margins &setBottom(DotPath const &bottomMarginId);
Margins &setLeftRight(DotPath const &marginId);
Margins &setTopBottom(DotPath const &marginId);
Margins &set (ui::Direction dir, DotPath const &marginId);
Margins &set (DotPath const &marginId);

Expand Down
Expand Up @@ -26,7 +26,7 @@ namespace de {
/**
* Scrollable area.
*
* Provides a RuleRectangle where child widgets can be placedBase class for widgets
* Provides a RuleRectangle where child widgets can be placed.
*
* ScrollAreaWidget does not control its own position or size. The user must
* define its rectangle. The content rule rectangle is defined in relation to
Expand Down
12 changes: 11 additions & 1 deletion doomsday/sdk/libappfw/src/margins.cpp
Expand Up @@ -13,7 +13,7 @@
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details. You should have received a copy of
* the GNU Lesser General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
* http://www.gnu.org/licenses</small>
*/

#include "de/ui/Margins"
Expand Down Expand Up @@ -156,6 +156,16 @@ Margins &Margins::setRight(DotPath const &rightMarginId)
return set(ui::Right, rightMarginId);
}

Margins &Margins::setLeftRight(DotPath const &marginId)
{
return set(ui::Left, marginId).set(ui::Right, marginId);
}

Margins &Margins::setTopBottom(DotPath const &marginId)
{
return set(ui::Up, marginId).set(ui::Down, marginId);
}

Margins &Margins::setTop(DotPath const &topMarginId)
{
return set(ui::Up, topMarginId);
Expand Down

0 comments on commit 1e65efd

Please sign in to comment.