image back in the corect sens and context menu in the good orientation

This commit is contained in:
Edouard Dupin 2012-07-19 22:32:21 +02:00
parent b8dcbd57a7
commit a97df32a66
3 changed files with 41 additions and 40 deletions

View File

@ -95,8 +95,8 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa
Vector2D<float> point; Vector2D<float> point;
texCoord_ts tex; texCoord_ts tex;
tex.u = texX; tex.u = texSX;
tex.v = texY; tex.v = texSY;
point.x = x; point.x = x;
point.y = y; point.y = y;
m_coord.PushBack(point); m_coord.PushBack(point);
@ -104,8 +104,8 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa
m_coordColor.PushBack(tmpColor); m_coordColor.PushBack(tmpColor);
tex.u = texSX; tex.u = texX;
tex.v = texY; tex.v = texSY;
point.x = x + w; point.x = x + w;
point.y = y; point.y = y;
m_coord.PushBack(point); m_coord.PushBack(point);
@ -113,8 +113,8 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa
m_coordColor.PushBack(tmpColor); m_coordColor.PushBack(tmpColor);
tex.u = texSX; tex.u = texX;
tex.v = texSY; tex.v = texY;
point.x = x + w; point.x = x + w;
point.y = y + h; point.y = y + h;
m_coord.PushBack(point); m_coord.PushBack(point);
@ -125,16 +125,16 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa
m_coordTex.PushBack(tex); m_coordTex.PushBack(tex);
m_coordColor.PushBack(tmpColor); m_coordColor.PushBack(tmpColor);
tex.u = texX; tex.u = texSX;
tex.v = texSY; tex.v = texY;
point.x = x; point.x = x;
point.y = y + h; point.y = y + h;
m_coord.PushBack(point); m_coord.PushBack(point);
m_coordTex.PushBack(tex); m_coordTex.PushBack(tex);
m_coordColor.PushBack(tmpColor); m_coordColor.PushBack(tmpColor);
tex.u = texX; tex.u = texSX;
tex.v = texY; tex.v = texSY;
point.x = x; point.x = x;
point.y = y; point.y = y;
m_coord.PushBack(point); m_coord.PushBack(point);

View File

@ -123,11 +123,11 @@ bool ewol::ContextMenu::CalculateSize(float availlableX, float availlableY)
{ {
case ewol::CONTEXT_MENU_MARK_TOP: case ewol::CONTEXT_MENU_MARK_TOP:
subWidgetOrigin.x = (int32_t)(m_arrowPos.x - subWidgetSize.x/2); subWidgetOrigin.x = (int32_t)(m_arrowPos.x - subWidgetSize.x/2);
subWidgetOrigin.y = (int32_t)(m_arrowPos.y + m_offset); subWidgetOrigin.y = (int32_t)(m_arrowPos.y - m_offset - subWidgetSize.y);
break; break;
case ewol::CONTEXT_MENU_MARK_BOTTOM: case ewol::CONTEXT_MENU_MARK_BOTTOM:
subWidgetOrigin.x = (int32_t)(m_arrowPos.x - subWidgetSize.x/2); subWidgetOrigin.x = (int32_t)(m_arrowPos.x - subWidgetSize.x/2);
subWidgetOrigin.y = (int32_t)(m_arrowPos.y - m_offset - subWidgetSize.y); subWidgetOrigin.y = (int32_t)(m_arrowPos.y + m_offset);
break; break;
case ewol::CONTEXT_MENU_MARK_RIGHT: case ewol::CONTEXT_MENU_MARK_RIGHT:
case ewol::CONTEXT_MENU_MARK_LEFT: case ewol::CONTEXT_MENU_MARK_LEFT:
@ -249,18 +249,6 @@ void ewol::ContextMenu::OnRegenerateDisplay(void)
switch (m_arrawBorder) switch (m_arrawBorder)
{ {
case ewol::CONTEXT_MENU_MARK_TOP: case ewol::CONTEXT_MENU_MARK_TOP:
BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y);
if (m_arrowPos.x <= tmpOrigin.x ) {
int32_t laking = m_offset - m_padding.y;
BGOObjects->SetPoint(m_arrowPos.x+laking, m_arrowPos.y+laking);
BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y+laking);
} else {
int32_t laking = m_offset - m_padding.y;
BGOObjects->SetPoint(m_arrowPos.x+laking, m_arrowPos.y+laking);
BGOObjects->SetPoint(m_arrowPos.x-laking, m_arrowPos.y+laking);
}
break;
case ewol::CONTEXT_MENU_MARK_BOTTOM:
BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y); BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y);
if (m_arrowPos.x <= tmpOrigin.x ) { if (m_arrowPos.x <= tmpOrigin.x ) {
int32_t laking = m_offset - m_padding.y; int32_t laking = m_offset - m_padding.y;
@ -272,6 +260,17 @@ void ewol::ContextMenu::OnRegenerateDisplay(void)
BGOObjects->SetPoint(m_arrowPos.x-laking, m_arrowPos.y-laking); BGOObjects->SetPoint(m_arrowPos.x-laking, m_arrowPos.y-laking);
} }
break; break;
case ewol::CONTEXT_MENU_MARK_BOTTOM:
BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y);
if (m_arrowPos.x <= tmpOrigin.x ) {
int32_t laking = m_offset - m_padding.y;
BGOObjects->SetPoint(m_arrowPos.x+laking, m_arrowPos.y+laking);
BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y+laking);
} else {
int32_t laking = m_offset - m_padding.y;
BGOObjects->SetPoint(m_arrowPos.x+laking, m_arrowPos.y+laking);
BGOObjects->SetPoint(m_arrowPos.x-laking, m_arrowPos.y+laking);
}
break; break;
default: default:
case ewol::CONTEXT_MENU_MARK_RIGHT: case ewol::CONTEXT_MENU_MARK_RIGHT:

