xtd 0.2.0
Loading...
Searching...
No Matches
bitmap_button.cpp

demonstrates the use of xtd::forms::button control with image.

Windows

macOS

Gnome

#include <xtd/xtd>
#include "../resources/gammasoft_16x16.xpm"
#include "../resources/gammasoft_64x64.xpm"
class form1 : public form {
public:
form1() {
text("Bitmap button example");
controls().push_back_range({button1, button2, label1, label2});
button1.location({50, 50});
button1.image(image::from_xpm_data(gammasoft_16x16_xpm));
button1.image_align(content_alignment::middle_center);
button1.click += delegate_ {
label1.text(string::format("Button 1 clicked {} times", ++button1_clicked));
};
button2.auto_repeat(true);
button2.location({50, 100});
button2.size({200, 75});
button2.image(image::from_xpm_data(gammasoft_64x64_xpm));
button2.image_align(content_alignment::middle_center);
button2.click += delegate_ {
label2.text(string::format("Button 2 clicked {} times", ++button2_clicked));
};
label1.parent(*this);
label1.text("Button 1 clicked 0 times");
label1.location({50, 200});
label1.width(200);
label2.parent(*this);
label2.text("Button 2 clicked 0 times");
label2.location({50, 230});
label2.width(200);
}
private:
button button1;
button button2;
label label1;
label label2;
int button1_clicked = 0;
int button2_clicked = 0;
};
auto main() -> int {
//application::system_controls(true);
application::run(form1 {});
}
#define delegate_
The declaration of a delegate type is similar to a method signature. It has a return value and any nu...
Definition delegate.hpp:900