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/xprogress.hpp"
In [10]:
xw::progress<double> progress;
In [11]:
progress.display()
In [12]:
progress.value = 60;
In [13]:
progress.style().bar_color = "red";
In [14]:
progress.description = "Completion";
In [15]:
progress.style().description_width = "30px"
In [16]:
#include "xwidgets/xnumeral.hpp"
In [17]:
xw::numeral<double> numeral;
numeral.display()
In [18]:
numeral.value = 4
In [19]:
numeral.value()
In [20]:
#include "xwidgets/xplay.hpp"
In [21]:
xw::play play;
play.display()
In [22]:
#include "xwidgets/xcheckbox.hpp"
In [23]:
xw::checkbox checkbox;
In [24]:
checkbox.display()
In [25]:
checkbox.value = true;
In [26]:
checkbox.indent = false;
In [27]:
#include "xwidgets/xtogglebutton.hpp"
In [28]:
xw::togglebutton toggle;
In [29]:
toggle.display()
In [30]:
toggle.value = true;
In [31]:
toggle.description = "toggle";
In [32]:
#include "xwidgets/xvalid.hpp"
In [33]:
xw::valid valid;
In [34]:
valid.display()
In [35]:
valid.value = true;
In [36]:
#include "xwidgets/xlabel.hpp"
In [37]:
xw::label label;
In [38]:
label.display();
In [39]:
label.value = "Some caption";
In [40]:
#include "xwidgets/xhtml.hpp"
In [41]:
xw::html html;
In [42]:
html.value = R"xhtml(
<div style="
width: 50%;
height: 100px;
background: #323;
color: white;
text-align: center;"
>Some HTML
</div>
)xhtml";
html.display();
In [43]:
#include "xwidgets/xtext.hpp"
In [44]:
xw::text text;
text.value = "Some text";
text.display()
In [45]:
void submit_callback()
{
std::cout << "submitted" << std::endl;
}
In [46]:
text.on_submit(submit_callback);
In [47]:
#include "xwidgets/xtextarea.hpp"
In [48]:
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 [49]:
#include "xwidgets/xpassword.hpp"
In [50]:
xw::password password;
In [51]:
password.display()
In [52]:
#include "xwidgets/xbutton.hpp"
In [53]:
xw::button button;
In [54]:
void foo()
{
std::cout << "Clicked!" << std::endl;
}
In [55]:
button.on_click(foo);
button.display()
In [56]:
button.description = "button";
In [57]:
button.button_style = "success";
In [58]:
button.button_style = "baaad";
In [59]:
std::cout << button.button_style();
In [60]:
button.layout().width = "50%";
button.layout().height = "200px";
In [61]:
button.style().button_color = "#888";
In [62]:
auto button_copy = button;
In [63]:
button_copy.display()
In [64]:
button.style().button_color = "red";
button_copy.style().button_color = "green";
In [65]:
auto slider2 = slider;
In [66]:
slider2.display()
In [67]:
#include "xwidgets/xslider.hpp"
#include "xwidgets/xlink.hpp"
#include "xwidgets/xbox.hpp"
In [68]:
xw::slider<double> s1, s2;
In [69]:
auto l = xw::link(s1, "value", s2, "value");
In [70]:
s1.display()
In [71]:
s2.display()
In [72]:
xw::slider<double> source, target;
In [73]:
auto dl = xw::directional_link(source, "value", target, "value");
In [74]:
source.display()
In [75]:
target.display()
In [76]:
#include "xwidgets/xbutton.hpp"
#include "xwidgets/xslider.hpp"
#include "xwidgets/xbox.hpp"
In [77]:
xw::vbox b;
xw::slider<double> slid;
In [78]:
b.add(xw::button())
In [79]:
b.add(slid)
In [80]:
b.display()
In [81]:
#include "xwidgets/xcontroller.hpp"
In [82]:
xw::controller c
In [83]:
c.display()
In [84]:
#include "xwidgets/xtogglebuttons.hpp"
In [85]:
xw::togglebuttons tb(std::vector<std::string>({"foo", "bar"}), "foo");
In [86]:
tb.display()
In [87]:
tb.value = "bar";
In [88]:
tb._options_labels = std::vector<std::string>({"baz", "taz"});
In [89]:
#include "xwidgets/xdropdown.hpp"
In [90]:
xw::dropdown dd(std::vector<std::string>({"foo", "bar"}), "foo");
In [91]:
dd.display()
In [92]:
#include "xwidgets/xradiobuttons.hpp"
In [93]:
xw::radiobuttons rb(std::vector<std::string>({"foo", "bar"}), "foo");
In [94]:
rb.display()
In [95]:
#include "xwidgets/xselect.hpp"
In [96]:
xw::select sel(std::vector<std::string>({"foo", "bar"}), "foo");
In [97]:
sel.display()
In [98]:
sel.rows = 3
In [99]:
#include "xwidgets/xselectionslider.hpp"
In [100]:
xw::selectionslider sslid(std::vector<std::string>({"foo", "bar", "baz", "taz"}), "foo");
In [101]:
sslid.display()
In [102]:
#include "xwidgets/xselect.hpp"
In [ ]:
xw::select_multiple mul_sel(std::vector<std::string>({"foo", "bar"}));
In [ ]:
mul_sel.display()
In [ ]:
mul_sel.value()
In [ ]:
mul_sel.value = std::vector<std::string>();
In [ ]:
#include "xwidgets/xselectionslider.hpp"
In [ ]:
xw::selection_rangeslider range_sslid(std::vector<std::string>({"foo", "bar", "baz", "taz"}));
In [ ]:
range_sslid.display()
In [ ]:
range_sslid.value()
In [ ]:
#include "xwidgets/xtab.hpp"
#include "xwidgets/xbutton.hpp"
#include "xwidgets/xslider.hpp"
In [ ]:
xw::tab tabs;
In [ ]:
xw::slider<double> tab_slid;
tabs.add(xw::button());
tabs.add(tab_slid);
In [ ]:
tabs.display()
In [ ]:
tabs.set_title(0, "zero");
tabs.set_title(1, "one");
In [ ]:
#include "xwidgets/xaccordion.hpp"
#include "xwidgets/xbutton.hpp"
In [ ]:
xw::accordion accord;
In [ ]:
accord.add(xw::button());
accord.add(xw::button());
accord.add(xw::button());
In [ ]:
accord.display()
In [ ]:
accord.set_title(0, "zero");
accord.set_title(1, "one");
accord.set_title(2, "two");
In [ ]:
#include "xwidgets/xcolor_picker.hpp"
In [ ]:
xw::color_picker cpicker;
In [ ]:
cpicker.display()
In [ ]:
cpicker.value = "blue";
In [ ]:
cpicker.concise = true;
In [ ]: