change the methode to display elements and some corection for the WSlider
This commit is contained in:
parent
8ef890bfae
commit
8305cde419
@ -6,7 +6,6 @@ LOCAL_MODULE := etk
|
||||
LOCAL_STATIC_LIBRARIES := libzip
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
||||
LOCAL_EXPORT_LDLIBS :=
|
||||
|
||||
ifeq ($(DEBUG),1)
|
||||
LOCAL_CFLAGS := -D__PLATFORM__Linux \
|
||||
@ -26,10 +25,6 @@ include $(LOCAL_PATH)/file.mk
|
||||
|
||||
LOCAL_SRC_FILES := $(FILE_LIST)
|
||||
|
||||
#for freetype : https://github.com/cdave1/freetype2-android
|
||||
|
||||
# Ewol Test Software :
|
||||
LOCAL_LDLIBS :=
|
||||
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
@ -64,9 +64,9 @@ typedef enum {
|
||||
}erreurCode_te;
|
||||
|
||||
|
||||
#define etk_min(elemA, elemB) ((elemA)<(elemB)) ? (elemA) : (elemB)
|
||||
#define etk_max(elemA, elemB) ((elemA)<(elemB)) ? (elemB) : (elemA)
|
||||
#define etk_avg(minimim, elem, maximum) ((minimim)>(elem)) ? (minimim) : ((maximum)<(elem)) ? (maximum) : (elem)
|
||||
#define etk_min(elemA, elemB) (((elemA)<(elemB)) ? (elemA) : (elemB))
|
||||
#define etk_max(elemA, elemB) (((elemA)<(elemB)) ? (elemB) : (elemA))
|
||||
#define etk_avg(minimim, elem, maximum) (((minimim)>(elem)) ? (minimim) : ((maximum)<(elem)) ? (maximum) : (elem))
|
||||
|
||||
#include <etk/TypesCoordonate.h>
|
||||
|
||||
|
@ -81,9 +81,10 @@ template <typename T> class Vector2D
|
||||
* + operator
|
||||
*****************************************************/
|
||||
Vector2D<T> operator+ (const Vector2D<T>& obj) {
|
||||
x += (T)obj.x;
|
||||
y += (T)obj.y;
|
||||
return *this;
|
||||
Vector2D<T> tmpp(x,y);
|
||||
tmpp.x += (T)obj.x;
|
||||
tmpp.y += (T)obj.y;
|
||||
return tmpp;
|
||||
}
|
||||
/*****************************************************
|
||||
* -= operator
|
||||
@ -97,8 +98,9 @@ template <typename T> class Vector2D
|
||||
* - operator
|
||||
*****************************************************/
|
||||
Vector2D<T> operator- (const Vector2D<T>& obj) {
|
||||
x -= (T)obj.x;
|
||||
y -= (T)obj.y;
|
||||
Vector2D<T> tmpp(x,y);
|
||||
tmpp.x -= (T)obj.x;
|
||||
tmpp.y -= (T)obj.y;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
@ -113,8 +115,9 @@ template <typename T> class Vector2D
|
||||
* / operator
|
||||
*****************************************************/
|
||||
Vector2D<T> operator/ (const Vector2D<T>& obj) {
|
||||
x /= (T)obj.x;
|
||||
y /= (T)obj.y;
|
||||
Vector2D<T> tmpp(x,y);
|
||||
tmpp.x /= (T)obj.x;
|
||||
tmpp.y /= (T)obj.y;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
@ -129,8 +132,9 @@ template <typename T> class Vector2D
|
||||
* * operator
|
||||
*****************************************************/
|
||||
Vector2D<T> operator* (const Vector2D<T>& obj) {
|
||||
x *= (T)obj.x;
|
||||
y *= (T)obj.y;
|
||||
Vector2D<T> tmpp(x,y);
|
||||
tmpp.x *= (T)obj.x;
|
||||
tmpp.y *= (T)obj.y;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
@ -227,9 +231,10 @@ template <typename T> class Vector3D
|
||||
* + operator
|
||||
*****************************************************/
|
||||
Vector3D<T> operator+ (const Vector3D<T>& obj) {
|
||||
x += (T)obj.x;
|
||||
y += (T)obj.y;
|
||||
z += (T)obj.z;
|
||||
Vector3D<T> tmpp(x,y,y);
|
||||
tmpp.x += (T)obj.x;
|
||||
tmpp.y += (T)obj.y;
|
||||
tmpp.z += (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
@ -245,9 +250,10 @@ template <typename T> class Vector3D
|
||||
* - operator
|
||||
*****************************************************/
|
||||
Vector3D<T> operator- (const Vector3D<T>& obj) {
|
||||
x -= (T)obj.x;
|
||||
y -= (T)obj.y;
|
||||
z -= (T)obj.z;
|
||||
Vector3D<T> tmpp(x,y,y);
|
||||
tmpp.x -= (T)obj.x;
|
||||
tmpp.y -= (T)obj.y;
|
||||
tmpp.z -= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
@ -263,9 +269,10 @@ template <typename T> class Vector3D
|
||||
* / operator
|
||||
*****************************************************/
|
||||
Vector3D<T> operator/ (const Vector3D<T>& obj) {
|
||||
x /= (T)obj.x;
|
||||
y /= (T)obj.y;
|
||||
z /= (T)obj.z;
|
||||
Vector3D<T> tmpp(x,y,y);
|
||||
tmpp.x /= (T)obj.x;
|
||||
tmpp.y /= (T)obj.y;
|
||||
tmpp.z /= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
@ -281,9 +288,10 @@ template <typename T> class Vector3D
|
||||
* * operator
|
||||
*****************************************************/
|
||||
Vector3D<T> operator* (const Vector3D<T>& obj) {
|
||||
x *= (T)obj.x;
|
||||
y *= (T)obj.y;
|
||||
z *= (T)obj.z;
|
||||
Vector3D<T> tmpp(x,y,y);
|
||||
tmpp.x *= (T)obj.x;
|
||||
tmpp.y *= (T)obj.y;
|
||||
tmpp.z *= (T)obj.z;
|
||||
return *this;
|
||||
}
|
||||
/*****************************************************
|
||||
|
@ -288,31 +288,65 @@ void ewol::Widget::KeepFocus(void)
|
||||
* @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...])
|
||||
* This function generate a clipping with the viewport openGL system. Like this a widget draw can not draw over an other widget
|
||||
* @note This function is virtual for the scrolled widget, and the more complicated OpenGl widget
|
||||
* @param ---
|
||||
* @param[in] displayProp properties of the current display
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::Widget::GenDraw(void)
|
||||
void ewol::Widget::GenDraw(DrawProperty displayProp)
|
||||
{
|
||||
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,
|
||||
ewol::GetCurrentHeight() - m_size.y - m_origin.y,
|
||||
m_size.x,
|
||||
m_size.y);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrthoEwol(-m_size.x/2, m_size.x/2, m_size.y/2, -m_size.y/2, -1, 1);
|
||||
//glOrthoEwol(0., m_size.x, 0., -m_size.y, 1., 20.);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(-m_size.x/2, -m_size.y/2, -1.0);
|
||||
// Call the widget drawing methode
|
||||
OnDraw();
|
||||
if( (displayProp.m_origin.x > m_origin.x)
|
||||
|| (displayProp.m_origin.x + displayProp.m_size.x < m_size.x + m_origin.x) ) {
|
||||
// here we invert the reference of the standard OpenGl view because the reference in the common display is Top left and not buttom left
|
||||
int32_t tmpOriginX = etk_max(displayProp.m_origin.x, m_origin.x);
|
||||
int32_t tmppp1 = displayProp.m_origin.x + displayProp.m_size.x;
|
||||
int32_t tmppp2 = m_origin.x + m_size.x;
|
||||
int32_t tmpclipX = etk_min(tmppp1, tmppp2) - tmpOriginX;
|
||||
|
||||
int32_t tmpOriginY = etk_max(displayProp.m_origin.y, m_origin.y);
|
||||
tmppp1 = displayProp.m_origin.y + displayProp.m_size.y;
|
||||
tmppp2 = m_origin.y + m_size.y;
|
||||
int32_t tmpclipY = etk_min(tmppp1, tmppp2) - tmpOriginX;
|
||||
|
||||
glViewport( tmpOriginX,
|
||||
displayProp.m_windowsSize.y - m_size.y - tmpOriginY,
|
||||
tmpclipX,
|
||||
m_size.y);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrthoEwol(-tmpclipX/2, tmpclipX/2, m_size.y/2, -m_size.y/2, -1, 1);
|
||||
//glOrthoEwol(0., m_size.x, 0., -m_size.y, 1., 20.);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(-tmpclipX/2 - (tmpOriginX-m_origin.x), -m_size.y/2, -1.0);
|
||||
// Call the widget drawing methode
|
||||
displayProp.m_origin.x = tmpOriginX;
|
||||
displayProp.m_origin.y = tmpOriginY;
|
||||
displayProp.m_size.x = tmpclipX;
|
||||
displayProp.m_size.y = m_size.y;
|
||||
OnDraw(displayProp);
|
||||
} else {
|
||||
int32_t tmpOriginY = m_origin.y;
|
||||
glViewport( m_origin.x,
|
||||
displayProp.m_windowsSize.y - m_size.y - m_origin.y,
|
||||
m_size.x,
|
||||
m_size.y);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrthoEwol(-m_size.x/2, m_size.x/2, m_size.y/2, -m_size.y/2, -1, 1);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(-m_size.x/2, -m_size.y/2, -1.0);
|
||||
// Call the widget drawing methode
|
||||
displayProp.m_origin = m_origin;
|
||||
displayProp.m_size = m_size;
|
||||
OnDraw(displayProp);
|
||||
}
|
||||
glPopMatrix();
|
||||
return;
|
||||
}
|
||||
|
@ -96,7 +96,12 @@ namespace ewol {
|
||||
|
||||
char* GetCharTypeMoveEvent(eventKbMoveType_te type);
|
||||
|
||||
|
||||
class DrawProperty{
|
||||
public :
|
||||
Vector2D<int32_t> m_windowsSize;
|
||||
Vector2D<int32_t> m_origin;
|
||||
Vector2D<int32_t> m_size;
|
||||
};
|
||||
|
||||
|
||||
class Widget : public EObject {
|
||||
@ -459,17 +464,17 @@ namespace ewol {
|
||||
* @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...])
|
||||
* This function generate a clipping with the viewport openGL system. Like this a widget draw can not draw over an other widget
|
||||
* @note This function is virtual for the scrolled widget, and the more complicated OpenGl widget
|
||||
* @param ---
|
||||
* @param[in] displayProp properties of the current display
|
||||
* @return ---
|
||||
*/
|
||||
virtual void GenDraw(void);
|
||||
virtual void GenDraw(DrawProperty displayProp);
|
||||
protected:
|
||||
/**
|
||||
* @brief Common widget drawing function (called by the drawing thread [Android, X11, ...])
|
||||
* @param ---
|
||||
* @param[in] displayProp properties of the current display
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnDraw(void) { };
|
||||
virtual void OnDraw(DrawProperty& displayProp) { };
|
||||
public:
|
||||
/**
|
||||
* @brief Event generated when a redraw is needed
|
||||
|
@ -179,8 +179,14 @@ void ewol::Windows::SysDraw(void)
|
||||
*/
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GenDraw();
|
||||
|
||||
ewol::DrawProperty displayProp;
|
||||
displayProp.m_windowsSize = m_size;
|
||||
displayProp.m_origin.x = 0;
|
||||
displayProp.m_origin.y = 0;
|
||||
displayProp.m_size = m_size;
|
||||
|
||||
GenDraw(displayProp);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
return;
|
||||
@ -199,7 +205,7 @@ void ewol::Windows::OnRegenerateDisplay(void)
|
||||
}
|
||||
|
||||
|
||||
void ewol::Windows::OnDraw(void)
|
||||
void ewol::Windows::OnDraw(ewol::DrawProperty& displayProp)
|
||||
{
|
||||
|
||||
// Clear the screen with transparency ...
|
||||
@ -209,13 +215,13 @@ void ewol::Windows::OnDraw(void)
|
||||
//EWOL_WARNING(" WINDOWS draw on " << m_currentDrawId);
|
||||
// first display the windows on the display
|
||||
if (NULL != m_subWidget[m_currentDrawId]) {
|
||||
m_subWidget[m_currentDrawId]->GenDraw();
|
||||
m_subWidget[m_currentDrawId]->GenDraw(displayProp);
|
||||
//EWOL_DEBUG("Draw Windows");
|
||||
}
|
||||
// second display the pop-up
|
||||
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_popUpWidgetList[m_currentDrawId][iii]) {
|
||||
m_popUpWidgetList[m_currentDrawId][iii]->GenDraw();
|
||||
m_popUpWidgetList[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
//EWOL_DEBUG("Draw Pop-up");
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ namespace ewol {
|
||||
void SetSubWidget(ewol::Widget * widget);
|
||||
void PopUpWidgetPush(ewol::Widget * widget);
|
||||
protected:
|
||||
virtual void OnDraw(void);
|
||||
virtual void OnDraw(ewol::DrawProperty& displayProp);
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
public:
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
* You can send me the bug-fix>
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
@ -353,7 +353,7 @@ bool ewol::ButtonImage::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unic
|
||||
}
|
||||
|
||||
|
||||
void ewol::ButtonImage::OnDraw(void)
|
||||
void ewol::ButtonImage::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
if (NULL != m_OOImageBG2[m_currentDrawId]) {
|
||||
m_OOImageBG2[m_currentDrawId]->Draw();
|
||||
|
@ -97,7 +97,7 @@ namespace ewol {
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnFlipFlopEvent(void);
|
||||
virtual void OnDraw(void);
|
||||
virtual void OnDraw(DrawProperty& displayProp);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -221,12 +221,12 @@ void ewol::ContextMenu::SubWidgetRemove(void)
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::ContextMenu::OnDraw(void)
|
||||
void ewol::ContextMenu::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
//EWOL_DEBUG("On Draw " << m_currentDrawId);
|
||||
ewol::Drawable::OnDraw();
|
||||
ewol::Drawable::OnDraw(displayProp);
|
||||
if (NULL != m_subWidget[m_currentDrawId]) {
|
||||
m_subWidget[m_currentDrawId]->GenDraw();
|
||||
m_subWidget[m_currentDrawId]->GenDraw(displayProp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ namespace ewol {
|
||||
void SubWidgetRemove(void);
|
||||
void SetPositionMark(markPosition_te position, Vector2D<float> arrowPos);
|
||||
protected:
|
||||
virtual void OnDraw(void);
|
||||
virtual void OnDraw(DrawProperty& displayProp);
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
public:
|
||||
|
@ -106,7 +106,7 @@ void ewol::Drawable::ClearOObjectList(void)
|
||||
m_listOObject[m_currentCreateId].Clear();
|
||||
}
|
||||
|
||||
void ewol::Drawable::OnDraw(void)
|
||||
void ewol::Drawable::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
||||
|
@ -56,7 +56,7 @@ namespace ewol {
|
||||
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
||||
void ClearOObjectList(void);
|
||||
protected:
|
||||
virtual void OnDraw(void);
|
||||
virtual void OnDraw(DrawProperty& displayProp);
|
||||
};
|
||||
|
||||
extern const char * const TYPE_EOBJECT_WIDGET_DRAWABLE;
|
||||
|
@ -208,12 +208,12 @@ void ewol::Layer::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
}
|
||||
|
||||
|
||||
void ewol::Layer::OnDraw(void)
|
||||
void ewol::Layer::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
// draw is done in the invert sense of inserting ... the first element inserted is on the top and the last is on the buttom
|
||||
for (int32_t iii=m_subWidget[m_currentDrawId].Size()-1; iii>=0; iii--) {
|
||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw();
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ namespace ewol {
|
||||
virtual void SubWidgetRemove(ewol::Widget* newWidget);
|
||||
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
||||
protected:
|
||||
virtual void OnDraw(void);
|
||||
virtual void OnDraw(DrawProperty& displayProp);
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
public:
|
||||
|
@ -137,14 +137,14 @@ void ewol::List::ClearOObjectList(void)
|
||||
m_listOObject[m_currentCreateId].Clear();
|
||||
}
|
||||
|
||||
void ewol::List::OnDraw(void)
|
||||
void ewol::List::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
||||
m_listOObject[m_currentDrawId][iii]->Draw();
|
||||
}
|
||||
}
|
||||
WidgetScrooled::OnDraw();
|
||||
WidgetScrooled::OnDraw(displayProp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace ewol {
|
||||
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
||||
void ClearOObjectList(void);
|
||||
protected:
|
||||
virtual void OnDraw(void);
|
||||
virtual void OnDraw(DrawProperty& displayProp);
|
||||
// list properties ...
|
||||
private:
|
||||
int32_t m_paddingSizeX;
|
||||
|
@ -188,12 +188,12 @@ void ewol::PopUp::SubWidgetRemove(void)
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
void ewol::PopUp::OnDraw(void)
|
||||
void ewol::PopUp::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
// draw upper classes
|
||||
ewol::Drawable::OnDraw();
|
||||
ewol::Drawable::OnDraw(displayProp);
|
||||
if (NULL != m_subWidget[m_currentDrawId]) {
|
||||
m_subWidget[m_currentDrawId]->GenDraw();
|
||||
m_subWidget[m_currentDrawId]->GenDraw(displayProp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ namespace ewol {
|
||||
void SubWidgetSet(ewol::Widget* newWidget);
|
||||
void SubWidgetRemove(void);
|
||||
protected:
|
||||
virtual void OnDraw(void);
|
||||
virtual void OnDraw(ewol::DrawProperty& displayProp);
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
public:
|
||||
|
@ -122,7 +122,7 @@ void ewol::Scene::OnRegenerateDisplay(void)
|
||||
* @return ---
|
||||
*/
|
||||
//TODO : Il y a un bug : seg fault ... je ne sais pas trop ou ...
|
||||
void ewol::Scene::OnDraw(void)
|
||||
void ewol::Scene::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
//EWOL_ERROR(" On draw : " << m_currentDrawId);
|
||||
// draw elements
|
||||
|
@ -71,7 +71,7 @@ namespace ewol {
|
||||
* @param ---
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnDraw(void);
|
||||
virtual void OnDraw(DrawProperty& displayProp);
|
||||
/**
|
||||
* @brief Set the scene in pause for a while
|
||||
* @param ---
|
||||
|
@ -252,11 +252,11 @@ void ewol::SizerHori::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
}
|
||||
|
||||
|
||||
void ewol::SizerHori::OnDraw(void)
|
||||
void ewol::SizerHori::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw();
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ namespace ewol {
|
||||
virtual void SubWidgetRemove(ewol::Widget* newWidget);
|
||||
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
||||
protected:
|
||||
virtual void OnDraw(void);
|
||||
virtual void OnDraw(DrawProperty& displayProp);
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
/**
|
||||
|
@ -251,11 +251,11 @@ void ewol::SizerVert::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
}
|
||||
|
||||
|
||||
void ewol::SizerVert::OnDraw(void)
|
||||
void ewol::SizerVert::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw();
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ namespace ewol {
|
||||
virtual void SubWidgetRemove(ewol::Widget* newWidget);
|
||||
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
||||
protected:
|
||||
virtual void OnDraw(void);
|
||||
virtual void OnDraw(DrawProperty& displayProp);
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
public:
|
||||
|
@ -34,8 +34,9 @@
|
||||
|
||||
ewol::Spacer::Spacer(void)
|
||||
{
|
||||
m_size = 10;
|
||||
m_localSize = 10;
|
||||
SetCanHaveFocus(false);
|
||||
m_color = 0x00000000;
|
||||
}
|
||||
|
||||
ewol::Spacer::~Spacer(void)
|
||||
@ -84,15 +85,35 @@ const char * const ewol::Spacer::GetObjectType(void)
|
||||
|
||||
bool ewol::Spacer::CalculateMinSize(void)
|
||||
{
|
||||
m_minSize.x = m_size;
|
||||
m_minSize.y = m_size;
|
||||
m_minSize.x = m_localSize;
|
||||
m_minSize.y = m_localSize;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ewol::Spacer::SetSize(float size)
|
||||
{
|
||||
m_size = size;
|
||||
m_localSize = size;
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
#define BORDER_SIZE_TMP (4)
|
||||
void ewol::Spacer::OnRegenerateDisplay(void)
|
||||
{
|
||||
if (false == NeedRedraw()) {
|
||||
return;
|
||||
}
|
||||
// generate a white background and take gray on other surfaces
|
||||
ClearOObjectList();
|
||||
if (m_color.alpha == 0) {
|
||||
return;
|
||||
}
|
||||
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
|
||||
if (NULL == BGOObjects) {
|
||||
return;
|
||||
}
|
||||
AddOObject(BGOObjects);
|
||||
|
||||
BGOObjects->SetColor(m_color);
|
||||
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
||||
}
|
@ -60,8 +60,11 @@ namespace ewol {
|
||||
* @return pointer on the widget found
|
||||
*/
|
||||
virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos) { return NULL; };
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
void SetColor(color_ts newColor) { m_color = newColor; MarkToReedraw(); };
|
||||
private:
|
||||
float m_size;
|
||||
float m_localSize;
|
||||
color_ts m_color;
|
||||
};
|
||||
|
||||
extern const char * const TYPE_EOBJECT_WIDGET_SPACER;
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include <ewol/widget/WSlider.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/ewol.h>
|
||||
|
||||
|
||||
#undef __class__
|
||||
@ -38,6 +39,8 @@ ewol::WSlider::WSlider(void)
|
||||
m_windowsDestination = 0;
|
||||
m_slidingProgress = 0;
|
||||
m_windowsSources = 0;
|
||||
m_underExpend.x = false;
|
||||
m_underExpend.y = false;
|
||||
}
|
||||
|
||||
ewol::WSlider::~WSlider(void)
|
||||
@ -122,18 +125,19 @@ bool ewol::WSlider::CalculateSize(float availlableX, float availlableY)
|
||||
|
||||
bool ewol::WSlider::CalculateMinSize(void)
|
||||
{
|
||||
m_userExpendX=false;
|
||||
m_userExpendY=false;
|
||||
EWOL_DEBUG("Calculate MinSize");
|
||||
m_underExpend.x=false;
|
||||
m_underExpend.y=false;
|
||||
m_minSize.x = 0.0;
|
||||
m_minSize.y = 0.0;
|
||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii]->CalculateMinSize();
|
||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentX()) {
|
||||
m_userExpendX = true;
|
||||
m_underExpend.x = true;
|
||||
}
|
||||
if (true == m_subWidget[m_currentCreateId][iii]->CanExpentY()) {
|
||||
m_userExpendY = true;
|
||||
m_underExpend.y = true;
|
||||
}
|
||||
Vector2D<float> tmpSize = m_subWidget[m_currentCreateId][iii]->GetMinSize();
|
||||
m_minSize.x = etk_max(tmpSize.x, m_minSize.x);
|
||||
@ -148,30 +152,26 @@ void ewol::WSlider::SetMinSise(float x, float y)
|
||||
EWOL_ERROR("Layer can not have a user Minimum size (herited from under elements)");
|
||||
}
|
||||
|
||||
void ewol::WSlider::SetExpendX(bool newExpend)
|
||||
{
|
||||
EWOL_ERROR("Layer can not have a user expend settings X (herited from under elements)");
|
||||
}
|
||||
|
||||
bool ewol::WSlider::CanExpentX(void)
|
||||
{
|
||||
if (m_userExpendX == true) {
|
||||
return true;
|
||||
}
|
||||
if (true == m_lockExpendContamination) {
|
||||
return false;
|
||||
}
|
||||
return m_userExpendX;
|
||||
}
|
||||
|
||||
void ewol::WSlider::SetExpendY(bool newExpend)
|
||||
{
|
||||
EWOL_ERROR("Sizer can not have a user expend settings Y (herited from under elements)");
|
||||
return m_underExpend.x;
|
||||
}
|
||||
|
||||
bool ewol::WSlider::CanExpentY(void)
|
||||
{
|
||||
if (m_userExpendY == true) {
|
||||
return true;
|
||||
}
|
||||
if (true == m_lockExpendContamination) {
|
||||
return false;
|
||||
}
|
||||
return m_userExpendY;
|
||||
return m_underExpend.y;
|
||||
}
|
||||
|
||||
void ewol::WSlider::LockExpendContamination(bool lockExpend)
|
||||
@ -197,6 +197,8 @@ void ewol::WSlider::SubWidgetAdd(ewol::Widget* newWidget)
|
||||
return;
|
||||
}
|
||||
m_subWidget[m_currentCreateId].PushBack(newWidget);
|
||||
MarkToReedraw();
|
||||
ewol::RequestUpdateSize();
|
||||
}
|
||||
|
||||
|
||||
@ -210,6 +212,8 @@ void ewol::WSlider::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
MarkToReedraw();
|
||||
ewol::RequestUpdateSize();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -224,6 +228,8 @@ void ewol::WSlider::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
ewol::RequestUpdateSize();
|
||||
MarkToReedraw();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -260,7 +266,7 @@ void ewol::WSlider::PeriodicCall(int64_t localTime)
|
||||
}
|
||||
|
||||
|
||||
void ewol::WSlider::OnDraw(void)
|
||||
void ewol::WSlider::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
if (m_windowsDestination == m_windowsSources) {
|
||||
//EWOL_DEBUG("Draw : " << m_windowsDestination);
|
||||
@ -269,7 +275,7 @@ void ewol::WSlider::OnDraw(void)
|
||||
return;
|
||||
}
|
||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw();
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
}
|
||||
} else {
|
||||
//EWOL_DEBUG("Draw : " << m_windowsSources << "=>" << m_windowsDestination << "progress=" << ((float)m_slidingProgress/1000.) );
|
||||
@ -279,7 +285,7 @@ void ewol::WSlider::OnDraw(void)
|
||||
return;
|
||||
}
|
||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw();
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
}
|
||||
// Draw Destination :
|
||||
iii = m_windowsDestination;
|
||||
@ -287,7 +293,7 @@ void ewol::WSlider::OnDraw(void)
|
||||
return;
|
||||
}
|
||||
if (NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw();
|
||||
m_subWidget[m_currentDrawId][iii]->GenDraw(displayProp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,13 +50,13 @@ namespace ewol {
|
||||
* @return true if the object is compatible, otherwise false
|
||||
*/
|
||||
virtual const char * const GetObjectType(void);
|
||||
private:
|
||||
Vector2D<bool> m_underExpend; // expend of the uner elements ...
|
||||
public:
|
||||
virtual bool CalculateSize(float availlableX, float availlableY); // this generate the current size ...
|
||||
virtual bool CalculateMinSize(void); //update the min Size ... and the expend parameters for the sizer
|
||||
virtual void SetMinSise(float x=-1, float y=-1);
|
||||
virtual void SetExpendX(bool newExpend=false);
|
||||
virtual bool CanExpentX(void);
|
||||
virtual void SetExpendY(bool newExpend=false);
|
||||
virtual bool CanExpentY(void);
|
||||
void LockExpendContamination(bool lockExpend=false);
|
||||
private:
|
||||
@ -74,7 +74,7 @@ namespace ewol {
|
||||
int32_t SubWidgetSelectGet(void) { return (int32_t)m_slidingProgress; };
|
||||
int32_t SubWidgetNumber(void) { return m_subWidget[m_currentCreateId].Size(); };
|
||||
protected:
|
||||
virtual void OnDraw(void);
|
||||
virtual void OnDraw(DrawProperty& displayProp);
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
public:
|
||||
|
@ -357,7 +357,7 @@ void ewol::WidgetScrooled::ClearOObjectList(void)
|
||||
m_listOObject[m_currentCreateId].Clear();
|
||||
}
|
||||
|
||||
void ewol::WidgetScrooled::OnDraw(void)
|
||||
void ewol::WidgetScrooled::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
||||
@ -373,7 +373,7 @@ void ewol::WidgetScrooled::OnDraw(void)
|
||||
* @param ---
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::WidgetScrooled::GenDraw(void)
|
||||
void ewol::WidgetScrooled::GenDraw(DrawProperty displayProp)
|
||||
{
|
||||
if (SCROLL_MODE_CENTER == m_scroollingMode) {
|
||||
glPushMatrix();
|
||||
@ -391,10 +391,10 @@ void ewol::WidgetScrooled::GenDraw(void)
|
||||
glTranslatef(-m_maxSize.x/2, -m_maxSize.y/2, -1.0);
|
||||
|
||||
// Call the widget drawing methode
|
||||
OnDraw();
|
||||
OnDraw(displayProp);
|
||||
glPopMatrix();
|
||||
} else {
|
||||
ewol::Widget::GenDraw();
|
||||
ewol::Widget::GenDraw(displayProp);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ namespace ewol {
|
||||
*/
|
||||
virtual const char * const GetObjectType(void);
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
virtual void OnDraw(void);
|
||||
virtual void OnDraw(DrawProperty& displayProp);
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
@ -97,7 +97,7 @@ namespace ewol {
|
||||
* @param ---
|
||||
* @return ---
|
||||
*/
|
||||
virtual void GenDraw(void);
|
||||
virtual void GenDraw(DrawProperty displayProp);
|
||||
protected:
|
||||
/**
|
||||
* @brief For mouse event when we have a scrolling UP and dows, specify the number of pixel that we scrooled
|
||||
|
@ -73,6 +73,7 @@ ewol::Parameter::Parameter(void) :
|
||||
if (NULL == m_widgetTitle) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
m_widgetTitle->SetExpendX(true);
|
||||
mySizerVert->SubWidgetAdd(m_widgetTitle);
|
||||
}
|
||||
|
||||
@ -80,8 +81,9 @@ ewol::Parameter::Parameter(void) :
|
||||
if (NULL == mySpacer) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
//mySpacer->SetExpendX(true);
|
||||
//mySpacer->SetSize(10);
|
||||
mySpacer->SetExpendX(true);
|
||||
mySpacer->SetSize(5);
|
||||
mySpacer->SetColor(0x000000BF);
|
||||
mySizerVert->SubWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
@ -214,8 +216,10 @@ void ewol::Parameter::OnReceiveMessage(ewol::EObject * CallerObject, const char
|
||||
MarkToRemove();
|
||||
} else if (eventId == l_eventMenuSelected) {
|
||||
if (NULL != m_wSlider) {
|
||||
|
||||
m_wSlider->SubWidgetSelectSet(1);
|
||||
int32_t value = 0;
|
||||
sscanf(data.Utf8Data(), "%d", &value);
|
||||
EWOL_DEBUG("event on the parameter : " << eventId << " select ID=" << value << "");
|
||||
m_wSlider->SubWidgetSelectSet(value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,7 +265,8 @@ void ewol::Parameter::MenuAdd(etk::UString label, etk::UString image, ewol::Widg
|
||||
if (NULL != associateWidget) {
|
||||
m_wSlider->SubWidgetAdd(associateWidget);
|
||||
} else {
|
||||
ewol::Label * myLabel = new ewol::Label((etk::UString("No widget set ... ") + m_currentIdList));
|
||||
EWOL_DEBUG("Associate an empty widget on it ...");
|
||||
ewol::Label * myLabel = new ewol::Label((etk::UString("No widget for : ") + label));
|
||||
if (NULL == myLabel) {
|
||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||
} else {
|
||||
|
@ -144,14 +144,14 @@ void ewol::ParameterList::ClearOObjectList(void)
|
||||
m_listOObject[m_currentCreateId].Clear();
|
||||
}
|
||||
|
||||
void ewol::ParameterList::OnDraw(void)
|
||||
void ewol::ParameterList::OnDraw(DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject[m_currentDrawId].Size(); iii++) {
|
||||
if (NULL != m_listOObject[m_currentDrawId][iii]) {
|
||||
m_listOObject[m_currentDrawId][iii]->Draw();
|
||||
}
|
||||
}
|
||||
WidgetScrooled::OnDraw();
|
||||
WidgetScrooled::OnDraw(displayProp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace ewol {
|
||||
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
||||
void ClearOObjectList(void);
|
||||
protected:
|
||||
void OnDraw(void);
|
||||
void OnDraw(DrawProperty& displayProp);
|
||||
// list properties ...
|
||||
private:
|
||||
int32_t m_paddingSizeX;
|
||||
|
Loading…
x
Reference in New Issue
Block a user