summaryrefslogtreecommitdiff
path: root/project/src/ExpandableEditAreaForm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'project/src/ExpandableEditAreaForm.cpp')
-rw-r--r--project/src/ExpandableEditAreaForm.cpp45
1 files changed, 33 insertions, 12 deletions
diff --git a/project/src/ExpandableEditAreaForm.cpp b/project/src/ExpandableEditAreaForm.cpp
index 5fd0bc0..adfb575 100644
--- a/project/src/ExpandableEditAreaForm.cpp
+++ b/project/src/ExpandableEditAreaForm.cpp
@@ -102,6 +102,7 @@ ExpandableEditAreaForm::OnActionPerformed(const Control& source, int actionId)
__pExpandableEdit->SetSize(clientArea.width - EXPANDABLEEDITAREA_RIGHT_MARGIN, EXPANDABLEEDITAREA_HEIGHT);
__pExpandableEditToken->SetSize(clientArea.width - EXPANDABLEEDITAREA_RIGHT_MARGIN, EXPANDABLEEDITAREA_HEIGHT);
__prevBounds = FloatRectangle(15.0f, 15.0f, clientArea.width - EXPANDABLEEDITAREA_RIGHT_MARGIN, EXPANDABLEEDITAREA_HEIGHT);
+ __prevBoundsToken = FloatRectangle(15.0f, 15.0f, clientArea.width - EXPANDABLEEDITAREA_RIGHT_MARGIN, EXPANDABLEEDITAREA_HEIGHT);
__pLabel->SetSize(clientArea.width - LEFT_MARGIN - RIGHT_MARGIN, clientArea.height - PANEL_HEIGHT - TOP_MARGIN - BOTTOM_MARGIN);
__pScrollPanel->SetBounds(0.0f, 0.0f, clientArea.width, clientArea.height - __pPanel->GetSizeF().height);
}
@@ -113,11 +114,12 @@ ExpandableEditAreaForm::OnActionPerformed(const Control& source, int actionId)
__pExpandableEdit->SetShowState(true);
__pExpandableEditToken->SetShowState(false);
__pExpandableEdit->SetFocus();
+ __pButton->SetEnabled(true);
FloatRectangle newBounds = __pExpandableEdit->GetBoundsF();
FloatRectangle prePanelBounds = __pPanel->GetBoundsF();
- __pPanel->SetBounds(FloatRectangle(prePanelBounds.x, prePanelBounds.y - (newBounds.height - __prevBounds.height), prePanelBounds.width,
- prePanelBounds.height + (newBounds.height - __prevBounds.height)));
+ __pPanel->SetBounds(FloatRectangle(prePanelBounds.x, prePanelBounds.y - (newBounds.height - __prevBoundsToken.height), prePanelBounds.width,
+ prePanelBounds.height + (newBounds.height - __prevBoundsToken.height)));
__prevBounds = __pExpandableEdit->GetBoundsF();
FloatRectangle labelArea = GetClientAreaBoundsF();
@@ -132,12 +134,13 @@ ExpandableEditAreaForm::OnActionPerformed(const Control& source, int actionId)
__pExpandableEdit->SetShowState(false);
__pExpandableEditToken->SetShowState(true);
__pExpandableEditToken->SetFocus();
+ __pButton->SetEnabled(false);
FloatRectangle newBounds = __pExpandableEditToken->GetBoundsF();
FloatRectangle prePanelBounds = __pPanel->GetBoundsF();
__pPanel->SetBounds(FloatRectangle(prePanelBounds.x, prePanelBounds.y - (newBounds.height - __prevBounds.height), prePanelBounds.width,
prePanelBounds.height + (newBounds.height - __prevBounds.height)));
- __prevBounds = __pExpandableEditToken->GetBoundsF();
+ __prevBoundsToken = __pExpandableEditToken->GetBoundsF();
FloatRectangle labelArea = GetClientAreaBoundsF();
prePanelBounds = __pPanel->GetBoundsF();
@@ -216,8 +219,9 @@ ExpandableEditAreaForm::LayoutContent(void)
__pExpandableEdit->SetFocus();
__pExpandableEdit->ShowKeypad();
+ __prevBoundsToken = FloatRectangle(15.0f, 15.0f, clientArea.width - EXPANDABLEEDITAREA_RIGHT_MARGIN, EXPANDABLEEDITAREA_HEIGHT);
__pExpandableEditToken = new (std::nothrow) ExpandableEditArea();
- __pExpandableEditToken->Construct(__prevBounds, EXPANDABLE_EDIT_AREA_STYLE_TOKEN, EXPANDABLE_EDIT_AREA_TITLE_STYLE_NONE, EXPANDABLE_LINE_MAX);
+ __pExpandableEditToken->Construct(__prevBoundsToken, EXPANDABLE_EDIT_AREA_STYLE_TOKEN, EXPANDABLE_EDIT_AREA_TITLE_STYLE_NONE, EXPANDABLE_LINE_MAX);
__pExpandableEditToken->SetMargin(EDIT_MARGIN_TYPE_VERTICAL, 5.0f);
__pExpandableEditToken->AddKeypadEventListener(*this);
__pExpandableEditToken->AddExpandableEditAreaEventListener(*this);
@@ -274,10 +278,18 @@ ExpandableEditAreaForm::OnExpandableEditAreaLineAdded(ExpandableEditArea& source
{
FloatRectangle newBounds = source.GetBoundsF();
FloatRectangle prePanelBounds = __pPanel->GetBoundsF();
- __pPanel->SetBounds(FloatRectangle(prePanelBounds.x, prePanelBounds.y - (newBounds.height - __prevBounds.height), prePanelBounds.width,
- prePanelBounds.height + (newBounds.height - __prevBounds.height)));
- __prevBounds = source.GetBoundsF();
-
+ if(source.IsTokenEditModeEnabled())
+ {
+ __pPanel->SetBounds(FloatRectangle(prePanelBounds.x, prePanelBounds.y - (newBounds.height - __prevBoundsToken.height), prePanelBounds.width,
+ prePanelBounds.height + (newBounds.height - __prevBoundsToken.height)));
+ __prevBoundsToken = source.GetBoundsF();
+ }
+ else
+ {
+ __pPanel->SetBounds(FloatRectangle(prePanelBounds.x, prePanelBounds.y - (newBounds.height - __prevBounds.height), prePanelBounds.width,
+ prePanelBounds.height + (newBounds.height - __prevBounds.height)));
+ __prevBounds = source.GetBoundsF();
+ }
FloatRectangle labelArea = GetClientAreaBoundsF();
__pScrollPanel->SetBounds(0.0f, 0.0f, labelArea.width, labelArea.height - __pPanel->GetSizeF().height);
prePanelBounds = __pPanel->GetBoundsF();
@@ -290,9 +302,18 @@ ExpandableEditAreaForm::OnExpandableEditAreaLineRemoved(ExpandableEditArea& sour
{
FloatRectangle newBounds = source.GetBoundsF();
FloatRectangle prePanelBounds = __pPanel->GetBoundsF();
- __pPanel->SetBounds(FloatRectangle(prePanelBounds.x, prePanelBounds.y + (__prevBounds.height - newBounds.height), prePanelBounds.width,
- prePanelBounds.height - (__prevBounds.height - newBounds.height)));
- __prevBounds = source.GetBoundsF();
+ if(source.IsTokenEditModeEnabled())
+ {
+ __pPanel->SetBounds(FloatRectangle(prePanelBounds.x, prePanelBounds.y + (__prevBoundsToken.height - newBounds.height), prePanelBounds.width,
+ prePanelBounds.height - (__prevBoundsToken.height - newBounds.height)));
+ __prevBoundsToken = source.GetBoundsF();
+ }
+ else
+ {
+ __pPanel->SetBounds(FloatRectangle(prePanelBounds.x, prePanelBounds.y + (__prevBounds.height - newBounds.height), prePanelBounds.width,
+ prePanelBounds.height - (__prevBounds.height - newBounds.height)));
+ __prevBounds = source.GetBoundsF();
+ }
FloatRectangle labelArea = GetClientAreaBoundsF();
__pScrollPanel->SetBounds(0.0f, 0.0f, labelArea.width, labelArea.height - __pPanel->GetSizeF().height);
@@ -309,7 +330,7 @@ ExpandableEditAreaForm::OnOrientationChanged(const Control& source, OrientationS
__pPanel->SetSize(clientArea.width, __pPanel->GetBoundsF().height);
__pPanel->SetPosition(0.0f, clientArea.height - __pPanel->GetBoundsF().height);
__pExpandableEdit->SetSize(clientArea.width - EXPANDABLEEDITAREA_RIGHT_MARGIN, __prevBounds.height);
- __pExpandableEditToken->SetSize(clientArea.width - EXPANDABLEEDITAREA_RIGHT_MARGIN, EXPANDABLEEDITAREA_HEIGHT);
+ __pExpandableEditToken->SetSize(clientArea.width - EXPANDABLEEDITAREA_RIGHT_MARGIN, __prevBoundsToken.height);
__pLabel->SetSize(clientArea.width - LEFT_MARGIN - RIGHT_MARGIN, clientArea.height - PANEL_HEIGHT - TOP_MARGIN - BOTTOM_MARGIN);
__pButton->SetBounds(FloatRectangle(clientArea.width - 147.0f, 15.0f, 129.0f, 90.0f));
Invalidate(true);