rename `NativeString` to `CString`
[nit.git] / lib / gtk / v3_4 / gtk_widgets_ext.nit
index 3102dbd..63cdb1e 100644 (file)
@@ -131,8 +131,8 @@ extern class GtkProgressBar `{GtkProgressBar *`}
                gtk_progress_bar_set_show_text(self, show);
        `}
 
-       fun text: String import NativeString.to_s `{
-               return NativeString_to_s((char *)gtk_progress_bar_get_text(self));
+       fun text: String import CString.to_s_with_copy `{
+               return CString_to_s_with_copy((char *)gtk_progress_bar_get_text(self));
        `}
 
        fun text=(value: String) import String.to_cstring `{
@@ -258,3 +258,22 @@ extern class GtkColorButton `{GtkColorButton *`}
        `}
 end
 
+# Button remaining "pressed-in" when clicked
+extern class GtkToggleButton `{ GtkToggleButton * `}
+       super GtkButton
+
+       # Current state, returns `true` if pressed/checked
+       fun active: Bool `{ return gtk_toggle_button_get_active(self); `}
+
+       # Set current state, `true` for pressed/checked
+       fun active=(value: Bool) `{ gtk_toggle_button_set_active(self, value); `}
+end
+
+# Check box next to a label
+extern class GtkCheckButton `{ GtkCheckButton * `}
+       super GtkToggleButton
+
+       new `{ return (GtkCheckButton *)gtk_check_button_new(); `}
+
+       new with_label(lbl: CString) `{ return (GtkCheckButton *)gtk_check_button_new_with_label((gchar *)lbl); `}
+end