2011-07-20 10:33:24 +02:00
|
|
|
/**
|
|
|
|
*******************************************************************************
|
|
|
|
* @file CodeView.h
|
|
|
|
* @brief Editeur De N'ours : Code Viewer Widget (header)
|
|
|
|
* @author Edouard DUPIN
|
|
|
|
* @date 05/01/2011
|
|
|
|
* @par Project
|
|
|
|
* Edn
|
|
|
|
*
|
|
|
|
* @par Copyright
|
|
|
|
* Copyright 2010 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
|
|
|
|
* You can not earn money with this Software (if the source extract from Edn
|
|
|
|
* represent less than 50% of original Sources)
|
|
|
|
* Term of the licence in in the file licence.txt.
|
|
|
|
*
|
|
|
|
*******************************************************************************
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __CODE_VIEW_H__
|
|
|
|
#define __CODE_VIEW_H__
|
|
|
|
|
2012-04-23 10:15:43 +02:00
|
|
|
#include <appl/Debug.h>
|
2012-01-11 15:26:53 +01:00
|
|
|
#include <CodeView.h>
|
|
|
|
#include <BufferManager.h>
|
|
|
|
#include <MsgBroadcast.h>
|
2011-07-20 10:33:24 +02:00
|
|
|
|
2012-01-13 13:06:15 +01:00
|
|
|
#include <etk/Types.h>
|
2012-02-06 17:59:48 +01:00
|
|
|
#include <ewol/widget/WidgetScrolled.h>
|
2012-01-13 13:06:15 +01:00
|
|
|
|
2012-03-14 09:26:14 +01:00
|
|
|
//!< EObject name :
|
|
|
|
extern const char * const TYPE_EOBJECT_EDN_CODE_VIEW;
|
|
|
|
|
2012-02-06 17:59:48 +01:00
|
|
|
class CodeView :public ewol::WidgetScrooled
|
2012-01-13 13:06:15 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CodeView(void);
|
|
|
|
virtual ~CodeView(void);
|
2012-03-14 09:26:14 +01:00
|
|
|
/**
|
|
|
|
* @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
|
|
|
|
* @param[in] objectType type of the object we want to check
|
|
|
|
* @return true if the object is compatible, otherwise false
|
|
|
|
*/
|
|
|
|
bool CheckObjectType(const char * const objectType);
|
|
|
|
/**
|
|
|
|
* @brief Get the current Object type of the EObject
|
|
|
|
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
|
|
|
|
* @param[in] objectType type description
|
|
|
|
* @return true if the object is compatible, otherwise false
|
|
|
|
*/
|
|
|
|
const char * const GetObjectType(void);
|
2012-01-13 13:06:15 +01:00
|
|
|
virtual bool CalculateMinSize(void);
|
|
|
|
private:
|
2012-02-18 15:56:00 +01:00
|
|
|
etk::UString m_label;
|
|
|
|
color_ts m_textColorFg; //!< Text color
|
|
|
|
color_ts m_textColorBg; //!< Background color
|
|
|
|
int32_t m_bufferID;
|
|
|
|
bool m_buttunOneSelected;
|
|
|
|
// drawing elements :
|
|
|
|
ewol::OObject2DTextColored m_OObjectTextNormal[NB_BOUBLE_BUFFER];
|
|
|
|
ewol::OObject2DTextColored m_OObjectTextBold[NB_BOUBLE_BUFFER];
|
|
|
|
ewol::OObject2DTextColored m_OObjectTextItalic[NB_BOUBLE_BUFFER];
|
|
|
|
ewol::OObject2DTextColored m_OObjectTextBoldItalic[NB_BOUBLE_BUFFER];
|
|
|
|
ewol::OObject2DColored m_OObjectsColored[NB_BOUBLE_BUFFER];
|
|
|
|
|
2012-01-13 13:06:15 +01:00
|
|
|
public:
|
|
|
|
virtual void OnRegenerateDisplay(void);
|
2012-02-29 18:06:08 +01:00
|
|
|
/**
|
|
|
|
* @brief Receive a message from an other EObject with a specific eventId and data
|
|
|
|
* @param[in] CallerObject Pointer on the EObject that information came from
|
|
|
|
* @param[in] eventId Message registered by this class
|
|
|
|
* @param[in] data Data registered by this class
|
|
|
|
* @return ---
|
|
|
|
*/
|
|
|
|
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
2012-01-13 13:06:15 +01:00
|
|
|
public:
|
2012-03-09 18:08:08 +01:00
|
|
|
/**
|
|
|
|
* @brief Event on an input of this Widget
|
|
|
|
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
|
|
|
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
|
|
|
* @param[in] pos Absolute position of the event
|
|
|
|
* @return true the event is used
|
|
|
|
* @return false the event is not used
|
|
|
|
*/
|
|
|
|
virtual bool OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, coord2D_ts pos);
|
2012-02-13 18:03:09 +01:00
|
|
|
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData);
|
2012-01-17 15:35:34 +01:00
|
|
|
virtual bool OnEventKbMove(ewol::eventKbType_te typeEvent, ewol::eventKbMoveType_te moveTypeEvent);
|
2012-04-17 11:01:26 +02:00
|
|
|
|
2012-01-17 15:35:34 +01:00
|
|
|
virtual void OnGetFocus(void);
|
|
|
|
virtual void OnLostFocus(void);
|
2011-07-20 10:33:24 +02:00
|
|
|
private:
|
2012-02-03 18:14:45 +01:00
|
|
|
int32_t m_fontSize;
|
|
|
|
int32_t m_fontNormal;
|
|
|
|
int32_t m_fontBold;
|
|
|
|
int32_t m_fontItalic;
|
|
|
|
int32_t m_fontBoldItalic;
|
|
|
|
public:
|
|
|
|
void SetFontSize(int32_t size);
|
2012-02-15 16:23:20 +01:00
|
|
|
void SetFontNameNormal(etk::UString fontName);
|
|
|
|
void SetFontNameBold(etk::UString fontName);
|
|
|
|
void SetFontNameItalic(etk::UString fontName);
|
|
|
|
void SetFontNameBoldItalic(etk::UString fontName);
|
2012-02-07 18:04:15 +01:00
|
|
|
private:
|
|
|
|
void CalculateMaxSize(void);
|
2012-02-18 15:56:00 +01:00
|
|
|
protected:
|
2012-03-09 18:08:08 +01:00
|
|
|
virtual void OnDraw(void);
|
2011-07-20 10:33:24 +02:00
|
|
|
};
|
2012-01-13 13:06:15 +01:00
|
|
|
|
2012-03-14 09:26:14 +01:00
|
|
|
#define EDN_CAST_CODE_VIEW(curentPointer) EWOL_CAST(TYPE_EOBJECT_EDN_CODE_VIEW,CodeView,curentPointer)
|
|
|
|
|
2012-01-13 13:06:15 +01:00
|
|
|
#endif
|
|
|
|
|