From dbb43d9883bd7d979dd6eacfa009b972c686ecf1 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Fri, 2 Mar 2012 20:16:05 +0100 Subject: [PATCH] first step to create the real drawer --- jni/Main.cpp | 103 +++++++++++++++++++++------------------------- jni/file.mk | 1 + jni/globalMsg.cpp | 36 ++++++++++++++++ jni/globalMsg.h | 42 +++++++++++++++++++ 4 files changed, 127 insertions(+), 55 deletions(-) create mode 100644 jni/globalMsg.cpp create mode 100644 jni/globalMsg.h diff --git a/jni/Main.cpp b/jni/Main.cpp index 0ff24b7..a710208 100644 --- a/jni/Main.cpp +++ b/jni/Main.cpp @@ -35,8 +35,10 @@ #include #include #include +#include #include #include +#include #include @@ -53,6 +55,7 @@ class MaListExemple : public ewol::List public: MaListExemple(void) { }; ~MaListExemple(void) { }; + /* virtual color_ts GetBasicBG(void) { color_ts bg; bg.red = 1.0; @@ -61,7 +64,7 @@ class MaListExemple : public ewol::List bg.alpha = 1.0; return bg; } - + */ uint32_t GetNuberOfColomn(void) { return 1; }; @@ -124,14 +127,40 @@ const char * const drawerEventRequestOpenFileClosed = "Drawer Close Open File" const char * const drawerEventRequestOpenFileSelected = "Drawer Open Selected File"; -class Plop : public ewol::Windows +class MainWindows :public ewol::Windows { public: - Plop(void) + MainWindows(void) { + ewol::SizerVert * mySizerVert = new ewol::SizerVert(); + SetSubWidget(mySizerVert); + ewol::Menu * myMenu = new ewol::Menu(); + mySizerVert->SubWidgetAdd(myMenu); + int32_t idMenuFile = myMenu->AddTitle("File"); + (void)myMenu->Add(idMenuFile, "New", "", drawMsgGuiNew); + (void)myMenu->AddSpacer(); + (void)myMenu->Add(idMenuFile, "Open", "", drawMsgGuiOpen); + (void)myMenu->Add(idMenuFile, "Close", "", drawMsgGuiClose); + (void)myMenu->Add(idMenuFile, "Save", "", drawMsgGuiSave); + (void)myMenu->Add(idMenuFile, "Save As ...", "", drawMsgGuiSaveAs); + (void)myMenu->AddSpacer(); + int32_t idMenuEdit = myMenu->AddTitle("Edit"); + (void)myMenu->Add(idMenuEdit, "Undo", "", drawMsgGuiUndo); + (void)myMenu->Add(idMenuEdit, "Redo", "", drawMsgGuiRedo); + int32_t idMenuElement = myMenu->AddTitle("Element"); + (void)myMenu->Add(idMenuElement, "Element new", "", drawMsgGuiElementNew); + (void)myMenu->Add(idMenuElement, "Element Remove", "", drawMsgGuiElementRemove); + (void)myMenu->Add(idMenuElement, "Element hide/show", "", drawMsgGuiElementHideShow); + (void)myMenu->AddSpacer(); + (void)myMenu->Add(idMenuElement, "Dot Add", "", drawMsgGuiDotAdd); + (void)myMenu->Add(idMenuElement, "Dot Rm", "", drawMsgGuiDotRm); + (void)myMenu->AddSpacer(); + (void)myMenu->Add(idMenuElement, "Link Start", "", drawMsgGuiLinkStart); + (void)myMenu->Add(idMenuElement, "Link Stop", "", drawMsgGuiLinkStop); + // generate the display : ewol::SizerHori * mySizer = new ewol::SizerHori(); - SetSubWidget(mySizer); + mySizerVert->SubWidgetAdd(mySizer); MaListExemple * myList = new MaListExemple(); @@ -140,56 +169,10 @@ class Plop : public ewol::Windows myList->SetFillY(true); mySizer->SubWidgetAdd(myList); - ewol::SizerVert * mySizerVert = new ewol::SizerVert(); - mySizer->SubWidgetAdd(mySizerVert); - - ewol::Button * myButton = new ewol::Button("LB"); - mySizerVert->SubWidgetAdd(myButton); - - ewol::Entry * myEntry = new ewol::Entry("basic Text"); - myEntry->SetWidth(120); - mySizerVert->SubWidgetAdd(myEntry); - - ewol::Label * myLabel = new ewol::Label("Mon label"); - myLabel->SetExpendY(true); - myLabel->SetFillY(true); - mySizerVert->SubWidgetAdd(myLabel); - - mySizerVert = new ewol::SizerVert(); - mySizer->SubWidgetAdd(mySizerVert); - - myEntry = new ewol::Entry("Mega super plop"); - //myEntry->SetExpendY(true); - //myEntry->SetFillY(true); - //myEntry->SetExpendX(true); - myEntry->SetFillX(true); - myEntry->SetWidth(120); - mySizerVert->SubWidgetAdd(myEntry); - - - myButton = new ewol::Button("Test Pop-up"); - myButton->SetExpendX(true); - //myButton->SetExpendY(true); - myButton->SetFillX(true); - myButton->RegisterOnEvent(this, ewolEventButtonPressed, drawerEventRequestOpenFile); - mySizerVert->SubWidgetAdd(myButton); - - ewol::CheckBox * myCheckBox = new ewol::CheckBox("mon label d'eK"); - mySizerVert->SubWidgetAdd(myCheckBox); - myCheckBox = new ewol::CheckBox("Exemple 2"); - mySizerVert->SubWidgetAdd(myCheckBox); - myCheckBox = new ewol::CheckBox("Exemple 3 et יא$"); - mySizerVert->SubWidgetAdd(myCheckBox); - - myButton = new ewol::Button("4 4 BT"); - myButton->SetFillX(true); - myButton->SetFillY(true); - myButton->SetExpendY(true); - mySizerVert->SubWidgetAdd(myButton); }; - ~Plop(void) + ~MainWindows(void) { }; @@ -227,13 +210,14 @@ class Plop : public ewol::Windows }; }; -static Plop * myWindowsExample = NULL; +static MainWindows * basicWindows = NULL; /** * @brief main application function Initialisation */ void APP_Init(void) { + DRAW_INFO("==> Init Ewol Drawer (START)"); ewol::ChangeSize(800, 600); /* if (true == ewol::AddFont("dataTest/TextMonospace.ebt", true, true, true) ) { @@ -270,11 +254,12 @@ void APP_Init(void) ewol::SetDefaultFont("freefont/FreeSerif.ttf", 12); #endif - myWindowsExample = new Plop(); + basicWindows = new MainWindows(); // create the specific windows - ewol::DisplayWindows(myWindowsExample); + ewol::DisplayWindows(basicWindows); + DRAW_INFO("==> Init Ewol Drawer (END)"); } /** @@ -282,5 +267,13 @@ void APP_Init(void) */ void APP_UnInit(void) { - delete(myWindowsExample); + DRAW_INFO("==> Un-Init Ewol Drawer (START)"); + // Remove windows : + ewol::DisplayWindows(NULL); + + if (NULL != basicWindows) { + basicWindows->MarkToRemove(); + basicWindows = NULL; + } + DRAW_INFO("==> Un-Init Ewol Drawer (END)"); } diff --git a/jni/file.mk b/jni/file.mk index 8109d7e..5d1c449 100644 --- a/jni/file.mk +++ b/jni/file.mk @@ -2,5 +2,6 @@ FILE_LIST = Main.cpp \ Debug.cpp \ + globalMsg.cpp \ diff --git a/jni/globalMsg.cpp b/jni/globalMsg.cpp new file mode 100644 index 0000000..2bbce8c --- /dev/null +++ b/jni/globalMsg.cpp @@ -0,0 +1,36 @@ +/** + ******************************************************************************* + * @file globalMsg.cpp + * @brief ewol drawer global message system (sources) + * @author Edouard DUPIN + * @date 02/03/2012 + * @par Project + * Edn + * + * @par Copyright + * Copyright 2010 Edouard DUPIN, all right reserved + * + ******************************************************************************* + */ + +#include + +//////////////////////////////////////////////////////////////////////// +// Event of the gui request something : +//////////////////////////////////////////////////////////////////////// +extern const char* const drawMsgGuiNew = "draw-Msg-Gui-New"; +extern const char* const drawMsgGuiOpen = "draw-Msg-Gui-Open"; +extern const char* const drawMsgGuiClose = "draw-Msg-Gui-Close"; +extern const char* const drawMsgGuiSave = "draw-Msg-Gui-Save"; +extern const char* const drawMsgGuiSaveAs = "draw-Msg-Gui-SaveAs"; + +extern const char* const drawMsgGuiUndo = "draw-Msg-Gui-Undo"; +extern const char* const drawMsgGuiRedo = "draw-Msg-Gui-Redo"; + +extern const char* const drawMsgGuiElementNew = "draw-Msg-Gui-Element-new"; +extern const char* const drawMsgGuiElementRemove = "draw-Msg-Gui-Element-remove"; +extern const char* const drawMsgGuiElementHideShow = "draw-Msg-Gui-Element-hide"; +extern const char* const drawMsgGuiDotAdd = "draw-Msg-Gui-Dot-Add"; +extern const char* const drawMsgGuiDotRm = "draw-Msg-Gui-Dot-Rm"; +extern const char* const drawMsgGuiLinkStart = "draw-Msg-Gui-Link-Start"; +extern const char* const drawMsgGuiLinkStop = "draw-Msg-Gui-Link-Stop"; diff --git a/jni/globalMsg.h b/jni/globalMsg.h new file mode 100644 index 0000000..e2682cb --- /dev/null +++ b/jni/globalMsg.h @@ -0,0 +1,42 @@ +/** + ******************************************************************************* + * @file globalMsg.h + * @brief ewol drawer global message system (header) + * @author Edouard DUPIN + * @date 02/03/2012 + * @par Project + * Edn + * + * @par Copyright + * Copyright 2010 Edouard DUPIN, all right reserved + * + ******************************************************************************* + */ + +#ifndef __GLOBAL_MSG_H__ +#define __GLOBAL_MSG_H__ + + +// new list of edn event generic : +//////////////////////////////////////////////////////////////////////// +// Event of the gui request something : +//////////////////////////////////////////////////////////////////////// + extern const char* const drawMsgGuiNew; // data : "" + extern const char* const drawMsgGuiOpen; // data : "" + extern const char* const drawMsgGuiClose; // data : "" + extern const char* const drawMsgGuiSave; // data : "" + extern const char* const drawMsgGuiSaveAs; // data : "" + + extern const char* const drawMsgGuiUndo; // data : "" + extern const char* const drawMsgGuiRedo; // data : "" + + extern const char* const drawMsgGuiElementNew; + extern const char* const drawMsgGuiElementRemove; + extern const char* const drawMsgGuiElementHideShow; + extern const char* const drawMsgGuiDotAdd; + extern const char* const drawMsgGuiDotRm; + extern const char* const drawMsgGuiLinkStart; + extern const char* const drawMsgGuiLinkStop; + +#endif +