diff options
author | gareuselesinge <gareuselesinge@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2013-10-22 09:22:07 +0000 |
---|---|---|
committer | gareuselesinge <gareuselesinge@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2013-10-22 09:22:07 +0000 |
commit | 060e70d3103aefa436718c667fc004769387bb71 (patch) | |
tree | 0efdb30f496b85f12f424f519d42993390957af6 | |
parent | 9ba95f69547a20f9b96761cf01ec6d1dfd2dd5ca (diff) |
ideutils: support custom size for stock icons
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16896 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r-- | ide/ideutils.ml | 14 | ||||
-rw-r--r-- | ide/ideutils.mli | 4 |
2 files changed, 15 insertions, 3 deletions
diff --git a/ide/ideutils.ml b/ide/ideutils.ml index 0ef39f8ed..881f5ea43 100644 --- a/ide/ideutils.ml +++ b/ide/ideutils.ml @@ -217,8 +217,18 @@ let find_tag_limits (tag :GText.tag) (it:GText.iter) = (find_tag_start tag it , find_tag_stop tag it) let stock_to_widget ?(size=`BUTTON) s = - let img = GMisc.image ~icon_size:size () in - img#set_stock s; + let img = GMisc.image () in + (match size with + | `CUSTOM(width,height) -> + let opb = img#misc#render_icon ~size:`BUTTON s in + let pb = GdkPixbuf.create ~width ~height + ~bits:(GdkPixbuf.get_bits_per_sample opb) + ~has_alpha:(GdkPixbuf.get_has_alpha opb) () in + GdkPixbuf.scale ~width ~height ~dest:pb opb; + img#set_pixbuf pb + | #Gtk.Tags.icon_size as icon_size -> + img#set_stock s; + img#set_icon_size icon_size); img#coerce let custom_coqtop = ref None diff --git a/ide/ideutils.mli b/ide/ideutils.mli index 3d950ead8..bb9e65322 100644 --- a/ide/ideutils.mli +++ b/ide/ideutils.mli @@ -36,7 +36,9 @@ val select_file_for_save : title:string -> ?filename:string -> unit -> string option val try_convert : string -> string val try_export : string -> string -> bool -val stock_to_widget : ?size:Gtk.Tags.icon_size -> GtkStock.id -> GObj.widget +val stock_to_widget : + ?size:[`CUSTOM of int * int | Gtk.Tags.icon_size] -> + GtkStock.id -> GObj.widget open Format val print_list : (formatter -> 'a -> unit) -> formatter -> 'a list -> unit |