Back to index

easystroke  0.5.5.1
Public Member Functions | Private Member Functions | Private Attributes
Popup Class Reference

#include <composite.h>

List of all members.

Public Member Functions

 Popup (int x1, int y1, int x2, int y2)
void invalidate (int x1, int y1, int x2, int y2)

Private Member Functions

bool on_expose (GdkEventExpose *event)
void draw_line (Cairo::RefPtr< Cairo::Context > ctx)

Private Attributes

Gdk::Rectangle rect

Detailed Description

Definition at line 23 of file composite.h.


Constructor & Destructor Documentation

Popup::Popup ( int  x1,
int  y1,
int  x2,
int  y2 
)

Definition at line 24 of file composite.cc.

                                           : Gtk::Window(Gtk::WINDOW_POPUP), rect(x1, y1, x2-x1, y2-y1) {
       if (!is_composited())
              throw std::runtime_error(_("'composite' not available"));

       Glib::RefPtr<Gdk::Colormap> colormap = get_screen()->get_rgba_colormap();
       if (colormap)
              set_colormap(colormap);
       signal_expose_event().connect(sigc::mem_fun(*this, &Popup::on_expose));
       realize();
       move(x1, y1);
       resize(x2-x1, y2-y1);
       get_window()->input_shape_combine_region(Gdk::Region(), 0, 0);
       // tell compiz to leave this window the hell alone
       get_window()->set_type_hint(Gdk::WINDOW_TYPE_HINT_DESKTOP);
}

Here is the call graph for this function:


Member Function Documentation

void Popup::draw_line ( Cairo::RefPtr< Cairo::Context >  ctx) [private]

Definition at line 93 of file composite.cc.

                                                   {
       if (!points.size())
              return;
       std::list<Trace::Point>::iterator i = points.begin();
       ctx->move_to (i->x, i->y);
       for (; i != points.end(); i++)
              ctx->line_to (i->x, i->y);
       ctx->set_source_rgba((red+0.5)/2.0, (green+0.5)/2.0, (blue+0.5)/2.0, alpha/2.0);
       ctx->set_line_width(width+1.0);
       ctx->set_line_cap(Cairo::LINE_CAP_ROUND);
       ctx->set_line_join(Cairo::LINE_JOIN_ROUND);
       ctx->stroke_preserve();

       ctx->set_source_rgba(red, green, blue, alpha);
       ctx->set_line_width(width*0.7);
       ctx->stroke();

}

Here is the caller graph for this function:

void Popup::invalidate ( int  x1,
int  y1,
int  x2,
int  y2 
)

Definition at line 40 of file composite.cc.

                                                     {
       if (is_mapped()) {
              Gdk::Rectangle inv(x1 - rect.get_x(), y1 - rect.get_y(), x2-x1, y2-y1);
              get_window()->invalidate_rect(inv, false);
       } else
              show();
}

Here is the call graph for this function:

bool Popup::on_expose ( GdkEventExpose *  event) [private]

Definition at line 112 of file composite.cc.

                                           {
       Cairo::RefPtr<Cairo::Context> ctx = get_window()->create_cairo_context();
       ctx->set_operator(Cairo::OPERATOR_SOURCE);

       Gdk::Region region(event->region, true);
       Gdk::Cairo::add_region_to_path(ctx, region);
       ctx->clip();

       Gdk::Cairo::add_region_to_path(ctx, region);
       ctx->set_source_rgba(0.0, 0.0, 0.0, 0.0);
       ctx->fill();

       ctx->translate(-rect.get_x(), -rect.get_y());
       draw_line(ctx);

       return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Gdk::Rectangle Popup::rect [private]

Definition at line 26 of file composite.h.


The documentation for this class was generated from the following files: