Skip to content

Commit

Permalink
added option to change text papget color using a comboboxentry widget…
Browse files Browse the repository at this point in the history
…, colors defined in widgets.glade, can also type in color string
  • Loading branch information
scdwyer committed May 20, 2012
1 parent aa06dbe commit 83ce44b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
4 changes: 4 additions & 0 deletions sw/lib/ocaml/papget_renderer.ml
Expand Up @@ -73,6 +73,7 @@ class canvas_text = fun ?(config=[]) canvas_group x y ->
(* Initialize the entries *)
text_editor#entry_format#set_text format;
text_editor#spinbutton_size#set_value size;
text_editor#comboboxentry_color#set_active 0;

(* Connect the entries *)
let callback = fun () ->
Expand All @@ -81,6 +82,9 @@ class canvas_text = fun ?(config=[]) canvas_group x y ->
let callback = fun () ->
size <- text_editor#spinbutton_size#value in
ignore (text_editor#spinbutton_size#connect#value_changed ~callback);
let callback = fun () ->
color <- text_editor#comboboxentry_color#entry#text in
ignore (text_editor#comboboxentry_color#connect#changed ~callback);
end


Expand Down
34 changes: 33 additions & 1 deletion sw/lib/ocaml/widgets.glade
Expand Up @@ -9,7 +9,7 @@
<child>
<widget class="GtkTable" id="table_text_editor">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkLabel" id="label39">
Expand All @@ -36,6 +36,20 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label45">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Color</property>
<property name="justify">right</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="entry_format">
<property name="visible">True</property>
Expand Down Expand Up @@ -63,6 +77,24 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBoxEntry" id="comboboxentry_color">
<property name="visible">True</property>
<property name="items" translatable="yes">green
red
blue
yellow
orange
white</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
</child>
</widget>
Expand Down

0 comments on commit 83ce44b

Please sign in to comment.