X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fgui%2Fewindowstyle.cpp;h=0ecdc2a245c79ae36ef750194d24ae3702592282;hp=3b8271f63e8ffe07bd8b43649786c06839055217;hb=afbe9cb01976b8e246ceebe299566700f3c55b0c;hpb=dba614edd2aad3c17e244914eaef3809d8300cb1 diff --git a/lib/gui/ewindowstyle.cpp b/lib/gui/ewindowstyle.cpp index 3b8271f..0ecdc2a 100644 --- a/lib/gui/ewindowstyle.cpp +++ b/lib/gui/ewindowstyle.cpp @@ -2,10 +2,44 @@ #include #include #include - +#include +#include eWindowStyle::~eWindowStyle() {} +DEFINE_REF(eWindowStyleManager); + +ePtr NewWindowStylePtr(void) +{ + ePtr ptr; + eWindowStyleManager::getInstance(ptr); + return ptr; +} + +eWindowStyleManager::eWindowStyleManager() +{ + m_instance = this; +} + +eWindowStyleManager::~eWindowStyleManager() +{ + m_instance = 0; +} + +void eWindowStyleManager::getStyle(int style_id, ePtr &style) +{ + std::map >::iterator it = m_current_style.find(style_id); + ASSERT(it != m_current_style.end()); + style = it->second; +} + +void eWindowStyleManager::setStyle(int style_id, eWindowStyle *style) +{ + m_current_style[style_id] = style; +} + +eWindowStyleManager *eWindowStyleManager::m_instance; + DEFINE_REF(eWindowStyleSimple); eWindowStyleSimple::eWindowStyleSimple() @@ -13,7 +47,7 @@ eWindowStyleSimple::eWindowStyleSimple() m_border_left = m_border_right = m_border_bottom = 2; m_border_top = 30; - m_fnt = new gFont("Arial", 25); + m_fnt = new gFont("Regular", 25); m_border_color_tl = gColor(0x1f); m_border_color_br = gColor(0x14); @@ -22,7 +56,7 @@ eWindowStyleSimple::eWindowStyleSimple() m_background_color = gColor(0x19); } -void eWindowStyleSimple::handleNewSize(eWindow *wnd, const eSize &size) +void eWindowStyleSimple::handleNewSize(eWindow *wnd, eSize &size, eSize &offset) { // eDebug("handle new size: %d x %d", size.width(), size.height()); @@ -80,6 +114,14 @@ void eWindowStyleSimple::setStyle(gPainter &painter, int what) painter.setForegroundColor(gColor(0x1C)); painter.setBackgroundColor(m_background_color); break; + case styleListboxMarked: + painter.setForegroundColor(gColor(0x2F)); + painter.setBackgroundColor(gColor(0x2A)); + break; + case styleListboxMarkedAndSelected: + painter.setForegroundColor(gColor(0x3F)); + painter.setBackgroundColor(gColor(0x3A)); + break; } } @@ -106,33 +148,24 @@ void eWindowStyleSimple::drawFrame(gPainter &painter, const eRect &frame, int wh painter.line(frame.bottomLeft1(), frame.topLeft1()); } -DEFINE_REF(eWindowStyleSkinned); - -eWindowStyleSkinned::eWindowStyleSkinned() -{ -} - -void eWindowStyleSkinned::handleNewSize(eWindow *wnd, const eSize &size) -{ -} - -void eWindowStyleSkinned::paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title) -{ -} - -void eWindowStyleSkinned::paintBackground(gPainter &painter, const ePoint &offset, const eSize &size) -{ -} - -void eWindowStyleSkinned::setStyle(gPainter &painter, int what) -{ -} - -void eWindowStyleSkinned::drawFrame(gPainter &painter, const eRect &frame, int what) -{ -} - -void eWindowStyleSkinned::drawBorder(gPainter &painter, const eSize &size, const struct borderSet &border, int where) +RESULT eWindowStyleSimple::getFont(int what, ePtr &fnt) { + fnt = 0; + switch (what) + { + case fontStatic: + fnt = new gFont("Regular", 12); + break; + case fontButton: + fnt = new gFont("Regular", 20); + break; + case fontTitlebar: + fnt = new gFont("Regular", 25); + break; + default: + return -1; + } + return 0; } +eAutoInitPtr init_eWindowStyleManager(eAutoInitNumbers::skin, "eWindowStyleManager");