missing files
This commit is contained in:
parent
c55dd4b4d9
commit
fcefec4958
51
Sources/libewol/ewol/ewolInterne.cpp
Normal file
51
Sources/libewol/ewol/ewolInterne.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file ewol/ewolInterne.cpp
|
||||
* @brief Main code of ewol interne interaction (sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 07/01/2012
|
||||
* @par Project
|
||||
* ewol
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#include <ewol/ewolInterne.h>
|
||||
#include <ewol/Font.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/themeManager.h>
|
||||
|
||||
#include <ewol/base/gui.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol"
|
||||
|
||||
void ewol::Init(int argc, char *argv[])
|
||||
{
|
||||
EWOL_INFO("v" EWOL_VERSION_TAG_NAME);
|
||||
EWOL_INFO("Build Date: " VERSION_BUILD_TIME);
|
||||
ewol::theme::Init();
|
||||
ewol::widgetManager::Init();
|
||||
ewol::InitFont();
|
||||
}
|
||||
|
||||
void ewol::UnInit(void)
|
||||
{
|
||||
ewol::UnInitFont();
|
||||
ewol::widgetManager::UnInit();
|
||||
ewol::theme::UnInit();
|
||||
}
|
||||
|
43
Sources/libewol/ewol/ewolInterne.h
Normal file
43
Sources/libewol/ewol/ewolInterne.h
Normal file
@ -0,0 +1,43 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file ewol/ewolInterne.h
|
||||
* @brief Main include of ewol internal interation(header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 07/01/2012
|
||||
* @par Project
|
||||
* ewol
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __EWOL_INTERNE_H__
|
||||
#define __EWOL_INTERNE_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/String.h>
|
||||
#include <ewol/Widget.h>
|
||||
#include <ewol/Windows.h>
|
||||
|
||||
|
||||
|
||||
namespace ewol {
|
||||
void Init(int32_t argc, char *argv[]);
|
||||
void UnInit(void);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
304
Sources/libewol/ewol/widgetMeta/Keyboard.cpp
Normal file
304
Sources/libewol/ewol/widgetMeta/Keyboard.cpp
Normal file
@ -0,0 +1,304 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file ewol/widgetMeta/Keyboard.cpp
|
||||
* @brief ewol keyboard meta widget system (Sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 07/01/2012
|
||||
* @par Project
|
||||
* ewol
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <ewol/widgetMeta/Keyboard.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
//#include <etk/Vector.h>
|
||||
#include <etk/VectorType.h>
|
||||
|
||||
#include <ewol/base/gui.h>
|
||||
|
||||
extern "C" {
|
||||
// file browsing ...
|
||||
#include <dirent.h>
|
||||
}
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::Keyboard"
|
||||
|
||||
|
||||
const char * const ewolEventKeyboardHide = "ewol event Keyboard request hide";
|
||||
const char * const ewolEventKeyEvent = "ewol event internal key event";
|
||||
|
||||
|
||||
ewol::Keyboard::Keyboard(int32_t windowsID)
|
||||
{
|
||||
// set event that can propagate outside ....
|
||||
AddEventId(ewolEventKeyboardHide);
|
||||
SpecificDrawEnable();
|
||||
|
||||
m_mode = KEYBOARD_MODE_TEXT;
|
||||
m_windowsID = windowsID;
|
||||
SetMode(m_mode);
|
||||
}
|
||||
|
||||
|
||||
ewol::Keyboard::~Keyboard(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#define ADD_BUTTON(upperWidget,widget,text,event) do { \
|
||||
(widget) = new ewol::Button((text)); \
|
||||
(widget)->ExternLinkOnEvent("ewol Button Pressed", GetWidgetId(), (event) ); \
|
||||
(widget)->SetExpendX(true); \
|
||||
(widget)->SetFillX(true); \
|
||||
(widget)->SetCanHaveFocus(false); \
|
||||
(upperWidget)->SubWidgetAdd((widget)); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
void ewol::Keyboard::SetMode(keyboardMode_te mode)
|
||||
{
|
||||
|
||||
ewol::SizerVert * mySizerVert = NULL;
|
||||
ewol::SizerHori * mySizerHori = NULL;
|
||||
ewol::Button * myButton = NULL;
|
||||
ewol::Spacer * mySpacer = NULL;
|
||||
|
||||
mySizerVert = new ewol::SizerVert();
|
||||
m_subWidget = mySizerVert;
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
ADD_BUTTON(mySizerHori,myButton,"1",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"2",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"3",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"4",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"5",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"6",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"7",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"8",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"9",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"0",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"(",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,")",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"{",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"}",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"+",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"=",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"DEL",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"SUPR",ewolEventKeyEvent);
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
ADD_BUTTON(mySizerHori,myButton,"TAB",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"a",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"z",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"e",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"r",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"t",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"y",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"u",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"i",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"o",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"p",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"$",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"ENTER",ewolEventKeyEvent);
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
ADD_BUTTON(mySizerHori,myButton,"CAPLOCK",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"q",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"s",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"d",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"f",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"g",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"h",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"j",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"k",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"l",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"m",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"%",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"*",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"ENTER",ewolEventKeyEvent);
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
ADD_BUTTON(mySizerHori,myButton,"SHIFT",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"<",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,">",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"w",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"x",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"c",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"v",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"b",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"n",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,",",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,";",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,".",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,":",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"/",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"!",ewolEventKeyEvent);
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
ADD_BUTTON(mySizerHori,myButton,"Hide",ewolEventKeyboardHide);
|
||||
ADD_BUTTON(mySizerHori,myButton,"Ctrl",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"Pomme",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"Alt",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton," ",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"AltGr",ewolEventKeyEvent);
|
||||
ADD_BUTTON(mySizerHori,myButton,"Ctrl",ewolEventKeyEvent);
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool ewol::Keyboard::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
EWOL_INFO("Receive Event from the Keyboard ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> internalEvent=\"" << eventExternId << "\"" );
|
||||
if (ewolEventKeyEvent == eventExternId) {
|
||||
ewol::Button * bt = (ewol::Button *)ewol::widgetManager::Get(widgetID);
|
||||
EWOL_DEBUG("kbevent : \"" << bt->GetLabel() << "\"");
|
||||
etk::String data = bt->GetLabel();
|
||||
if (data == "DEL") {
|
||||
char tmppp[2] = {0x08, 0x00};
|
||||
data = tmppp;
|
||||
}
|
||||
if (data == "ENTER") {
|
||||
data = "\n";
|
||||
}
|
||||
if (data == "TAB") {
|
||||
data = "\t";
|
||||
}
|
||||
guiAbstraction::SendKeyboardEvent(true, data);
|
||||
guiAbstraction::SendKeyboardEvent(false, data);
|
||||
return true;
|
||||
} else if (ewolEventKeyboardHide == eventExternId) {
|
||||
EWOL_INFO("plop1 : " << m_windowsID);
|
||||
ewol::Widget * tmpWidget = ewol::widgetManager::Get(m_windowsID);
|
||||
if (NULL != tmpWidget) {
|
||||
EWOL_INFO(" find .. ");
|
||||
((ewol::Windows*)tmpWidget)->KeyboardHide();
|
||||
}
|
||||
}
|
||||
//return GenEventInputExternal(eventExternId, x, y);
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
void ewol::Keyboard::SetMinSise(etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
EWOL_ERROR("Pop-up can not have a user Minimum size (herited from under elements)");
|
||||
}
|
||||
|
||||
void ewol::Keyboard::SetExpendX(bool newExpend)
|
||||
{
|
||||
EWOL_ERROR("Pop-up can not have a user expend settings X (herited from under elements)");
|
||||
}
|
||||
|
||||
void ewol::Keyboard::SetExpendY(bool newExpend)
|
||||
{
|
||||
EWOL_ERROR("Pop-up can not have a user expend settings Y (herited from under elements)");
|
||||
}
|
||||
|
||||
|
||||
bool ewol::Keyboard::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
||||
{
|
||||
//EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")");
|
||||
// pop-up fill all the display :
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
|
||||
if (NULL != m_subWidget) {
|
||||
coord subWidgetSize;
|
||||
coord subWidgetOrigin;
|
||||
subWidgetSize = m_subWidget->GetMinSize();
|
||||
if (true == m_subWidget->CanExpentX()) {
|
||||
subWidgetSize.x = m_size.x;
|
||||
}
|
||||
if (true == m_subWidget->CanExpentY()) {
|
||||
subWidgetSize.y = m_size.y;
|
||||
}
|
||||
// force to be an integer ...
|
||||
subWidgetSize.x = (int32_t)subWidgetSize.x;
|
||||
subWidgetSize.y = (int32_t)subWidgetSize.y;
|
||||
|
||||
m_subWidget->SetOrigin(m_origin.x, m_origin.y);
|
||||
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ewol::Keyboard::CalculateMinSize(void)
|
||||
{
|
||||
m_userExpendX=false;
|
||||
m_userExpendY=false;
|
||||
m_minSize.x = 50.0;
|
||||
m_minSize.y = 50.0;
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->CalculateMinSize();
|
||||
coord tmpSize = m_subWidget->GetMinSize();
|
||||
m_minSize.x = tmpSize.x;
|
||||
m_minSize.y = tmpSize.y;
|
||||
}
|
||||
//EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ewol::Keyboard::OnDraw(void)
|
||||
{
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->GenDraw();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ewol::Keyboard::OnRegenerateDisplay(void)
|
||||
{
|
||||
color_ts mycolor;
|
||||
mycolor.red = 1.0;
|
||||
mycolor.green = 1.0;
|
||||
mycolor.blue = 1.0;
|
||||
mycolor.alpha = 0.50;
|
||||
|
||||
// generate a white background and take gray on other surfaces
|
||||
ClearOObjectList();
|
||||
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
|
||||
|
||||
BGOObjects->SetColor(mycolor);
|
||||
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
||||
AddOObject(BGOObjects, "ListDeco");
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->OnRegenerateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
bool ewol::Keyboard::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
if (NULL != m_subWidget) {
|
||||
return m_subWidget->GenEventInput(IdInput, typeEvent, x, y);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
63
Sources/libewol/ewol/widgetMeta/Keyboard.h
Normal file
63
Sources/libewol/ewol/widgetMeta/Keyboard.h
Normal file
@ -0,0 +1,63 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file ewol/widgetMeta/Keyboard.h
|
||||
* @brief ewol keyboard meta widget system (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 07/01/2012
|
||||
* @par Project
|
||||
* ewol
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __EWOL_WIDGET_META_KEYBOARD_H__
|
||||
#define __EWOL_WIDGET_META_KEYBOARD_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/Widget.h>
|
||||
|
||||
namespace ewol {
|
||||
typedef enum {
|
||||
KEYBOARD_MODE_TEXT,
|
||||
KEYBOARD_MODE_CODE,
|
||||
} keyboardMode_te;
|
||||
|
||||
class Keyboard : public ewol::Widget
|
||||
{
|
||||
public:
|
||||
Keyboard(int32_t windowsID);
|
||||
~Keyboard(void);
|
||||
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
||||
void SetMode(keyboardMode_te mode);
|
||||
private:
|
||||
keyboardMode_te m_mode;
|
||||
ewol::Widget* m_subWidget;
|
||||
int32_t m_windowsID;
|
||||
public:
|
||||
virtual bool CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY); // this generate the current size ...
|
||||
virtual bool CalculateMinSize(void); //update the min Size ... and the expend parameters for the sizer
|
||||
protected:
|
||||
virtual bool OnDraw(void);
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
virtual void SetMinSise(etkFloat_t x=-1, etkFloat_t y=-1);
|
||||
virtual void SetExpendX(bool newExpend=false);
|
||||
virtual void SetExpendY(bool newExpend=false);
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
173
Sources/libewol/ewol/widgetMeta/StdPopUp.cpp
Normal file
173
Sources/libewol/ewol/widgetMeta/StdPopUp.cpp
Normal file
@ -0,0 +1,173 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file ewol/widgetMeta/StdPopUP.cpp
|
||||
* @brief ewol standard pop-up widget system (Sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 01/01/2012
|
||||
* @par Project
|
||||
* ewol
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <ewol/widgetMeta/stdPopUp.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <etk/VectorType.h>
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::StdPopUp"
|
||||
|
||||
|
||||
const char * const ewolEventFileStdPopUpCancel = "ewol event std_pop_up cancel";
|
||||
const char * const ewolEventFileStdPopUpValidate = "ewol event std_pop_up validate";
|
||||
const char * const ewolEventFileStdPopUpButton1 = "ewol event std_pop_up BT1";
|
||||
const char * const ewolEventFileStdPopUpButton2 = "ewol event std_pop_up BT2";
|
||||
const char * const ewolEventFileStdPopUpButton3 = "ewol event std_pop_up BT3";
|
||||
const char * const ewolEventFileStdPopUpButton4 = "ewol event std_pop_up BT4";
|
||||
|
||||
|
||||
ewol::FileChooser::FileChooser(void)
|
||||
{
|
||||
AddEventId(ewolEventFileStdPopUpCancel);
|
||||
AddEventId(ewolEventFileStdPopUpValidate);
|
||||
AddEventId(ewolEventFileStdPopUpButton1);
|
||||
AddEventId(ewolEventFileStdPopUpButton2);
|
||||
AddEventId(ewolEventFileStdPopUpButton3);
|
||||
AddEventId(ewolEventFileStdPopUpButton4);
|
||||
|
||||
m_widgetTitleId = -1;
|
||||
m_widgetValidateId = -1;
|
||||
m_widgetCancelId = -1;
|
||||
|
||||
|
||||
ewol::SizerVert * mySizerVert = NULL;
|
||||
ewol::SizerHori * mySizerHori = NULL;
|
||||
ewol::Button * myButton = NULL;
|
||||
ewol::Entry * myEntry = NULL;
|
||||
ewol::Spacer * mySpacer = NULL;
|
||||
FileChooserFileList * myListFile = NULL;
|
||||
FileChooserFolderList * myListFolder = NULL;
|
||||
ewol::Label * myLabel = NULL;
|
||||
|
||||
mySizerVert = new ewol::SizerVert();
|
||||
// set it in the pop-up-system :
|
||||
SubWidgetSet(mySizerVert);
|
||||
|
||||
myLabel = new ewol::Label("File chooser ...");
|
||||
m_widgetTitleId = myLabel->GetWidgetId();
|
||||
mySizerVert->SubWidgetAdd(myLabel);
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerHori->LockExpendContamination(true);
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
myButton = new ewol::Button("<-");
|
||||
myButton->ExternLinkOnEvent("ewol Button Pressed", GetWidgetId(), ewolEventFileChooserFolderUp );
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
myEntry = new ewol::Entry("~/");
|
||||
m_widgetCurrentFolderId = myEntry->GetWidgetId();
|
||||
myEntry->SetExpendX(true);
|
||||
myEntry->SetFillX(true);
|
||||
myEntry->SetWidth(200);
|
||||
mySizerHori->SubWidgetAdd(myEntry);
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerHori->LockExpendContamination(true);
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
myListFolder = new FileChooserFolderList();
|
||||
m_widgetListFolderId = myListFolder->GetWidgetId();
|
||||
//myList->SetExpendX(true);
|
||||
myListFolder->SetExpendY(true);
|
||||
myListFolder->SetFillY(true);
|
||||
mySizerHori->SubWidgetAdd(myListFolder);
|
||||
myListFile = new FileChooserFileList();
|
||||
m_widgetListFileId = myListFile->GetWidgetId();
|
||||
myListFile->SetExpendY(true);
|
||||
myListFile->SetFillX(true);
|
||||
myListFile->SetExpendY(true);
|
||||
myListFile->SetFillY(true);
|
||||
mySizerHori->SubWidgetAdd(myListFile);
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerHori->LockExpendContamination(true);
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
mySpacer = new ewol::Spacer();
|
||||
mySpacer->SetExpendX(true);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
myButton = new ewol::Button("Open");
|
||||
m_widgetValidateId = myButton->GetWidgetId();
|
||||
myButton->ExternLinkOnEvent("ewol Button Pressed", GetWidgetId(), ewolEventFileChooserValidate);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
myButton = new ewol::Button("Cancel");
|
||||
m_widgetCancelId = myButton->GetWidgetId();
|
||||
myButton->ExternLinkOnEvent("ewol Button Pressed", GetWidgetId(), ewolEventFileChooserCancel);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
|
||||
|
||||
ewol::FileChooser::~FileChooser(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ewol::FileChooser::SetTitle(etk::String label)
|
||||
{
|
||||
ewol::Label * tmpWidget = (ewol::Label*)ewol::widgetManager::Get(m_widgetTitleId);
|
||||
if (NULL == tmpWidget) {
|
||||
return;
|
||||
}
|
||||
tmpWidget->SetLabel(label);
|
||||
}
|
||||
|
||||
void ewol::FileChooser::SetValidateLabel(etk::String label)
|
||||
{
|
||||
ewol::Button * tmpWidget = (ewol::Button*)ewol::widgetManager::Get(m_widgetValidateId);
|
||||
if (NULL == tmpWidget) {
|
||||
return;
|
||||
}
|
||||
tmpWidget->SetLabel(label);
|
||||
}
|
||||
|
||||
void ewol::FileChooser::SetCancelLabel(etk::String label)
|
||||
{
|
||||
ewol::Button * tmpWidget = (ewol::Button*)ewol::widgetManager::Get(m_widgetCancelId);
|
||||
if (NULL == tmpWidget) {
|
||||
return;
|
||||
}
|
||||
tmpWidget->SetLabel(label);
|
||||
}
|
||||
|
||||
void ewol::FileChooser::SetFolder(etk::String folder)
|
||||
{
|
||||
m_folder = folder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
EWOL_INFO("Receive Event from the BT ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> internalEvent=\"" << eventExternId << "\"" );
|
||||
if (ewolEventFileChooserCancel == eventExternId) {
|
||||
//==> Auto remove ...
|
||||
|
||||
}
|
||||
return GenEventInputExternal(eventExternId, x, y);
|
||||
};
|
54
Sources/libewol/ewol/widgetMeta/StdPopUp.h
Normal file
54
Sources/libewol/ewol/widgetMeta/StdPopUp.h
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file ewol/widgetMeta/StdPopUP.ch
|
||||
* @brief ewol standard pop-up widget system (Header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 01/01/2012
|
||||
* @par Project
|
||||
* ewol
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __EWOL_STD_POP_UP_H__
|
||||
#define __EWOL_STD_POP_UP_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
|
||||
namespace ewol {
|
||||
class StdPopUp : public ewol::PopUp
|
||||
{
|
||||
public:
|
||||
StdPopUp(void);
|
||||
~StdPopUp(void);
|
||||
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
||||
void SetTitle(etk::String label);
|
||||
void SetValidateLabel(etk::String label);
|
||||
void SetCancelLabel(etk::String label);
|
||||
void SetFolder(etk::String folder);
|
||||
private:
|
||||
int32_t m_widgetTitleId;
|
||||
int32_t m_widgetValidateId;
|
||||
int32_t m_widgetCancelId;
|
||||
int32_t m_widgetCurrentFolderId;
|
||||
int32_t m_widgetListFolderId;
|
||||
int32_t m_widgetListFileId;
|
||||
etk::String m_folder;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user