float textHorizontalMargin = 0.0f;
float iconWidth = 0.0f;
float textSize = 0.0f;
- float searchFieldMinWidth = 0.0f;
float searchBarMinHeight = 0.0f;
+ float searchBarMinWidthModeNormal = 0.0f;
FloatRectangle searchBarBounds = GetBoundsF();
_ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
GET_SHAPE_CONFIG(SEARCHBAR::ICON_HORIZONTAL_MARGIN, orientation, iconHorizontalMargin);
GET_SHAPE_CONFIG(SEARCHBAR::ICON_WIDTH, orientation, iconWidth);
GET_SHAPE_CONFIG(SEARCHBAR::TEXT_HORIZONTAL_MARGIN, orientation, textHorizontalMargin);
- GET_SHAPE_CONFIG(SEARCHBAR::SEARCH_FIELD_MIN_WIDTH, orientation, searchFieldMinWidth);
+ GET_SHAPE_CONFIG(SEARCHBAR::SEARCH_FIELD_MIN_WIDTH_NORMAL_MODE, orientation, searchBarMinWidthModeNormal);
GET_SHAPE_CONFIG(SEARCHBAR::MIN_HEIGHT, orientation, searchBarMinHeight);
float searchFieldMinHeight = searchBarMinHeight - (verticalMargin * 2.0f);
editBounds.x = horizontalMargin;
+
+ if (searchBarBounds.height < searchBarMinHeight)
+ {
+ verticalMargin = (searchBarBounds.height - searchFieldMinHeight)/2.0f;
+ if (verticalMargin < 0.0f)
+ {
+ verticalMargin = 0.0f;
+ }
+ }
+
editBounds.y = verticalMargin;
+
editBounds.width = searchBarBounds.width - (editBounds.x * 2.0f);
editBounds.height = searchBarBounds.height - (editBounds.y * 2.0f);
- editBounds.width = (editBounds.width > searchFieldMinWidth) ? editBounds.width : searchFieldMinWidth;
+ editBounds.width = (editBounds.width > searchBarMinWidthModeNormal) ? editBounds.width : searchBarMinWidthModeNormal;
editBounds.height = (editBounds.height > searchFieldMinHeight) ? editBounds.height : searchFieldMinHeight;
__pEdit = _Edit::CreateEditN();
cancelButtonBounds.x = searchBarBounds.width - cancelButtonBounds.width - buttonRightMargin;
cancelButtonBounds.y = (searchBarBounds.height - cancelButtonBounds.height)/2.0f;
- if (searchBarBounds.height < searchBarMinHeight)
- {
- cancelButtonBounds.y = buttonVerticalMargin;
- }
+ cancelButtonBounds.y = cancelButtonBounds.y < 0.0f ? 0.0f:cancelButtonBounds.y;
if (cancelButtonBounds.width < buttonMinWidth)
{
float searchBarMinHeight = 0.0f;
float buttonWidth = 0.0f;
float buttonHeight = 0.0f;
+ float cancelButtonWidth = 0.0f;
FloatRectangle cancelButtonBounds;
+ FloatRectangle editBounds;
FloatRectangle searchBarBounds = GetBoundsF();
_ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
cancelButtonBounds.height = buttonHeight;
- FloatRectangle editBounds;
-
- float cancelButtonWidth = 0;
+ float searchFieldMinHeight = searchBarMinHeight - (verticalMargin * 2.0f);
cancelButtonWidth = __pCancelButton->GetTextExtentSizeF() + __pCancelButton->GetRightTouchMarginF() + __pCancelButton->GetLeftTouchMarginF() + __pCancelButton->GetRightMarginF() + __pCancelButton->GetLeftMarginF();
editBounds.x = horizontalMargin;
- editBounds.y = verticalMargin;
+ if (searchBarBounds.height < searchBarMinHeight)
+ {
+ verticalMargin = (searchBarBounds.height - searchFieldMinHeight)/2.0f;
+ if (verticalMargin < 0.0f)
+ {
+ verticalMargin = 0.0f;
+ }
+ }
+
+ editBounds.y = verticalMargin;
editBounds.height = searchBarBounds.height - (editBounds.y * 2.0f);
- float searchFieldMinHeight = searchBarMinHeight - (verticalMargin * 2.0f);
editBounds.height = (editBounds.height > searchFieldMinHeight) ? editBounds.height : searchFieldMinHeight;
editBounds.width = searchBarBounds.width - cancelButtonWidth - horizontalMargin - buttonLeftMargin - buttonRightMargin;
cancelButtonBounds.x = editBounds.width + horizontalMargin + buttonLeftMargin;
cancelButtonBounds.y = (searchBarBounds.height - cancelButtonBounds.height)/2.0f;
- if (searchBarBounds.height < searchBarMinHeight)
- {
- cancelButtonBounds.y = buttonVerticalMargin;
- }
+ cancelButtonBounds.y = cancelButtonBounds.y < 0.0f ? 0.0f:cancelButtonBounds.y;
float remainingWidth = searchBarBounds.width - editBounds.width - horizontalMargin - buttonLeftMargin - buttonRightMargin;
{
float horizontalMargin = 0.0f;
float verticalMargin = 0.0f;
- float searchFieldMinWidth = 0.0f;
+ float searchBarMinWidthModeNormal = 0.0f;
float searchBarMinHeight = 0.0f;
_ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
GET_SHAPE_CONFIG(SEARCHBAR::HORIZONTAL_MARGIN, orientation, horizontalMargin);
GET_SHAPE_CONFIG(SEARCHBAR::VERTICAL_MARGIN, orientation, verticalMargin);
- GET_SHAPE_CONFIG(SEARCHBAR::SEARCH_FIELD_MIN_WIDTH, orientation, searchFieldMinWidth);
+ GET_SHAPE_CONFIG(SEARCHBAR::SEARCH_FIELD_MIN_WIDTH_NORMAL_MODE, orientation, searchBarMinWidthModeNormal);
GET_SHAPE_CONFIG(SEARCHBAR::MIN_HEIGHT, orientation, searchBarMinHeight);
float searchFieldMinHeight = searchBarMinHeight - (verticalMargin * 2.0f);
__searchFieldBounds.x = horizontalMargin;
+ if (__pSearchBar->GetBoundsF().height < searchBarMinHeight)
+ {
+ verticalMargin = (__pSearchBar->GetBoundsF().height - searchFieldMinHeight)/2.0f;
+ if (verticalMargin < 0.0f)
+ {
+ verticalMargin = 0.0f;
+ }
+ }
__searchFieldBounds.y = verticalMargin;
__searchFieldBounds.width = __pSearchBar->GetBoundsF().width - (horizontalMargin * 2.0f);
__searchFieldBounds.height = __pSearchBar->GetBoundsF().height - (verticalMargin * 2.0f);
- __searchFieldBounds.width = (__searchFieldBounds.width > searchFieldMinWidth) ? __searchFieldBounds.width : searchFieldMinWidth;
+ __searchFieldBounds.width = (__searchFieldBounds.width > searchBarMinWidthModeNormal) ? __searchFieldBounds.width : searchBarMinWidthModeNormal;
__searchFieldBounds.height = (__searchFieldBounds.height > searchFieldMinHeight) ? __searchFieldBounds.height : searchFieldMinHeight;
return;