In [1]:
#include "xwidgets/xslider.hpp"
In [2]:
xw::slider<double> slider;
slider.display()
In [3]:
slider.value = 20;
In [4]:
slider.value()
In [5]:
slider.max = 40;
In [6]:
slider.style().handle_color = "blue";
In [7]:
slider.orientation = "vertical";
In [8]:
slider.description = "A slider";
In [9]:
#include "xwidgets/xbutton.hpp"
In [10]:
xw::button button;
In [11]:
void foo()
{
std::cout << "Clicked!" << std::endl;
}
In [12]:
button.on_click(foo);
button.display()
In [13]:
button.description = "button";
In [14]:
auto button_copy = button;
In [15]:
button_copy.display()
In [16]:
button.style().button_color = "red";
button_copy.style().button_color = "green";
In [17]:
#include "xwidgets/xslider.hpp"
#include "xwidgets/xlink.hpp"
In [18]:
xw::slider<double> s1, s2;
In [19]:
auto l = xw::make_link(s1, "value", s2, "value");
In [20]:
s1.display()
In [21]:
s2.display()
In [22]:
s1.value = 10.;
In [23]:
#include "xwidgets/xbutton.hpp"
#include "xwidgets/xslider.hpp"
#include "xwidgets/xbox.hpp"
In [24]:
xw::vbox b;
xw::button but;
xw::slider<double> slid;
In [25]:
b.add(but);
b.add(slid);
b.display()
In [26]:
#include "xwidgets/xprogress.hpp"
In [27]:
xw::progress<double> progress;
In [28]:
progress.display()
In [29]:
progress.value = 60;
In [30]:
progress.style().bar_color = "red";
In [31]:
progress.description = "Completion";
In [32]:
#include "xwidgets/xnumeral.hpp"
In [33]:
xw::numeral<double> numeral;
numeral.display()
In [34]:
numeral.value = 4;
In [35]:
numeral.value()
In [36]:
#include "xwidgets/xplay.hpp"
In [37]:
xw::play play;
play.display()
In [38]:
#include "xwidgets/xcheckbox.hpp"
In [39]:
xw::checkbox checkbox;
In [40]:
checkbox.display()
In [41]:
checkbox.value = true;
In [42]:
checkbox.indent = false;
In [43]:
#include "xwidgets/xtogglebutton.hpp"
In [44]:
xw::togglebutton toggle;
In [45]:
toggle.display()
In [46]:
toggle.value = true;
In [47]:
toggle.description = "toggle";
In [48]:
#include "xwidgets/xvalid.hpp"
In [49]:
xw::valid valid;
In [50]:
valid.display()
In [51]:
valid.value = true;
In [52]:
#include "xwidgets/xlabel.hpp"
In [53]:
xw::label label;
In [54]:
label.display();
In [55]:
label.value = "Some caption";
In [56]:
#include "xwidgets/xhtml.hpp"
In [57]:
xw::html html;
In [58]:
html.value = R"xhtml(
<div style="
width: 50%;
height: 100px;
background: #323;
color: white;
text-align: center;"
>Some HTML
</div>
)xhtml";
html.display();
In [59]:
#include "xwidgets/xtext.hpp"
In [60]:
xw::text text;
text.value = "Some text";
text.display()
In [61]:
void submit_callback()
{
std::cout << "submitted" << std::endl;
}
In [62]:
text.on_submit(submit_callback);
In [63]:
#include "xwidgets/xtextarea.hpp"
In [64]:
xw::textarea textarea;
textarea.value = R"textarea(Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa
qui officia deserunt mollit anim id est laborum.
)textarea";
textarea.display()
In [ ]:
#include "xwidgets/xpassword.hpp"
In [ ]:
xw::password password;
In [ ]:
password.display()
In [ ]:
xw::button buttonl;
buttonl.display()
In [ ]:
buttonl.layout().width = "50%";
buttonl.layout().height = "200px";
In [ ]:
buttonl.style().button_color = "#888";