/** ******************************************************************************* * @file widgetDrawer.cpp * @brief Ewol Drawer : element generator (Sources) * @author Edouard DUPIN * @date 03/03/2012 * @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 * * Term of the licence in in the file licence.txt. * ******************************************************************************* */ #include #include #include #include #include #undef __class__ #define __class__ "widgetDrawer" widgetDrawer::widgetDrawer(void) { m_fontNormal = -1; m_fontSize = 15; m_movingPoint = false; m_lastSelected[0] = -1; m_lastSelected[1] = -1; m_lastSelected[2] = -1; m_textColorFg.red = 0.0; m_textColorFg.green = 0.0; m_textColorFg.blue = 0.0; m_textColorFg.alpha = 1.0; m_textColorBg.red = 0.0; m_textColorBg.green = 0.0; m_textColorBg.blue = 0.0; m_textColorBg.alpha = 0.25; RegisterMultiCast(drawMsgGuiLinkNew); SetCanHaveFocus(true); } widgetDrawer::~widgetDrawer(void) { } bool widgetDrawer::CalculateMinSize(void) { m_minSize.x = 50; m_minSize.y = 50; return true; } void widgetDrawer::OnDraw(void) { m_OObjectsColored[ m_currentDrawId].Draw(); m_OObjectTextNormal[ m_currentDrawId].Draw(); } #define BORDER_SIZE (2) void widgetDrawer::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { // clean internal elements ... m_OObjectTextNormal[ m_currentCreateId].SetFontID(m_fontNormal); m_OObjectTextNormal[ m_currentCreateId].Clear(); m_OObjectsColored[ m_currentCreateId].Clear(); // we set 3 pixels in the border (blue) and draw color_ts bgColor; bgColor.red = 0.0; bgColor.green = 0.0; bgColor.blue = 1.0; bgColor.alpha = 1.0; m_OObjectsColored[m_currentCreateId].SetColor(bgColor); m_OObjectsColored[m_currentCreateId].Rectangle( 0, 0, m_size.x, m_size.y); // we set a white background... and we draw a square ... bgColor.red = 1.0; bgColor.green = 1.0; bgColor.blue = 1.0; bgColor.alpha = 1.0; m_OObjectsColored[m_currentCreateId].SetColor(bgColor); coord2D_ts drawPosStart; coord2D_ts drawPosStop; if (m_size.x < m_size.y) { drawPosStart.x = BORDER_SIZE; drawPosStart.y = BORDER_SIZE; drawPosStop.x = m_size.x-2*BORDER_SIZE; drawPosStop.y = m_size.x-2*BORDER_SIZE; } else { drawPosStart.x = BORDER_SIZE; drawPosStart.y = BORDER_SIZE; drawPosStop.x = m_size.y-2*BORDER_SIZE; drawPosStop.y = m_size.y-2*BORDER_SIZE; } m_OObjectsColored[m_currentCreateId].Rectangle( drawPosStart.x, drawPosStart.y, drawPosStop.x, drawPosStop.y); for (int32_t iii=0; iii= 0) { m_fontNormal = fontID; } }