Skip to content

Commit

Permalink
libcommon|Added: Menu object flags for fixed position and layout offset
Browse files Browse the repository at this point in the history
The MNF_POSITION_FIXED flag causes the dynamic layout algorithm to
skip the object and just apply the predefined fixed position for it.

The MNF_LAYOUT_OFFSET flag causes the dynamic layout algorithm to
apply an extra offset to the dynamic layout origin when it encounters the
object.
  • Loading branch information
skyjake committed Jul 3, 2012
1 parent d9cf2f2 commit 510885d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
14 changes: 8 additions & 6 deletions doomsday/plugins/common/include/hu_lib.h
Expand Up @@ -75,13 +75,15 @@ typedef enum {
*/
///@{
#define MNF_HIDDEN 0x1
#define MNF_DISABLED 0x2 // Can't be interacted with.
#define MNF_PAUSED 0x4 // Ticker not called.
#define MNF_DISABLED 0x2 ///< Can't be interacted with.
#define MNF_PAUSED 0x4 ///< Ticker not called.
#define MNF_CLICKED 0x8
#define MNF_ACTIVE 0x10 // Object active.
#define MNF_FOCUS 0x20 // Has focus.
#define MNF_NO_FOCUS 0x40 // Can't receive focus.
#define MNF_DEFAULT 0x80 // Has focus by default.
#define MNF_ACTIVE 0x10 ///< Object active.
#define MNF_FOCUS 0x20 ///< Has focus.
#define MNF_NO_FOCUS 0x40 ///< Can't receive focus.
#define MNF_DEFAULT 0x80 ///< Has focus by default.
#define MNF_POSITION_FIXED 0x100 ///< XY position is fixed and predefined; automatic layout does not apply.
#define MNF_LAYOUT_OFFSET 0x200 ///< Predefined XY position is applied to the dynamic layout origin.
//#define MNF_LEFT_ALIGN 0x100
//#define MNF_FADE_AWAY 0x200 // Fade UI away while the control is active.
//#define MNF_NEVER_FADE 0x400
Expand Down
19 changes: 19 additions & 0 deletions doomsday/plugins/common/src/hu_lib.c
Expand Up @@ -868,6 +868,25 @@ static void applyPageLayout(mn_page_t* page)
continue;
}

// If the object has a fixed position, we will ignore it while doing
// dynamic layout.
if(MNObject_Flags(ob) & MNF_POSITION_FIXED)
{
Rect_SetXY(ob->_geometry, ob->_origin.x, ob->_origin.y);
Rect_Unite(page->geometry, ob->_geometry);

// To the next object.
i += 1;
continue;
}

// An additional offset requested?
if(MNObject_Flags(ob) & MNF_LAYOUT_OFFSET)
{
origin.x += ob->_origin.x;
origin.y += ob->_origin.y;
}

Rect_SetXY(ob->_geometry, origin.x, origin.y);

// Orient label plus button/inline-list/textual-slider pairs about a
Expand Down

0 comments on commit 510885d

Please sign in to comment.