View File

@ -216,7 +216,7 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve
Vector2D<float> tmpSize = eventFromWidget->GetSize(); Vector2D<float> tmpSize = eventFromWidget->GetSize();
// calculate the correct position // calculate the correct position
newPosition.x = tmpOri.x + tmpSize.x/2; newPosition.x = tmpOri.x + tmpSize.x/2;
newPosition.y = tmpOri.y + tmpSize.y; newPosition.y = tmpOri.y;
} }
m_widgetContextMenu->SetPositionMark(ewol::CONTEXT_MENU_MARK_TOP, newPosition ); m_widgetContextMenu->SetPositionMark(ewol::CONTEXT_MENU_MARK_TOP, newPosition );
@ -229,21 +229,23 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve
// set it in the pop-up-system : // set it in the pop-up-system :
m_widgetContextMenu->SubWidgetSet(mySizerVert); m_widgetContextMenu->SubWidgetSet(mySizerVert);
for(int32_t jjj=0; jjj<m_listElement.Size(); jjj++) { for(int32_t jjj=m_listElement.Size()-1; jjj>=0; jjj--) {
if (m_listElement[iii]->m_localId == m_listElement[jjj]->m_parentId) { if (m_listElement[iii]!=NULL) {
myButton = new ewol::Button(m_listElement[jjj]->m_label); if (m_listElement[iii]->m_localId == m_listElement[jjj]->m_parentId) {
if (NULL == myButton) { myButton = new ewol::Button(m_listElement[jjj]->m_label);
EWOL_ERROR("Allocation Error"); if (NULL == myButton) {
} else { EWOL_ERROR("Allocation Error");
// set the image if one is present ... } else {
myButton->SetImage(m_listElement[jjj]->m_image); // set the image if one is present ...
myButton->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventButtonPressed); myButton->SetImage(m_listElement[jjj]->m_image);
myButton->SetExpendX(true); myButton->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventButtonPressed);
myButton->SetFillX(true); myButton->SetExpendX(true);
myButton->SetAlignement(ewol::TEXT_ALIGN_LEFT); myButton->SetFillX(true);
// add it in the widget list myButton->SetAlignement(ewol::TEXT_ALIGN_LEFT);
mySizerVert->SubWidgetAdd(myButton); // add it in the widget list
m_listElement[jjj]->m_widgetPointer = myButton; mySizerVert->SubWidgetAdd(myButton);
m_listElement[jjj]->m_widgetPointer = myButton;
}
} }
} }
} }