add texture color and set widget hideable
This commit is contained in:
parent
67c039f8d6
commit
2c8cc56816
@ -63,14 +63,17 @@ void ewol::OObject2DTextured::Draw(void)
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
//EWOL_WARNING("Draw with texture : " << m_textureId << " ==> ogl=" << ewol::texture::GetGLID(m_textureId));
|
||||
glBindTexture(GL_TEXTURE_2D, ewol::texture::GetGLID(m_textureId));
|
||||
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
|
||||
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
|
||||
glEnableClientState( GL_COLOR_ARRAY ); // Enable Color Arrays
|
||||
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] );
|
||||
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
|
||||
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
|
||||
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
|
||||
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
|
||||
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
||||
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
|
||||
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
|
||||
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
|
||||
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
@ -78,9 +81,15 @@ void ewol::OObject2DTextured::Clear(void)
|
||||
{
|
||||
m_coord.Clear();
|
||||
m_coordTex.Clear();
|
||||
m_coordColor.Clear();
|
||||
}
|
||||
|
||||
void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, float texX, float texY, float texSX, float texSY)
|
||||
void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, color_ts tmpColor)
|
||||
{
|
||||
Rectangle(x, y, w, h, 0.0, 0.0, 1.0, 1.0, tmpColor);
|
||||
}
|
||||
|
||||
void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, float texX, float texY, float texSX, float texSY, color_ts tmpColor)
|
||||
{
|
||||
//EWOL_DEBUG("Add rectangle : ...");
|
||||
Vector2D<float> point;
|
||||
@ -92,6 +101,7 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa
|
||||
point.y = y;
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(tmpColor);
|
||||
|
||||
|
||||
tex.u = texSX;
|
||||
@ -100,6 +110,7 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa
|
||||
point.y = y;
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(tmpColor);
|
||||
|
||||
|
||||
tex.u = texSX;
|
||||
@ -108,9 +119,11 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa
|
||||
point.y = y + h;
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(tmpColor);
|
||||
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(tmpColor);
|
||||
|
||||
tex.u = texX;
|
||||
tex.v = texSY;
|
||||
@ -118,6 +131,7 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa
|
||||
point.y = y + h;
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(tmpColor);
|
||||
|
||||
tex.u = texX;
|
||||
tex.v = texY;
|
||||
@ -125,4 +139,5 @@ void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, floa
|
||||
point.y = y;
|
||||
m_coord.PushBack(point);
|
||||
m_coordTex.PushBack(tex);
|
||||
m_coordColor.PushBack(tmpColor);
|
||||
}
|
||||
|
@ -37,11 +37,13 @@ namespace ewol {
|
||||
public:
|
||||
virtual void Draw(void);
|
||||
void Clear(void);
|
||||
void Rectangle(float x, float y, float w, float h, float texX=0.0, float texY=0.0, float texSX=1.0, float texSY=1.0);
|
||||
void Rectangle(float x, float y, float w, float h, float texX=0.0, float texY=0.0, float texSX=1.0, float texSY=1.0, color_ts tmpColor=0xFFFFFFFF);
|
||||
void Rectangle(float x, float y, float w, float h, color_ts tmpColor);
|
||||
protected:
|
||||
int32_t m_textureId; //!< texture internal ID
|
||||
int32_t m_textureId; //!< texture internal ID
|
||||
etk::VectorType<Vector2D<float> > m_coord; //!< internal coord of the object
|
||||
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||
etk::VectorType<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
|
||||
etk::VectorType<color_ts> m_coordColor; //!< internal color of the different point
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -101,6 +101,9 @@ ewol::Widget::Widget(void)
|
||||
SetFillY();
|
||||
m_canFocus = false;
|
||||
m_hasFocus = false;
|
||||
for(int32_t iii=0 ; iii<NB_BOUBLE_BUFFER ; iii++) {
|
||||
m_hide[iii] = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -141,6 +144,33 @@ const char * const ewol::Widget::GetObjectType(void)
|
||||
return ewol::TYPE_EOBJECT_WIDGET;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the widget hidden
|
||||
* @param ---
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::Widget::Hide(void)
|
||||
{
|
||||
m_hide[m_currentCreateId] = true;
|
||||
MarkToReedraw();
|
||||
ewol::RequestUpdateSize();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the widget visible
|
||||
* @param ---
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::Widget::Show(void)
|
||||
{
|
||||
m_hide[m_currentCreateId] = false;
|
||||
MarkToReedraw();
|
||||
ewol::RequestUpdateSize();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief This will be equivalent at the destructor @ref ~Widget
|
||||
* @note this fuction "mark" the widget as removed an inform the widget manager that the widget has been removed by the user.
|
||||
@ -181,6 +211,8 @@ bool ewol::Widget::CalculateSize(float availlableX, float availlableY)
|
||||
void ewol::Widget::OnFlipFlopEvent(void)
|
||||
{
|
||||
if (true == m_needFlipFlop) {
|
||||
bool save = m_hide[m_currentCreateId];
|
||||
|
||||
m_currentDrawId++;
|
||||
if (NB_BOUBLE_BUFFER<=m_currentDrawId) {
|
||||
m_currentDrawId = 0;
|
||||
@ -190,6 +222,8 @@ void ewol::Widget::OnFlipFlopEvent(void)
|
||||
m_currentCreateId = 0;
|
||||
}
|
||||
m_needFlipFlop = false;
|
||||
|
||||
m_hide[m_currentCreateId] = save;
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,6 +292,10 @@ void ewol::Widget::KeepFocus(void)
|
||||
*/
|
||||
void ewol::Widget::GenDraw(void)
|
||||
{
|
||||
if (true==m_hide[m_currentDrawId]){
|
||||
// widget is hidden ...
|
||||
return;
|
||||
}
|
||||
glPushMatrix();
|
||||
// here we invert the reference of the standard OpenGl view because the reference in the common display is Top left and not buttom left
|
||||
glViewport( m_origin.x,
|
||||
|
@ -32,7 +32,6 @@
|
||||
namespace ewol {
|
||||
class Widget;
|
||||
};
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/VectorType.h>
|
||||
#include <ewol/Debug.h>
|
||||
@ -144,6 +143,8 @@ namespace ewol {
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
// -- Widget Size:
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
private:
|
||||
bool m_hide[NB_BOUBLE_BUFFER]; //!< hide a widget on the display
|
||||
protected:
|
||||
// internal element calculated by the system
|
||||
Vector2D<float> m_origin; //!< internal ... I do not really known how i can use it ...
|
||||
@ -206,13 +207,13 @@ namespace ewol {
|
||||
* @param ---
|
||||
* @return re size requested
|
||||
*/
|
||||
Vector2D<float> GetMinSize(void) { return m_minSize; };
|
||||
Vector2D<float> GetMinSize(void) { if (false==IsHide()) { return m_minSize; } return Vector2D<float>(0,0); };
|
||||
/**
|
||||
* @brief Get the widget size
|
||||
* @param ---
|
||||
* @return Requested size
|
||||
*/
|
||||
Vector2D<float> GetSize(void) { return m_size; };
|
||||
Vector2D<float> GetSize(void) { if (false==IsHide()) { return m_size; } return Vector2D<float>(0,0); };
|
||||
/**
|
||||
* @brief Set the horizontal expend capacity
|
||||
* @param[in] newExpend new Expend state
|
||||
@ -224,7 +225,7 @@ namespace ewol {
|
||||
* @param ---
|
||||
* @return boolean repensent the capacity to expend
|
||||
*/
|
||||
virtual bool CanExpentX(void) { return m_userExpendX; };
|
||||
virtual bool CanExpentX(void) { if (false==IsHide()) { return m_userExpendX; } return false; };
|
||||
/**
|
||||
* @brief Set the vertical expend capacity
|
||||
* @param[in] newExpend new Expend state
|
||||
@ -236,7 +237,7 @@ namespace ewol {
|
||||
* @param ---
|
||||
* @return boolean repensent the capacity to expend
|
||||
*/
|
||||
virtual bool CanExpentY(void) { return m_userExpendY; };
|
||||
virtual bool CanExpentY(void) { if (false==IsHide()) { return m_userExpendY; } return false; };
|
||||
/**
|
||||
* @brief Set the horizontal filling capacity
|
||||
* @param[in] newFill new fill state
|
||||
@ -261,6 +262,25 @@ namespace ewol {
|
||||
* @return boolean repensent the capacity to vertical filling
|
||||
*/
|
||||
bool CanFillY(void) { return m_userFillY; };
|
||||
/**
|
||||
* @brief Set the widget hidden
|
||||
* @param ---
|
||||
* @return ---
|
||||
*/
|
||||
void Hide(void);
|
||||
/**
|
||||
* @brief Set the widget visible
|
||||
* @param ---
|
||||
* @return ---
|
||||
*/
|
||||
void Show(void);
|
||||
/**
|
||||
* @brief Get the visibility of the widget
|
||||
* @param ---
|
||||
* @return true: if the widget is hiden, false: it is visible
|
||||
*/
|
||||
bool IsHide(void) { return m_hide[m_currentCreateId]; };
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
// -- Focus Area
|
||||
@ -340,7 +360,7 @@ namespace ewol {
|
||||
* @return NULL No widget found
|
||||
* @return pointer on the widget found
|
||||
*/
|
||||
virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos) { return this; };
|
||||
virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos) { if (false==IsHide()) { return this; } return NULL; };
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
@ -405,6 +425,12 @@ namespace ewol {
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnFlipFlopEvent(void);
|
||||
/**
|
||||
* @brief Request a flip-flop of the double buffer
|
||||
* @param ---
|
||||
* @return ---
|
||||
*/
|
||||
void NeedFlipFlop(void) { m_needFlipFlop = true; };
|
||||
public:
|
||||
/**
|
||||
* @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...])
|
||||
|
@ -49,6 +49,7 @@ static pthread_attr_t androidJniThreadAttr;
|
||||
enum {
|
||||
THREAD_INIT,
|
||||
THREAD_UN_INIT,
|
||||
THREAD_RECALCULATE_SIZE,
|
||||
THREAD_RESIZE,
|
||||
THREAD_HIDE,
|
||||
THREAD_SHOW,
|
||||
@ -138,6 +139,9 @@ static void* BaseAppEntry(void* param)
|
||||
EWOL_DEBUG("Receive MSG : THREAD_UN_INIT");
|
||||
requestEndProcessing = true;
|
||||
break;
|
||||
case THREAD_RECALCULATE_SIZE:
|
||||
UpdateGuiSize();
|
||||
break;
|
||||
case THREAD_RESIZE:
|
||||
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE");
|
||||
{
|
||||
@ -268,59 +272,14 @@ void EWOL_SystemStart(void)
|
||||
pthread_attr_setdetachstate(&androidJniThreadAttr, PTHREAD_CREATE_JOINABLE);
|
||||
//pthread_attr_setdetachstate(&androidJniThreadAttr, PTHREAD_CREATE_DETACHED);
|
||||
//pthread_attr_setscope( &androidJniThreadAttr, PTHREAD_SCOPE_SYSTEM);
|
||||
// note android does not permit to change the thread priority ...
|
||||
/*
|
||||
#ifdef __PLATFORM__Linux
|
||||
// try to set prio :
|
||||
struct sched_param pr;
|
||||
int policy;
|
||||
pr.sched_priority = 20;
|
||||
sched_setscheduler(getpid(), SCHED_RR, &pr);
|
||||
|
||||
pthread_setschedparam(pthread_self(), SCHED_RR, &pr);
|
||||
|
||||
|
||||
pthread_getschedparam(pthread_self(), &policy, &pr);
|
||||
EWOL_INFO("Thread <GUI> priority : " << pr.sched_priority);
|
||||
if (policy == SCHED_RR) {
|
||||
EWOL_INFO("Thread <GUI> policy: SCHED_RR");
|
||||
} else if (policy == SCHED_FIFO) {
|
||||
EWOL_INFO("Thread <GUI> policy: SCHED_FIFO");
|
||||
} else if (policy == SCHED_OTHER) {
|
||||
EWOL_INFO("Thread <GUI> policy: SCHED_OTHER");
|
||||
} else {
|
||||
EWOL_INFO("Thread <GUI> policy: ???");
|
||||
}
|
||||
|
||||
pr.sched_priority +=5;
|
||||
EWOL_INFO("Thread <BASIC> priority : " << pr.sched_priority << " (try to set)");
|
||||
pthread_attr_setschedpolicy(&androidJniThreadAttr, policy);
|
||||
pthread_attr_setschedparam(&androidJniThreadAttr, &pr);
|
||||
#endif
|
||||
*/
|
||||
pthread_setname_np(androidJniThread, "ewol_basic_thread");
|
||||
pthread_create(&androidJniThread, &androidJniThreadAttr, BaseAppEntry, NULL);
|
||||
/*
|
||||
#ifdef __PLATFORM__Linux
|
||||
pthread_setschedparam(androidJniThread, SCHED_RR, &pr);
|
||||
pthread_getschedparam(androidJniThread, &policy, &pr);
|
||||
EWOL_INFO("Thread <BASIC> priority : " << pr.sched_priority << " (is really set)");
|
||||
if (policy == SCHED_RR) {
|
||||
EWOL_INFO("Thread <BASIC> policy: SCHED_RR");
|
||||
} else if (policy == SCHED_FIFO) {
|
||||
EWOL_INFO("Thread <BASIC> policy: SCHED_FIFO");
|
||||
} else if (policy == SCHED_OTHER) {
|
||||
EWOL_INFO("Thread <BASIC> policy: SCHED_OTHER");
|
||||
} else {
|
||||
EWOL_INFO("Thread <BASIC> policy: ???");
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
//pthread_create(&androidJniThread, NULL, BaseAppEntry, NULL);
|
||||
isGlobalSystemInit = true;
|
||||
EWOL_DEBUG("Send Init message to the thread");
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_INIT, ewol::threadMsg::MSG_PRIO_REAL_TIME);
|
||||
EWOL_DEBUG("end basic init");
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_RECALCULATE_SIZE, ewol::threadMsg::MSG_PRIO_MEDIUM);
|
||||
}
|
||||
}
|
||||
|
||||
@ -337,6 +296,13 @@ void EWOL_SystemStop(void)
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::RequestUpdateSize(void)
|
||||
{
|
||||
if (true == isGlobalSystemInit) {
|
||||
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_RECALCULATE_SIZE, ewol::threadMsg::MSG_PRIO_MEDIUM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void EWOL_ThreadResize(int w, int h )
|
||||
|
@ -58,15 +58,19 @@ void ewol::PopUpWidgetPush(ewol::Widget * tmpWidget)
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateGuiSize(void)
|
||||
{
|
||||
if (NULL != gui_uniqueWindows) {
|
||||
gui_uniqueWindows->CalculateSize((float)gui_width, (float)gui_height);
|
||||
gui_uniqueWindows->SetOrigin(0.0, 0.0);
|
||||
}
|
||||
}
|
||||
void EWOL_NativeResize(int w, int h )
|
||||
{
|
||||
gui_width = w;
|
||||
gui_height = h;
|
||||
//EWOL_INFO("Resize w=" << w << " h=" << h);
|
||||
if (NULL != gui_uniqueWindows) {
|
||||
gui_uniqueWindows->CalculateSize((float)gui_width, (float)gui_height);
|
||||
gui_uniqueWindows->SetOrigin(0.0, 0.0);
|
||||
}
|
||||
UpdateGuiSize();
|
||||
}
|
||||
|
||||
void EWOL_NativeRegenerateDisplay(void)
|
||||
|
@ -35,6 +35,8 @@ void EWOL_NativeResize(int w, int h );
|
||||
void EWOL_GenericDraw(bool everyTime);
|
||||
void EWOL_NativeGLDestroy(void);
|
||||
|
||||
void UpdateGuiSize(void);
|
||||
|
||||
namespace guiAbstraction
|
||||
{
|
||||
void Stop(void);
|
||||
|
@ -470,23 +470,17 @@ void EWOL_NativeRender(void)
|
||||
ewol::texture::UpdateContext();
|
||||
//EWOL_DEBUG("redraw (" << gui_width << "," << gui_height << ")");
|
||||
if(NULL == gui_uniqueWindows) {
|
||||
//EWOL_DEBUG("Has No Windows set...");
|
||||
|
||||
// set the size of the open GL system
|
||||
glViewport(0,0,gui_width,gui_height);
|
||||
|
||||
// Clear the screen with transparency ...
|
||||
glClearColor(0.750, 0.750, 0.750, 0.5);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0., (float)gui_width, 0., (float)gui_height, 1., 20.);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -5);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(1., 0., 0.); glVertex3f( .25*(float)gui_width, .25*(float)gui_height, 0.);
|
||||
glColor3f(0., 1., 0.); glVertex3f( .75*(float)gui_width, .25*(float)gui_height, 0.);
|
||||
|
@ -75,6 +75,7 @@ namespace ewol {
|
||||
int32_t GetCurrentHeight(void);
|
||||
|
||||
void SetTitle(etk::UString title);
|
||||
void RequestUpdateSize(void);
|
||||
};
|
||||
// get current time in ms...
|
||||
int64_t GetCurrentTime(void);
|
||||
|
@ -41,7 +41,7 @@ void ewol::WIDGET_ButtonImageInit(void)
|
||||
#undef __class__
|
||||
#define __class__ "ButtonImage"
|
||||
|
||||
ewol::ButtonImage::ButtonImage(etk::UString imageName)
|
||||
ewol::ButtonImage::ButtonImage(etk::UString imageName, color_ts col)
|
||||
{
|
||||
AddEventId(ewolEventButtonPressed);
|
||||
AddEventId(ewolEventButtonDown);
|
||||
@ -54,6 +54,7 @@ ewol::ButtonImage::ButtonImage(etk::UString imageName)
|
||||
m_down = false;
|
||||
m_value = false;
|
||||
m_image = imageName;
|
||||
m_color = col;
|
||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
m_OOImage[iii] = NULL;
|
||||
m_OOImageBg1[iii] = NULL;
|
||||
@ -69,27 +70,30 @@ ewol::ButtonImage::~ButtonImage(void)
|
||||
|
||||
}
|
||||
|
||||
void ewol::ButtonImage::SetImage(etk::UString imageName)
|
||||
void ewol::ButtonImage::SetImage(etk::UString imageName, color_ts col)
|
||||
{
|
||||
m_image = imageName;
|
||||
m_color = col;
|
||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
m_resetNeeded[iii] = true;
|
||||
}
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
void ewol::ButtonImage::SetImageBG(etk::UString imageName)
|
||||
void ewol::ButtonImage::SetImageBG(etk::UString imageName, color_ts col)
|
||||
{
|
||||
m_imageBg1 = imageName;
|
||||
m_colorBg1 = col;
|
||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
m_resetNeeded[iii] = true;
|
||||
}
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
void ewol::ButtonImage::SetImageSelected(etk::UString imageName)
|
||||
void ewol::ButtonImage::SetImageSelected(etk::UString imageName, color_ts col)
|
||||
{
|
||||
m_imageBg2 = imageName;
|
||||
m_colorBg2 = col;
|
||||
for (int32_t iii=0; iii<NB_BOUBLE_BUFFER; iii++) {
|
||||
m_resetNeeded[iii] = true;
|
||||
}
|
||||
@ -195,33 +199,51 @@ void ewol::ButtonImage::OnRegenerateDisplay(void)
|
||||
m_OOImage[m_currentCreateId] = new ewol::OObject2DTextured(m_image, tmpSizeX, tmpSizeY);
|
||||
}
|
||||
}
|
||||
float tmpval = 0.0;
|
||||
if (NULL != m_OOImageBG2[m_currentCreateId]) {
|
||||
m_OOImageBG2[m_currentCreateId]->Clear();
|
||||
if( m_down == true
|
||||
|| m_over == true ) {
|
||||
m_OOImageBG2[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
if (false == m_toggleMode) {
|
||||
float tmpval = 0.0;
|
||||
if (NULL != m_OOImageBG2[m_currentCreateId]) {
|
||||
m_OOImageBG2[m_currentCreateId]->Clear();
|
||||
if( m_down == true
|
||||
|| m_over == true ) {
|
||||
m_OOImageBG2[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
}
|
||||
tmpval = tmpSizeX * 0.2;
|
||||
tmpSizeX -= tmpval;
|
||||
tmpOriginX += tmpval/2;
|
||||
tmpval = tmpSizeY * 0.2;
|
||||
tmpSizeY -= tmpval;
|
||||
tmpOriginY += tmpval/2;
|
||||
}
|
||||
if (NULL != m_OOImageBg1[m_currentCreateId]) {
|
||||
m_OOImageBg1[m_currentCreateId]->Clear();
|
||||
m_OOImageBg1[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
tmpval = tmpSizeX * 0.2;
|
||||
tmpSizeX -= tmpval;
|
||||
tmpOriginX += tmpval/2;
|
||||
tmpval = tmpSizeY * 0.2;
|
||||
tmpSizeY -= tmpval;
|
||||
tmpOriginY += tmpval/2;
|
||||
}
|
||||
if (NULL != m_OOImage[m_currentCreateId]) {
|
||||
m_OOImage[m_currentCreateId]->Clear();
|
||||
m_OOImage[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
}
|
||||
} else {
|
||||
if (NULL != m_OOImage[m_currentCreateId]) {
|
||||
m_OOImage[m_currentCreateId]->Clear();
|
||||
}
|
||||
if (NULL != m_OOImageBG2[m_currentCreateId]) {
|
||||
m_OOImageBG2[m_currentCreateId]->Clear();
|
||||
}
|
||||
if(m_value == true) {
|
||||
if (NULL != m_OOImage[m_currentCreateId]) {
|
||||
m_OOImage[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_color);
|
||||
}
|
||||
} else {
|
||||
if (NULL != m_OOImageBG2[m_currentCreateId]) {
|
||||
m_OOImageBG2[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_colorBg2);
|
||||
}
|
||||
}
|
||||
tmpval = tmpSizeX * 0.2;
|
||||
tmpSizeX -= tmpval;
|
||||
tmpOriginX += tmpval/2;
|
||||
tmpval = tmpSizeY * 0.2;
|
||||
tmpSizeY -= tmpval;
|
||||
tmpOriginY += tmpval/2;
|
||||
}
|
||||
if (NULL != m_OOImageBg1[m_currentCreateId]) {
|
||||
m_OOImageBg1[m_currentCreateId]->Clear();
|
||||
m_OOImageBg1[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
tmpval = tmpSizeX * 0.2;
|
||||
tmpSizeX -= tmpval;
|
||||
tmpOriginX += tmpval/2;
|
||||
tmpval = tmpSizeY * 0.2;
|
||||
tmpSizeY -= tmpval;
|
||||
tmpOriginY += tmpval/2;
|
||||
}
|
||||
if (NULL != m_OOImage[m_currentCreateId]) {
|
||||
m_OOImage[m_currentCreateId]->Clear();
|
||||
m_OOImage[m_currentCreateId]->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
}
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace ewol {
|
||||
class ButtonImage :public ewol::Widget
|
||||
{
|
||||
public:
|
||||
ButtonImage(etk::UString image);
|
||||
ButtonImage(etk::UString image, color_ts col=0xFFFFFFFF);
|
||||
/**
|
||||
* @brief Check if the object has the specific type.
|
||||
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
|
||||
@ -52,9 +52,9 @@ namespace ewol {
|
||||
virtual const char * const GetObjectType(void);
|
||||
void Init(void);
|
||||
virtual ~ButtonImage(void);
|
||||
void SetImage(etk::UString imageName);
|
||||
void SetImageBG(etk::UString imageName);
|
||||
void SetImageSelected(etk::UString imageName);
|
||||
void SetImage(etk::UString imageName, color_ts col=0xFFFFFFFF);
|
||||
void SetImageBG(etk::UString imageName, color_ts col=0xFFFFFFFF);
|
||||
void SetImageSelected(etk::UString imageName, color_ts col=0xFFFFFFFF);
|
||||
void SetValue(bool val);
|
||||
bool GetValue(void);
|
||||
void SetToggleMode(bool val);
|
||||
@ -63,10 +63,16 @@ namespace ewol {
|
||||
etk::UString m_image;
|
||||
bool m_resetNeeded[NB_BOUBLE_BUFFER];
|
||||
ewol::OObject2DTextured* m_OOImage[NB_BOUBLE_BUFFER];
|
||||
color_ts m_color;
|
||||
|
||||
etk::UString m_imageBg1;
|
||||
ewol::OObject2DTextured* m_OOImageBg1[NB_BOUBLE_BUFFER];
|
||||
color_ts m_colorBg1;
|
||||
|
||||
etk::UString m_imageBg2;
|
||||
ewol::OObject2DTextured* m_OOImageBG2[NB_BOUBLE_BUFFER];
|
||||
color_ts m_colorBg2;
|
||||
|
||||
bool m_over;
|
||||
bool m_down;
|
||||
bool m_value;
|
||||
|
@ -269,6 +269,7 @@ void ewol::SizerHori::OnRegenerateDisplay(void)
|
||||
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||
}
|
||||
}
|
||||
NeedFlipFlop();
|
||||
}
|
||||
|
||||
|
||||
@ -280,6 +281,9 @@ void ewol::SizerHori::OnRegenerateDisplay(void)
|
||||
*/
|
||||
ewol::Widget * ewol::SizerHori::GetWidgetAtPos(Vector2D<float> pos)
|
||||
{
|
||||
if (true == IsHide()) {
|
||||
return NULL;
|
||||
}
|
||||
// for all element in the sizer ...
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
|
@ -269,6 +269,7 @@ void ewol::SizerVert::OnRegenerateDisplay(void)
|
||||
m_subWidget[m_currentCreateId][iii]->OnRegenerateDisplay();
|
||||
}
|
||||
}
|
||||
NeedFlipFlop();
|
||||
}
|
||||
|
||||
|
||||
@ -280,6 +281,9 @@ void ewol::SizerVert::OnRegenerateDisplay(void)
|
||||
*/
|
||||
ewol::Widget * ewol::SizerVert::GetWidgetAtPos(Vector2D<float> pos)
|
||||
{
|
||||
if (true == IsHide()) {
|
||||
return NULL;
|
||||
}
|
||||
// for all element in the sizer ...
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user