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

demonstrates the use of xtd::forms::tool_bar component.

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/progress_bar>
#include <xtd/forms/status_bar>
#include <xtd/forms/timer>
#include <xtd/drawing/pens>
using namespace xtd;
using namespace xtd::drawing;
using namespace xtd::forms;
namespace status_bar_example {
class form1 : public form {
public:
form1() {
text("Status bar example");
client_size({820, 500});
status_bar1.parent(*this);
status_bar1.panels().push_back_range({status_bar_panel1, status_bar_panel2, status_bar_panel3, status_bar_panel4});
status_bar1.show_panels(true);
status_bar_panel1.border_style(xtd::forms::status_bar_panel_border_style::sunken);
status_bar_panel1.tool_tip_text("Status one tool tip text");
status_bar_panel2.border_style(xtd::forms::status_bar_panel_border_style::sunken);
status_bar_panel3.auto_size(xtd::forms::status_bar_panel_auto_size::spring);
status_bar_panel3.border_style(xtd::forms::status_bar_panel_border_style::sunken);
status_bar_panel4.border_style(xtd::forms::status_bar_panel_border_style::sunken);
timer1.interval_milliseconds(50);
timer1.tick += [&] {
progress_bar1.value(progress_bar1.value() < progress_bar1.maximum() ? progress_bar1.value() + 1 : progress_bar1.minimum());
};
timer1.enabled(true);
}
private:
static auto image_from_color(const xtd::drawing::color& color)->image {
auto colored_bitmap = bitmap{16, 16};
auto g = graphics::from_image(colored_bitmap);
g.fill_ellipse(solid_brush(color), 0, 0, colored_bitmap.width(), colored_bitmap.height());
g.draw_ellipse(pens::black(), 0, 0, colored_bitmap.width() - 1, colored_bitmap.height() - 1);
return colored_bitmap;
}
forms::status_bar status_bar1;
status_bar_panel status_bar_panel1 = status_bar_panel::create_panel("Status one", image_from_color(color::light_green));
status_bar_panel status_bar_panel2 = status_bar_panel::create_panel("Status two");
status_bar_panel status_bar_panel3 = status_bar_panel::create_panel("Status three");
timer timer1;
progress_bar progress_bar1;
status_bar_panel status_bar_panel4 = status_bar_panel::create_control(progress_bar1);
};
}
auto main() -> int {
application::run(status_bar_example::form1 {});
}
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes....
Definition bitmap.hpp:26
Represents an ARGB (alpha, red, green, blue) color.
Definition color.hpp:49
Defines a xtd::drawing::brush of a single color. Brushes are used to fill graphics shapes,...
Definition solid_brush.hpp:30
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Represents a Windows progress bar control.
Definition progress_bar.hpp:40
Represents a xtd::forms::status_bar panel.
Definition status_bar_panel.hpp:46
Represents a Windows status bar control.
Definition status_bar.hpp:48
Implements a timer that raises an event at user-defined intervals. This timer is optimized for use in...
Definition timer.hpp:38
@ sunken
Defines a sunken border. Same as xtd::forms::status_bar_panel_border_style::inset.
@ spring
The xtd::forms::status_bar_panel shares the available space on the xtd::forms::status_bar (the space ...
@ contents
The width of the xtd::forms::status_bar_panel is determined by its contents.
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:11
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10