static void draw_radio (GtkWidget *widget, cairo_t *cr, gint x, gint y, GtkStateFlags state, gint *width, gint *height) { GtkStyleContext *button_context; GtkStyleContext *check_context; gint contents_x, contents_y, contents_width, contents_height; /* This information is taken from the GtkRadioButton docs, see "CSS nodes" */ button_context = get_style (NULL, "radiobutton"); check_context = get_style (button_context, "radio"); gtk_style_context_set_state (check_context, state); *width = *height = 0; query_size (button_context, width, height); query_size (check_context, width, height); draw_style_common (button_context, cr, x, y, *width, *height, NULL, NULL, NULL, NULL); draw_style_common (check_context, cr, x, y, *width, *height, &contents_x, &contents_y, &contents_width, &contents_height); gtk_render_check (check_context, cr, contents_x, contents_y, contents_width, contents_height); g_object_unref (check_context); g_object_unref (button_context); }
static void draw_progress (GtkWidget *widget, cairo_t *cr, gint x, gint y, gint width, gint position, gint *height) { GtkStyleContext *bar_context; GtkStyleContext *trough_context; GtkStyleContext *progress_context; /* This information is taken from the GtkProgressBar docs, see "CSS nodes" */ bar_context = get_style (NULL, "progressbar.horizontal"); trough_context = get_style (bar_context, "trough"); progress_context = get_style (trough_context, "progress.left"); *height = 0; query_size (bar_context, NULL, height); query_size (trough_context, NULL, height); query_size (progress_context, NULL, height); draw_style_common (bar_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL); draw_style_common (trough_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL); draw_style_common (progress_context, cr, x, y, position, *height, NULL, NULL, NULL, NULL); g_object_unref (progress_context); g_object_unref (trough_context); g_object_unref (bar_context); }
static void draw_radio (GtkWidget *widget, cairo_t *cr, gint x, gint y, GtkStateFlags state) { GtkStyleContext *button_context; GtkStyleContext *check_context; /* This information is taken from the GtkRadioButton docs, see "CSS nodes" */ const char *path[2] = { "radiobutton", "radio" }; button_context = get_style (NULL, path[0]); check_context = get_style (button_context, path[1]); gtk_style_context_set_state (check_context, state); gtk_render_background (check_context, cr, x, y, 20, 20); gtk_render_frame (check_context, cr, x, y, 20, 20); gtk_render_option (check_context, cr, x, y, 20, 20); g_object_unref (check_context); g_object_unref (button_context); }
void Table::draw_deck() { int i=0; for (card_it=card_list.begin();card_it!=card_list.end();card_it++) { //Draw the non-moving cards if(!(*card_it)->moving) { if(!(*card_it)->pointed) { //Draw the cards back->draw_pixbuf(get_style()->get_black_gc(),(*card_it)->card_f->scaled, 0, 0,2+get_width()/40*i,get_height()-(*card_it)->card_f->scaled->get_height(),-1,-1, Gdk::RGB_DITHER_NONE, 0, 0); } else { //Draw the cards back->draw_pixbuf(get_style()->get_black_gc(),(*card_it)->card_f->scaled, 0, 0,2+get_width()/40*i,get_height()-(*card_it)->card_f->scaled->get_height()-get_height()/60,-1,-1, Gdk::RGB_DITHER_NONE, 0, 0); } } i++; } }
void RegionChooser::motion_resize_region(int x, int y) { const int w = get_width() - 1; Glib::RefPtr<Gdk::Window> window = get_window(); int k = int(double(x) / w * 128.0 + 0.5); if (k < resize.min) k = resize.min; else if (k > resize.max) k = resize.max; if (k != resize.pos) { if (resize.mode == resize.undecided) { if (k < resize.pos) { // edit high limit of prev_region resize.max = resize.region->KeyRange.low; resize.region = resize.prev_region; resize.mode = resize.moving_high_limit; } else { // edit low limit of region resize.min = resize.prev_region->KeyRange.high + 1; resize.mode = resize.moving_low_limit; } } Glib::RefPtr<const Gdk::GC> black = get_style()->get_black_gc(); Glib::RefPtr<const Gdk::GC> white = get_style()->get_white_gc(); if (region == resize.region) { gc->set_foreground(red); white = gc; } Glib::RefPtr<const Gdk::GC> bg = get_style()->get_bg_gc(Gtk::STATE_NORMAL); int prevx = int(w * resize.pos / 128.0 + 0.5); x = int(w * k / 128.0 + 0.5); if (resize.mode == resize.moving_high_limit) { if (k > resize.pos) { window->draw_rectangle(white, true, prevx, 1, x - prevx, h1 - 2); window->draw_line(black, prevx, 0, x, 0); window->draw_line(black, prevx, h1 - 1, x, h1 - 1); } else { int xx = ((resize.pos == resize.max && resize.max != 128) ? 1 : 0); window->draw_rectangle(bg, true, x + 1, 0, prevx - x - xx, h1); } } else { if (k < resize.pos) { window->draw_rectangle(white, true, x + 1, 1, prevx - x, h1 - 2); window->draw_line(black, x, 0, prevx, 0); window->draw_line(black, x, h1 - 1, prevx, h1 - 1); } else { int xx = ((resize.pos == resize.min && resize.min != 0) ? 1 : 0); window->draw_rectangle(bg, true, prevx + xx, 0, x - prevx - xx, h1); } } window->draw_line(black, x, 1, x, h1 - 2); resize.pos = k; } }
bool IfcGeom::Kernel::convert(const IfcSchema::IfcFacetedBrep* l, IfcRepresentationShapeItems& shape) { TopoDS_Shape s; const SurfaceStyle* collective_style = get_style(l); if (convert_shape(l->Outer(),s) ) { const SurfaceStyle* indiv_style = get_style(l->Outer()); shape.push_back(IfcRepresentationShapeItem(s, indiv_style ? indiv_style : collective_style)); return true; } return false; }
static void draw_scale (GtkWidget *widget, cairo_t *cr, gint x, gint y, gint width, gint position, gint *height) { GtkStyleContext *scale_context; GtkStyleContext *contents_context; GtkStyleContext *trough_context; GtkStyleContext *slider_context; GtkStyleContext *highlight_context; gint contents_x, contents_y, contents_width, contents_height; gint trough_height, slider_height; scale_context = get_style (NULL, "scale.horizontal"); contents_context = get_style (scale_context, "contents"); trough_context = get_style (contents_context, "trough"); slider_context = get_style (trough_context, "slider"); highlight_context = get_style (trough_context, "highlight.top"); *height = 0; query_size (scale_context, NULL, height); query_size (contents_context, NULL, height); query_size (trough_context, NULL, height); query_size (slider_context, NULL, height); query_size (highlight_context, NULL, height); draw_style_common (scale_context, cr, x, y, width, *height, &contents_x, &contents_y, &contents_width, &contents_height); draw_style_common (contents_context, cr, contents_x, contents_y, contents_width, contents_height, &contents_x, &contents_y, &contents_width, &contents_height); /* Scale trough defines its size querying slider and highlight */ trough_height = 0; query_size (trough_context, NULL, &trough_height); slider_height = 0; query_size (slider_context, NULL, &slider_height); query_size (highlight_context, NULL, &slider_height); trough_height += slider_height; draw_style_common (trough_context, cr, contents_x, contents_y, contents_width, trough_height, &contents_x, &contents_y, &contents_width, &contents_height); draw_style_common (highlight_context, cr, contents_x, contents_y, contents_width / 2, contents_height, NULL, NULL, NULL, NULL); draw_style_common (slider_context, cr, contents_x + position, contents_y, contents_height, contents_height, NULL, NULL, NULL, NULL); g_object_unref (scale_context); g_object_unref (contents_context); g_object_unref (trough_context); g_object_unref (slider_context); g_object_unref (highlight_context); }
bool IfcGeom::Kernel::convert(const IfcSchema::IfcFaceBasedSurfaceModel* l, IfcRepresentationShapeItems& shapes) { IfcSchema::IfcConnectedFaceSet::list::ptr facesets = l->FbsmFaces(); const SurfaceStyle* collective_style = get_style(l); for( IfcSchema::IfcConnectedFaceSet::list::it it = facesets->begin(); it != facesets->end(); ++ it ) { TopoDS_Shape s; const SurfaceStyle* shell_style = get_style(*it); if (convert_shape(*it,s)) { shapes.push_back(IfcRepresentationShapeItem(s, shell_style ? shell_style : collective_style)); } } return true; }
static void draw_menubar (GtkWidget *widget, cairo_t *cr, gint x, gint y, gint width, gint *height) { GtkStyleContext *frame_context; GtkStyleContext *border_context; GtkStyleContext *menubar_context; GtkStyleContext *hovered_menuitem_context; GtkStyleContext *menuitem_context; gint contents_x, contents_y, contents_width, contents_height; gint item_width; /* Menubar background is the same color as our base background, so use a frame */ frame_context = get_style (NULL, "frame"); border_context = get_style (frame_context, "border"); /* This information is taken from the GtkMenuBar docs, see "CSS nodes" */ menubar_context = get_style (NULL, "menubar"); hovered_menuitem_context = get_style (menubar_context, "menuitem:hover"); menuitem_context = get_style (menubar_context, "menuitem"); *height = 0; query_size (frame_context, NULL, height); query_size (border_context, NULL, height); query_size (menubar_context, NULL, height); query_size (hovered_menuitem_context, NULL, height); query_size (menuitem_context, NULL, height); draw_style_common (frame_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL); draw_style_common (border_context, cr, x, y, width, *height, &contents_x, &contents_y, &contents_width, &contents_height); draw_style_common (menubar_context, cr, contents_x, contents_y, contents_width, contents_height, NULL, NULL, NULL, NULL); item_width = contents_width / 3; draw_style_common (hovered_menuitem_context, cr, contents_x, contents_y, item_width, contents_height, NULL, NULL, NULL, NULL); draw_style_common (menuitem_context, cr, contents_x + item_width * 2, contents_y, item_width, contents_height, NULL, NULL, NULL, NULL); g_object_unref (menuitem_context); g_object_unref (hovered_menuitem_context); g_object_unref (menubar_context); g_object_unref (border_context); g_object_unref (frame_context); }
bool CWRuler::on_expose_event(GdkEventExpose * theEvent) { //cerr << "CWRuler::on_expose_event()" << endl; DrawingArea::on_expose_event(theEvent); _myWindow->clear(); if (_myMode == MODE_CENTER_WIDTH) { float myHWindowWidth = 0.5f * _myWindowWidth; int myXStart = convertValueToScreenPos(_myWindowCenter - myHWindowWidth); int myXEnd = convertValueToScreenPos(_myWindowCenter + myHWindowWidth); _myWindow->draw_rectangle(get_style()->get_dark_gc(get_state()), true, myXStart, 0, myXEnd - myXStart, get_allocation().get_height()); drawMarker(_myWindowCenter + myHWindowWidth, get_style()->get_white_gc()); drawMarker(_myWindowCenter - myHWindowWidth, get_style()->get_white_gc()); drawMarker(_myWindowCenter, get_style()->get_black_gc()); } else if (_myMode == MODE_LOWER_UPPER) { int myXStart = convertValueToScreenPos(_myLower); int myXEnd = convertValueToScreenPos(_myUpper); _myWindow->draw_rectangle(get_style()->get_dark_gc(get_state()), true, myXStart, 0, myXEnd - myXStart, get_allocation().get_height()); drawMarker(_myLower, get_style()->get_white_gc()); drawMarker(_myUpper, get_style()->get_white_gc()); } else if (_myMode == MODE_THRESHOLD) { drawMarker(_myWindowCenter, get_style()->get_black_gc()); } return true; }
bool IfcGeom::Kernel::convert(const IfcSchema::IfcShellBasedSurfaceModel* l, IfcRepresentationShapeItems& shapes) { IfcEntityList::ptr shells = l->SbsmBoundary(); const SurfaceStyle* collective_style = get_style(l); for( IfcEntityList::it it = shells->begin(); it != shells->end(); ++ it ) { TopoDS_Shape s; const SurfaceStyle* shell_style = 0; if ((*it)->is(IfcSchema::Type::IfcRepresentationItem)) { shell_style = get_style((IfcSchema::IfcRepresentationItem*)*it); } if (convert_shape(*it,s)) { shapes.push_back(IfcRepresentationShapeItem(s, shell_style ? shell_style : collective_style)); } } return true; }
void edit_typeset_rep::get_data (new_data& data) { data->style= get_style (); data->init = get_init (); data->fin = get_fin (); data->att = get_att (); }
/* Set the key for this Style. @param (String) @return (String) */ static VALUE set_key(VALUE self, VALUE key){ Check_Type(key, T_STRING); simplet_style_t *style = get_style(self); simplet_style_set_key(style, RSTRING_PTR(key)); return key; }
/* Get the arg for this Style. @return (String) */ static VALUE get_arg(VALUE self){ simplet_style_t *style = get_style(self); char *arg; simplet_style_get_arg(style, &arg); return rb_str_new2(arg); }
/* Set the arg for this Style. @param (String) @return (String) */ static VALUE set_arg(VALUE self, VALUE arg){ Check_Type(arg, T_STRING); simplet_style_t *style = get_style(self); simplet_style_set_arg(style, RSTRING_PTR(arg)); return arg; }
static int ascii_mode_init(EditState *s, ModeSavedData *saved_data) { QEFont *font; QEStyleDef style; int num_width; int ret; ret = text_mode_init(s, saved_data); if (ret) return ret; /* get typical number width */ get_style(s, &style, s->default_style); font = select_font(s->screen, style.font_style, style.font_size); num_width = glyph_width(s->screen, font, '0'); release_font(s->screen, font); s->disp_width = (s->screen->width / num_width) - 10; /* align on 16 byte boundary */ s->disp_width &= ~15; if (s->disp_width < 16) s->disp_width = 16; s->insert = 0; s->hex_mode = 0; s->wrap = WRAP_TRUNCATE; return 0; }
/* Get the key for this Style. @param (String) @return (String) */ static VALUE get_key(VALUE self){ simplet_style_t *style = get_style(self); char *key; simplet_style_get_key(style, &key); return rb_str_new2(key); }
bool RegionChooser::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { double clipx1, clipx2, clipy1, clipy2; cr->get_clip_extents(clipx1, clipy1, clipx2, clipy2); #endif cr->save(); cr->set_line_width(1); #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 const Gdk::Color bg = get_style()->get_bg(Gtk::STATE_NORMAL); #else const Gdk::RGBA bg = get_style_context()->get_background_color(); #endif Gdk::Cairo::set_source_rgba(cr, bg); cr->paint(); if (clipy2 > h1) { draw_keyboard(cr, clipx1, clipx2); } if (clipy1 < h1 && instrument) { draw_regions(cr, clipx1, clipx2); } cr->restore(); return true; }
static void draw_horizontal_scrollbar (GtkWidget *widget, cairo_t *cr, gint x, gint y, gint width, gint position, GtkStateFlags state, gint *height) { GtkStyleContext *scrollbar_context; GtkStyleContext *contents_context; GtkStyleContext *trough_context; GtkStyleContext *slider_context; gint slider_width; /* This information is taken from the GtkScrollbar docs, see "CSS nodes" */ scrollbar_context = get_style (NULL, "scrollbar.horizontal.bottom"); contents_context = get_style (scrollbar_context, "contents"); trough_context = get_style (contents_context, "trough"); slider_context = get_style (trough_context, "slider"); gtk_style_context_set_state (scrollbar_context, state); gtk_style_context_set_state (contents_context, state); gtk_style_context_set_state (trough_context, state); gtk_style_context_set_state (slider_context, state); *height = 0; query_size (scrollbar_context, NULL, height); query_size (contents_context, NULL, height); query_size (trough_context, NULL, height); query_size (slider_context, NULL, height); gtk_style_context_get (slider_context, "min-width", &slider_width, NULL); draw_style_common (scrollbar_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL); draw_style_common (contents_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL); draw_style_common (trough_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL); draw_style_common (slider_context, cr, x + position, y, slider_width, *height, NULL, NULL, NULL, NULL); g_object_unref (slider_context); g_object_unref (trough_context); g_object_unref (contents_context); g_object_unref (scrollbar_context); }
int lui_window_set_style(lua_State *L) { WINDOW *w = panel_window(check_window(L, 1)); t_style s; get_style(L, 3, s); wbkgd(w, s.on & ~s.off); return 0; }
bool VisDrwArea::on_expose_event(GdkEventExpose* aEvent) { DrawingArea::on_expose_event(aEvent); Glib::RefPtr<Gdk::Window> drw = get_window(); Glib::RefPtr<Gtk::Style> style = get_style(); Glib::RefPtr<Gdk::GC> gc = style->get_fg_gc(get_state()); Allocation alc = get_allocation(); drw->draw_rectangle(gc, false, 0, 0, alc.get_width() - 1, alc.get_height() - 1); }
/* chatbox:set_win_style{ bold = true, foreground = 3, ... } set the global style of the chatbox, take effect immediatly for each row of the chatbox Stack: 2nd argument is a accessed member (style) 3rd argument is a table who can contain all the attributes above */ int lui_chatbox_set_style(lua_State *L) { CHATBOX *c = check_chatbox(L, 1); t_style s; get_style(L, 3, s); wbkgd(c->pad, s.on & ~s.off); return 0; }
static void set_sci_style(ScintillaObject *sci, guint style, guint ft_id, guint styling_index) { GeanyLexerStyle *style_ptr = get_style(ft_id, styling_index); SSM(sci, SCI_STYLESETFORE, style, invert(style_ptr->foreground)); SSM(sci, SCI_STYLESETBACK, style, invert(style_ptr->background)); SSM(sci, SCI_STYLESETBOLD, style, style_ptr->bold); SSM(sci, SCI_STYLESETITALIC, style, style_ptr->italic); }
//--------------------------------------------------------------------------------------- LUnits GmoBox::get_content_left() { ImoStyle* pStyle = get_style(); if (pStyle) return get_left() + pStyle->margin_left() + pStyle->border_width_left() + pStyle->padding_left(); else return get_left(); }
static void draw_text (GtkWidget *widget, cairo_t *cr, gint x, gint y, gint width, gint height, const gchar *text, GtkStateFlags state) { GtkStyleContext *label_context; GtkStyleContext *selection_context; GtkStyleContext *context; PangoLayout *layout; /* This information is taken from the GtkLabel docs, see "CSS nodes" */ const char *path[2] = { "label.view", "selection" }; label_context = get_style (NULL, path[0]); selection_context = get_style (label_context, path[1]); gtk_style_context_set_state (label_context, state); if (state & GTK_STATE_FLAG_SELECTED) context = selection_context; else context = label_context; layout = gtk_widget_create_pango_layout (widget, text); gtk_render_background (context, cr, x, y, width, height); gtk_render_frame (context, cr, x, y, width, height); gtk_render_layout (context, cr, x, y, layout); g_object_unref (layout); g_object_unref (selection_context); g_object_unref (label_context); }
void Table::draw_background() { //If no moving card or drag inital save not done if(!card_drag || card_drag && !drag_save) { //Draw the background back->draw_pixbuf(get_style()->get_black_gc(),background.scaled, 0,0,0,0,-1,-1, Gdk::RGB_DITHER_NONE, 0, 0); } }
void Gui_DisplayBaseClass::redraw(){ DEV_INFOS("redrawing"); cv::Mat tmp_img; cv::Point2f offset; drawBackground(); if(!m_processor_hand.getSourceImgAsRGB(tmp_img)){ if(!m_banner_pixbuf) m_banner_pixbuf = Gui_PixbufOpener::pixbufOpen(BANNER_IMG); offset = m_ROI.scaleToFitAllocation(m_banner_pixbuf, m_pixbuf); } else{ m_banner_pixbuf.clear(); cv::Point2f raw_img_dim(tmp_img.cols,tmp_img.rows); m_ROI.update(raw_img_dim); tmp_img(m_ROI).copyTo(tmp_img); offset = m_ROI.scaleToFitAllocation(tmp_img, m_img_to_display); m_pixbuf = Gdk::Pixbuf::create_from_data((guint8*)m_img_to_display.data,Gdk::COLORSPACE_RGB,false, 8,m_img_to_display.cols,m_img_to_display.rows,m_img_to_display.step); //show mask if(getMask(tmp_img) && m_show_mask){ DEV_INFOS("drawing mask "<<cv::Point2f(tmp_img.rows,tmp_img.cols)<<" vs "<<raw_img_dim); tmp_img(m_ROI).copyTo(tmp_img); cv::LUT(tmp_img,m_LUT,tmp_img); m_ROI.scaleToFitAllocation(tmp_img, tmp_img,true); m_mask_pixbuf = Gdk::Pixbuf::create_from_data((guint8*)tmp_img.data,Gdk::COLORSPACE_RGB,false, 8,tmp_img.cols,tmp_img.rows,tmp_img.step); m_mask_pixbuf = m_mask_pixbuf->add_alpha(true,0,0,0); m_mask_pixbuf->composite ( m_pixbuf,0,0, m_mask_pixbuf->get_width(),m_mask_pixbuf->get_height(), 0,0,1,1,Gdk::INTERP_NEAREST, m_alph_mask//int overall_alpha ); } } m_pixbuf->render_to_drawable(get_window(), get_style()->get_black_gc(),0, 0, offset.x, offset.y, m_pixbuf->get_width(), m_pixbuf->get_height(),Gdk::RGB_DITHER_NONE, 0, 0); if(m_draw_result) m_deco.decorate(); }
/* input.style = { bold = true, foreground = 3, ... } or input.style = myStyle Set the global style of the input, take effect immediatly for each row of the input. Stack: 2nd argument is a accessed member (style) 3rd argument is a table who can contain all the attributes above */ int lui_input_set_style(lua_State *L) { INPUT *i; t_style s; luasoul_checkclass(L, 1, INPUT_CLASS, i); /* fill i */ get_style(L, 3, s); wbkgd(i->pad, s.on & ~s.off); return 0; }
/* Redraw the screen from the backing pixmap */ int PopulationDrawingArea::expose_event_impl (GdkEventExpose *event) { gc = get_style()->get_fg_gc(get_state()); win.draw_pixmap(gc , pixmap, event->area.x, event->area.y, event->area.x, event->area.y, event->area.width, event->area.height); return FALSE; }
bool GrBx::Area::on_motion_notify_event (GdkEventMotion *_motion) { bool ret = GrBx::Widget::on_motion_notify_event (_motion); if (_motion && window && is_drawable ()) { double width = get_width (), height = get_height (); const Glib::RefPtr<Gdk::GC> black_gc = get_style ()->get_black_gc (); if (pixbuf) window->draw_pixbuf (pixbuf, 0, 0, 0, 0, width, height, Gdk::RGB_DITHER_NONE, 0, 0); window->draw_line (black_gc, _motion->x, 0, _motion->x, height); window->draw_line (black_gc, 0, _motion->y, width, _motion->y); } return ret; }