#include "FUi_ControlManager.h"
#include "FUi_ResourceManager.h"
#include "FUiCtrl_Label.h"
-#include "FUi_CoordinateSystemUtils.h"
using namespace Tizen::Graphics;
using namespace Tizen::Ui;
using namespace Tizen::Base;
using namespace Tizen::Ui::Animations;
+using namespace Tizen::Base::Utility;
class GroupedContentContentProvider : public IVisualElementContentProvider
{
float balanceWidthPixels = fmod((rect.width - totalColLineWidth), columnCount);
float balanceHeightPixels = fmod((rect.height - totalRowLineHeight), rowCount);
- int additionalWidth = -1;
- int additionalHeight = -1;
int margin = 0;
-
- int width = _CoordinateSystemUtils::ConvertToInteger(balanceWidthPixels);
- int height = _CoordinateSystemUtils::ConvertToInteger(balanceHeightPixels);
+ int width = Math::Round((balanceWidthPixels + ROUNDOFF_VALUE) * 10.0f);
+ int height = Math::Round((balanceHeightPixels + ROUNDOFF_VALUE) * 10.0f);
_ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
r = GET_FIXED_VALUE_CONFIG(GROUPCONTAINER::DEFAULT_MARGIN, orientation, margin);
SysTryCatch(NID_UI_CTRL, __pCellsArray[i] != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
}
+ for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
+ {
+ for (int columnIndex = 0; columnIndex < columnCount; columnIndex++)
+ {
+ __pCellsArray[rowIndex][columnIndex].cellBounds.width = 0;
+ __pCellsArray[rowIndex][columnIndex].cellBounds.height = 0;
+ }
+ }
+
+ while (width > 0)
+ {
+ for (int columnIndex = 0; columnIndex < columnCount; columnIndex++)
+ {
+ if (width > 0)
+ {
+ for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
+ {
+ __pCellsArray[rowIndex][columnIndex].cellBounds.width += 0.1f;
+ }
+ width = width - 1;
+ }
+ }
+ }
+
+ while (height > 0)
+ {
+ for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
+ {
+ if (height > 0)
+ {
+ for (int columnIndex = 0; columnIndex < columnCount; columnIndex++)
+ {
+ __pCellsArray[rowIndex][columnIndex].cellBounds.height += 0.1f;
+ }
+ height = height - 1;
+ }
+ }
+ }
+
for (int row = 0; row < rowCount; row++)
{
for (int col = 0; col < columnCount; col++)
{
- additionalWidth = (col < width) ? 1 : 0;
- additionalHeight = (row < height) ? 1 : 0;
-
if (col == 0)
{
__pCellsArray[row][col].cellBounds.x = __lineWidth;
__pCellsArray[row][col].cellBounds.y = (__pCellsArray[row - 1][col].cellBounds.y + __pCellsArray[row - 1][col].cellBounds.height) + __lineWidth;
}
- __pCellsArray[row][col].cellBounds.width = cellWidth + additionalWidth;
- __pCellsArray[row][col].cellBounds.height = cellHeight + additionalHeight;
+ __pCellsArray[row][col].cellBounds.width += cellWidth;
+ __pCellsArray[row][col].cellBounds.height += cellHeight;
__pCellsArray[row][col].actualSize.width = __pCellsArray[row][col].cellBounds.width;
__pCellsArray[row][col].actualSize.height = __pCellsArray[row][col].cellBounds.height;
_GroupContainer::SetImpl(_GroupContainerImpl *pImpl)
{
__pGroupContainerImpl = pImpl;
+
+ return;
}
result
_GroupContainer::SetLineColor(const Color& color)
{
__lineColor = color;
+
+ return;
}
Color
return __lineColor;
}
-int
+float
_GroupContainer::GetLineWidth(void)
{
return __lineWidth;
__pCellsArray[rowIndex][columnIndex].isMerged = true;
__pCellsArray[rowIndex][columnIndex].parentCell.row = rowStartIndex;
__pCellsArray[rowIndex][columnIndex].parentCell.column = columnStartIndex;
+
+ return;
}
bool
{
__pGroupContainerPresenter->Draw();
}
+
+ return;
}
result
}
__childAttachedRowIndex = -1;
__childAttachedColumnIndex = -1;
+
+ return;
}
void
__pCellsArray[parentIndex.row][parentIndex.column].childControlPos = childNewPosition;
(const_cast<_Control&>(child)).SetPosition(childNewPosition);
}
+
+ return;
}
result
_GroupContainer::OnBoundsChanged(void)
{
__pSystemControl->SetBounds(FloatRectangle(0.0f, 0.0f, GetBoundsF().width, GetBoundsF().height), false);
+
+ return;
}
void
{
int stretchableRowCount = 0;
int stretchableColumnCount = 0;
- float stretchableWidth = 0.0f;
- float stretchableHeight = 0.0f;
+ int stretchableWidth = 0;
+ int stretchableHeight = 0;
float balanceWidthPixels = 0.0f;
float balanceHeightPixels = 0.0f;
int width = 0;
int height = 0;
+ float columnWidth[__columnCount];
+ float rowHeight[__rowCount];
for (int columnIndex = 0; columnIndex < __columnCount; columnIndex++)
{
+ columnWidth[columnIndex] = 0.0f;
+
if (__pStretchableColumnIndex[columnIndex])
{
stretchableColumnCount++;
stretchableWidth = (controlRect.width - gridRect.width) / stretchableColumnCount;
balanceWidthPixels = fmod((controlRect.width - gridRect.width), stretchableColumnCount);
- width = _CoordinateSystemUtils::ConvertToInteger(balanceWidthPixels);
+ if (balanceWidthPixels > 0)
+ {
+ width = Math::Round((balanceWidthPixels + ROUNDOFF_VALUE) * 10.0);
+ }
+ else if (balanceWidthPixels < 0)
+ {
+ width = Math::Round((balanceWidthPixels - ROUNDOFF_VALUE) * 10.0);
+ }
- for (int columnIndex = 0; columnIndex < __columnCount; columnIndex++)
+ while (width != 0)
{
- if (__pStretchableColumnIndex[columnIndex] == true)
+ for (int columnIndex = 0; columnIndex < __columnCount; columnIndex++)
{
- FloatDimension rect = __pCellsArray[0][columnIndex].actualSize;
- rect.width = rect.width + stretchableWidth;
-
- if (width > 0)
- {
- rect.width = rect.width + 1;
- width--;
- }
- else if (width < 0)
+ if (__pStretchableColumnIndex[columnIndex] == true)
{
- rect.width = rect.width - 1;
- width++;
+ if (width > 0)
+ {
+ columnWidth[columnIndex] = columnWidth[columnIndex] + 0.1f;
+
+ width = width - 1;
+ }
+ else if (width < 0)
+ {
+ columnWidth[columnIndex] = columnWidth[columnIndex] - 0.1f;
+
+ width = width + 1;
+ }
}
+ }
+ }
- if (rect.width < 0)
+ for (int columnIndex = 0; columnIndex < __columnCount; columnIndex++)
+ {
+ if (__pStretchableColumnIndex[columnIndex] == true)
+ {
+ columnWidth[columnIndex] = columnWidth[columnIndex] + __pCellsArray[0][columnIndex].actualSize.width + stretchableWidth;
+
+ if (columnWidth[columnIndex] < 0)
{
- rect.width = 0;
+ columnWidth[columnIndex] = 0;
}
- SetColumnWidth(columnIndex, rect.width);
+ SetColumnWidth(columnIndex, columnWidth[columnIndex]);
}
}
}
for (int rowIndex = 0; rowIndex < __rowCount; rowIndex++)
{
+ rowHeight[rowIndex] = 0.0f;
+
if (__pStretchableRowIndex[rowIndex])
{
stretchableRowCount++;
{
stretchableHeight = (controlRect.height - gridRect.height) / stretchableRowCount;
balanceHeightPixels = fmod((controlRect.height - gridRect.height), stretchableRowCount);
- height = _CoordinateSystemUtils::ConvertToInteger(balanceHeightPixels);
- for (int rowIndex = 0; rowIndex < __rowCount; rowIndex++)
+ if ( balanceHeightPixels > 0)
{
- if (__pStretchableRowIndex[rowIndex] == true)
- {
- FloatDimension rect = __pCellsArray[rowIndex][0].actualSize;
- rect.height = rect.height + stretchableHeight;
+ height = Math::Round((balanceHeightPixels + ROUNDOFF_VALUE) * 10.0);
+ }
+ else if (balanceHeightPixels < 0)
+ {
+ height = Math::Round((balanceHeightPixels - ROUNDOFF_VALUE) * 10.0);
+ }
- if (height > 0)
- {
- rect.height = rect.height + 1;
- height--;
- }
- else if (height < 0)
+ while (height != 0)
+ {
+ for (int rowIndex = 0; rowIndex < __rowCount; rowIndex++)
+ {
+ if (__pStretchableRowIndex[rowIndex] == true)
{
- rect.height = rect.height - 1;
- height++;
+ if (height > 0)
+ {
+ rowHeight[rowIndex] = rowHeight[rowIndex] + 0.1f;
+
+ height = height - 1;
+ }
+ else if (height < 0)
+ {
+ rowHeight[rowIndex] = rowHeight[rowIndex] - 0.1f;
+
+ height = height + 1;
+ }
}
+ }
+ }
+
+ for (int rowIndex = 0; rowIndex < __rowCount; rowIndex++)
+ {
+ if (__pStretchableRowIndex[rowIndex] == true)
+ {
+ rowHeight[rowIndex] = rowHeight[rowIndex] + __pCellsArray[rowIndex][0].actualSize.height + stretchableHeight;
- if (rect.height < 0)
+ if (rowHeight[rowIndex] < 0)
{
- rect.height = 0;
+ rowHeight[rowIndex] = 0;
}
- SetRowHeight(rowIndex, rect.height);
+ SetRowHeight(rowIndex, rowHeight[rowIndex]);
}
}
}
+
+ return;
}
FloatRectangle
#include <FBaseSysLog.h>
#include <FBaseErrorDefine.h>
#include <FGrpCanvas.h>
+#include <FGrp_BitmapImpl.h>
#include "FUiCtrl_GroupContainerPresenter.h"
#include "FUi_ResourceManager.h"
-#include <FGrp_BitmapImpl.h>
#include "FUiAnim_VisualElement.h"
+#include "FUi_CoordinateSystemUtils.h"
using namespace Tizen::Graphics;
using namespace Tizen::Ui::Animations;
result r = E_SUCCESS;
FloatRectangle gridBounds(0.0f, 0.0f, 0.0f, 0.0f);
FloatRectangle rect(0.0f, 0.0f, 0.0f, 0.0f);
+ int width = 0;
int lineAdjustPosition = 0;
int rowIndex = 0;
int columnIndex = 0;
int rows = __pGroupContainer->GetRowCount();
int columns = __pGroupContainer->GetColumnCount();
- int lineWidth = __pGroupContainer->GetLineWidth();
+ float lineWidth = __pGroupContainer->GetLineWidth();
Canvas* pCanvas = __pGroupContainer->GetVisualElement()->GetCanvasN();
_Control* pControl = __pGroupContainer->GetSystemChild();
pCanvas->SetBackgroundColor(__pGroupContainer->GetBackgroundColor());
pCanvas->Clear();
+
+ pControlCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
+ pControlCanvas->Clear();
+
pCanvas->SetLineStyle(LINE_STYLE_SOLID);
pCanvas->SetLineWidth(lineWidth);
r = GetLastResult();
pCanvas->DrawLine(FloatPoint(gridBounds.x, gridBounds.y + gridBounds.height), FloatPoint(gridBounds.x + gridBounds.width, gridBounds.y + gridBounds.height));
}
- lineAdjustPosition = ((lineWidth % 2) == 0) ? (lineWidth / 2) : ((lineWidth - 1) / 2);
+ width = _CoordinateSystemUtils::ConvertToInteger(lineWidth);
+ lineAdjustPosition = ((width % 2) == 0) ? (width / 2) : ((width - 1) / 2);
+
for (rowIndex = 0; rowIndex < rows; rowIndex++)
{
for (columnIndex = 0; columnIndex < columns; columnIndex++)
}
}
+ return;
}
void
SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
}
}
-}
+ return;
+}
}}} // Tizen::Ui::Controls