I'm working with gtkmm + cairomm<br><br>I don't know if its a bug or not.<br><br>I do override the expose-event function of my window.<br>But now anything added over my window isn't rendered except drawing area that their on_expose_event is overrided too.
<br><br>it's like if the window was rendering over everything.<br><br>My main goal is to make a borderless window with rounded corner. <br>And a custom skin for the widgets.<br><br>I can use a custom skin with Gtk::RC rc("
myfile.gtkrc");<br>But my last and only problem is to make a window that doesn't render over every widget...<br>I done that with gtk+ and cairo. <br>But i don't exactly understand why in cairomm it doesn't work.
<br><br>here is what i want to do with cairomm...<br><a href="http://img54.imageshack.us/img54/6558/steambm1.png">http://img54.imageshack.us/img54/6558/steambm1.png</a><br><br>-----------------------------------CairoWindow.cc--------------------------------------------------
<br>#include "cairo-window.h"<br>#include "cairo.h"<br><br>CairoWindow::CairoWindow(){<br> this->on_screen_changed(this->get_screen()); <br>}<br>CairoWindow::~CairoWindow(){}<br><br>bool CairoWindow::on_expose_event(GdkEventExpose* event){
<br> Glib::RefPtr<Gdk::Window> window = get_window();<br> if(window)<br> {<br> Gtk::Allocation allocation = get_allocation();<br> const int width = allocation.get_width();<br> const int height = allocation.get_height
();<br><br> Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();<br> <br> cr->set_source_rgba(0.0, 0.0, 0.0, 0.0);<br> cr->set_operator(Cairo::OPERATOR_SOURCE );<br> cr->rectangle(event->
area.x, event->area.y,<br> event->area.width, event->area.height);<br><br> cr->clip();<br> <br> cr->save();<br> cr->paint();<br> <br> int distance = 10;<br> <br><br> cr->set_source_rgba(
0.27f, 0.27f, 0.27f,1);<br> <br> cr->move_to(distance,0);<br> cr->line_to(width-distance,0);<br> cr->curve_to(width-distance,0, width, 0, width,distance);<br> cr->line_to(width,height-distance);
<br> cr->curve_to(width,height-distance,width,height,width-distance,height);<br> cr->line_to(distance,height);<br> cr->curve_to(distance,height,0,height,0,height - distance);<br> cr->line_to(0,distance);
<br> cr->curve_to(0,distance,0,0,distance,0);<br> cr->fill();<br> <br> cr->set_source_rgba(0.35f, 0.42f, 0.31f,1);<br> cr->move_to(distance,0);<br> cr->line_to(width-distance,0);<br> cr->curve_to(width-distance,0, width, 0, width,distance);
<br> cr->line_to(width, distance * 3);<br> cr->line_to(0, distance * 3);<br> cr->line_to(0, distance);<br> cr->curve_to(0,distance, 0, 0, distance,0);<br> /*cairo_curve_to(cr,0, height - 5, 0, height, 5,height);
<br> cairo_line_to(cr,0, height);<br> cairo_line_to(cr,width,height);<br> cairo_line_to(cr,width,0);*/<br> <br> /*cairo_arc(cr, width / 2, height / 2, (width < height ? width : height) / 2 - 8 , 0, 2 * 3.14
);*/<br> cr->fill();<br> cr->stroke();<br> cr->restore();<br> }<br>}<br><br>void CairoWindow::on_screen_changed( const Glib::RefPtr<Gdk::Screen>& previous_screen ){<br> const Glib::RefPtr<Gdk::Screen> screen = this->get_screen();
<br> const Glib::RefPtr<Gdk::Colormap> colormap = screen->get_rgba_colormap();<br> <br> if(colormap){<br> std::cout << "Screen support alpha channel";<br> }else{<br> std::cout << "Screen support alpha channel";
<br> }<br> this->set_colormap(colormap);<br>};<br><br>----------------------------------------------------------------------------------------------------------<br>------------------------------------------CairoWindow.h--------------------------------------------
<br>#ifndef GTKMM_CAIRO_WINDOW_H<br>#define GTKMM_CAIRO_WINDOW_H<br><br>#include <gtkmm/window.h><br>#include <iostream><br><br>class CairoWindow : public Gtk::Window<br>{<br> public:<br> CairoWindow();
<br> virtual ~CairoWindow();<br><br> protected:<br> //Override default signal handler:<br> virtual bool on_expose_event(GdkEventExpose* event); <br> virtual void on_screen_changed( const Glib::RefPtr<Gdk::Screen>& previous_screen);
<br>};<br><br>#endif // GTKMM_EXAMPLE_CLOCK_H<br><br>-----------------------------------------------------------------------------------------------------------<br><br>I may be missing something but i believe this is fairly simple
<br>