Hello, I have been trying out the examples in pygtk and trying them out in gtkd. I came across this example where they used a member variable (of gtk.Window?) called timeout_id. I can't find anything similar to that in the documentation. Here's what I've got so far, any pointers would be greatly appreciated.
int main(string[] args) {
import gio.Application : GioApp = Application;
import gtkc.giotypes : GApplicationFlags;
import gtk.Application : Application;
import gtk.ApplicationWindow : ApplicationWindow;
auto app = new Application("org.gitlab.radagast.gtkdnote.textview",
GApplicationFlags.FLAGS_NONE);
app.addOnActivate(delegate void(GioApp _) {
auto aw = new ApplicationWindow(app);
scope (success)
aw.showAll();
aw.setTitlebar(() {
import gtk.HeaderBar : HeaderBar;
auto hb = new HeaderBar();
hb.setTitle("Enter your password");
hb.setSubtitle("Entry Demo");
hb.setShowCloseButton(true);
return hb;
}());
aw.add(() {
import gtk.Box : Box;
import gtkc.gtktypes : GtkOrientation;
auto vbox = new Box(GtkOrientation.VERTICAL, 5);
import gtk.Entry : Entry;
auto entry = new Entry("Enter your password", 80);
vbox.packStart(entry, true, true, 0);
auto hbox = new Box(GtkOrientation.HORIZONTAL, 5);
import gtk.CheckButton : CheckButton;
import gtk.ToggleButton : ToggleButton;
// The leading `_` is for mnemonics so optional
auto checkEditable = new CheckButton("_Editable");
checkEditable.setActive(true);
/*
IMPORTANT NOTE: The delegate below takes a ToggleButton
as its parameter. `gtk.CheckButton` inherits from
`gtk.ToggleButton` so passing a CheckButton is allowed.
*/
checkEditable.addOnToggled(delegate void(ToggleButton _) {
static bool activate = false;
entry.setEditable(activate);
activate = !activate;
});
hbox.packStart(checkEditable, true, true, 0);
auto checkVisible = new CheckButton("_Visible");
checkVisible.setActive(true);
checkVisible.addOnToggled(delegate void(ToggleButton _) {
static bool visible = false;
entry.setVisible(visible);
visible = !visible;
});
hbox.packStart(checkVisible, true, true, 0);
/*************
auto checkPulse = new CheckButton("_Pulse");
checkPulse.setActive(true);
checkPulse.addOnToggled(delegate void(ToggleButton _) {
if (checkPulse.getActive()) {
// Call the pulse delegate every 100ms
entry.setProgressPulseStep(0.2);
//?
}
else {
}
});
hbox.packStart(checkPulse, true, true, 0);
**************/
auto checkHide = new CheckButton("Hide");
checkHide.setActive(true);
entry.setVisibility(!checkHide.getActive());
checkHide.addOnToggled(delegate void(ToggleButton _) {
static bool visible = false;
entry.setVisibility(visible);
visible = !visible;
});
hbox.packStart(checkHide, true, true, 0);
hbox.packEnd(() {
import gtk.Button : Button;
return new Button("Close", delegate void(Button _) { app.quit(); });
}(), true, true, 0);
vbox.packStart(hbox, true, true, 0);
return vbox;
}());
});
return app.run(args);
}