This is the code i have used in the application to implement the widget that displays a number(along with decorated background). Code Snippet:
class CMyClass: public Gtk::Widget { public: //constructor and destructor void UpdateValues(); //Will be called every second private: Glib::RefPtr<Gdk::Window> m_refWnd; //Self. Reference stored when on_realize //is called and a new window is created virtual void on_expose_event(GdkEventExpose * pEvent); void DrawValue(Cairo::RefPtr<Cairo::Context> refCairo); //Draws only value } ...... //Draws the background and then draws the new value void CMyClass::on_expose_event(GdkEventExpose * pevent) { Cairo::RefPtr<Cairo::Context> refCairo; if(m_refWnd) { //Create a cairo context for the window refCairo = m_refWnd->create_cairo_context(); //Draw background (border etc) .... //Draw label and other static text ... //Draw value DrawValue(refCairo); } } //Simply updates the value area (only) of the widget void CMyClass::UpdateValues() { Cairo::RefPtr<Cairo::Context> refCairo; if(m_refWnd) { DrawValue(m_refWnd->create_cairo_context()); } } void CMyClass::DrawValue(Cairo::RefPtr<cairo::Context> refCairo) { //Create a pango layout Glib::RefPtr<Pango::Layout> refPango = Pango::Layout::create(refCairo); //Setup cairo with the foreground color (white) refCairo->set_source_rgb(1, 1, 1); //Select the font description for the pango layout object ... //Add text to the pango object refPango->set_text(.....); //Set drawing position refCairo->move_to(.......); //Add layout info to cairo refPango->add_to_cairo_context(refCairo); //Clear the area in which the value is to be shown m_refWnd->clear_area(....); //Draw!!! refCairo->fill(); } On Tue, Jan 20, 2009 at 1:59 PM, dipjyoti bharali <djde...@gmail.com> wrote: > Hi, > I have ported my gtkmm application with directfb as backend... However in > the application i have some text which have to blink.. They are blinking > when iam compiling it with X11 as backend and not with directfb... Iam > porting the gtkmm/directfb application for Alchemy db1200 board.... the X11 > port was tried with a pc tough.. directfb has been compiled for single > application support(without fusion). Please enlighten... My application is > otherwise running.. > > Thanking you, > DJ >
_______________________________________________ directfb-users mailing list directfb-users@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users