javauis/lcdui_akn/lcdui/inc/CMIDFormRow.h
branchRCL_3
changeset 14 04becd199f91
child 24 6c158198356e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/lcdui_akn/lcdui/inc/CMIDFormRow.h	Tue Apr 27 16:30:29 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implements the Form LCDUI component.
+*
+*/
+
+
+#ifndef CMIDFORMROW_H
+#define CMIDFORMROW_H
+
+// CCoeControl inheritance in CMIDFormRow class
+// and API from CCoeControl
+#include <coecntrl.h>
+
+#include <lcdui.h>
+
+class CMIDForm;
+class CMIDControlItem;
+
+
+/**
+ * A row in a form. Manages form items that have been assigned to this
+ * row by the form.
+ *
+ * @see CMIDForm, CMIDControlItem
+ */
+NONSHARABLE_CLASS(CMIDFormRow) : public CCoeControl
+{
+public:
+    static CMIDFormRow* NewL(CMIDForm& aForm);
+    ~CMIDFormRow();
+
+public: // From CCoeControl
+    TInt CountComponentControls() const;
+    CCoeControl* ComponentControl(TInt aIndex) const;
+    virtual void SizeChanged();
+    virtual TSize MinimumSize();
+
+public: // interface to CMIDForm
+    void AppendL(CMIDControlItem* aItem);
+    void SetAlignment(MMIDItem::TLayout aAlignment);
+    void SizeItemsL();
+    TInt NumItems();
+    TInt Find(const CMIDControlItem* aItem) const;
+    CMIDControlItem* Item(TInt aIndex);
+    TBool HasFocusableItemOnOrAboveScreen();
+    TBool HasFocusableItemOnOrBelowScreen();
+    CMIDControlItem* FirstFocusableItemOnScreen();
+    CMIDControlItem* FirstFocusableItem();
+    CMIDControlItem* LastFocusableItem();
+    TBool RemoveItemIfExists(CMIDControlItem& aItem);
+    TInt CurrentWidth();
+
+    TBool HasNonSpacerItems() const;
+
+    inline void SetEmptyRowSize(const TSize& aEmptyRowSize);
+    inline const TSize& EmptyRowSize() const;
+
+private:
+    CMIDFormRow(CMIDForm& aForm);
+    void ConstructL();
+
+private:
+    CMIDForm& iForm;
+    MMIDItem::TLayout iAlignment; // ELeft, ERight, or ECenter
+    RArray<CMIDControlItem*> iItems;
+    TSize  iEmptyRowSize; // size used for empty rows
+    TInt iCurrentWidth;             // used when adding items to the row. Keeps track of the total width of items added to row
+};
+
+
+inline void CMIDFormRow::SetEmptyRowSize(const TSize& aEmptyRowSize)
+{
+    iEmptyRowSize = aEmptyRowSize;
+}
+
+inline const TSize& CMIDFormRow:: EmptyRowSize() const
+{
+    return iEmptyRowSize;
+}
+
+#endif // CMIDFORMROW_H