21
21
#include "Nux/Nux.h"
22
22
#include "Nux/VLayout.h"
23
23
#include "Nux/WindowThread.h"
24
#include "Nux/PushButton.h"
24
#include "Nux/CheckBox.h"
25
#include "Nux/ToggleButton.h"
26
#include "Nux/Button.h"
27
#include "Nux/TextureArea.h"
27
29
void UserInterfaceInitialization(nux::NThread* thread, void* init_data)
29
31
// Create a vertical Layout
30
32
nux::VLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION);
32
//Create a button of type PushButton
33
nux::PushButton* button = new nux::PushButton(
34
TEXT ("Hello World!"),
35
NUX_TRACKER_LOCATION);
37
// Set the button maximum width/height
38
button->SetMaximumWidth (80);
39
button->SetMaximumHeight (40);
40
button->SetTextColor (nux::color::Black);
34
//Create a button of type Button
35
nux::Button* button = new nux::Button ("Party on Garth", NUX_TRACKER_LOCATION);
42
37
// Add the button to the layout
46
nux::MINOR_POSITION_CENTER,
47
nux::MINOR_SIZE_FULL);
41
nux::MINOR_POSITION_CENTER,
42
nux::MINOR_SIZE_MATCHCONTENT);
44
// Create a button with an image
45
nux::ColorLayer color (nux::Color (0.6, 0.4, 0.7, 1.0));
46
nux::TextureArea* texture_area = new nux::TextureArea ();
47
texture_area->SetPaintLayer (&color);
49
nux::Button* button_with_image = new nux::Button("Party on Wayne", texture_area, NUX_TRACKER_LOCATION);
50
//button_with_image->image_position = nux::NUX_POSITION_BOTTOM;
52
// Add the button to the layout
56
nux::MINOR_POSITION_CENTER,
57
nux::MINOR_SIZE_MATCHCONTENT);
59
color = nux::Color (0.6, 0.4, 0.7, 1.0);
60
texture_area = new nux::TextureArea ();
61
texture_area->SetPaintLayer (&color);
63
nux::Button* button_without_image = new nux::Button(texture_area, NUX_TRACKER_LOCATION);
65
// Add the button to the layout
69
nux::MINOR_POSITION_CENTER,
70
nux::MINOR_SIZE_MATCHCONTENT);
72
nux::ToggleButton *toggle_button = new nux::ToggleButton ("This is a Toggle button, nux just doesn't have a theme for that", NUX_TRACKER_LOCATION);
76
nux::MINOR_POSITION_CENTER,
77
nux::MINOR_SIZE_MATCHCONTENT);
79
nux::CheckBox *check_button = new nux::CheckBox ("Check box widget? Check!", NUX_TRACKER_LOCATION);
83
nux::MINOR_POSITION_CENTER,
84
nux::MINOR_SIZE_MATCHCONTENT);
49
86
// Control the position of elements inside the layout
50
87
layout->SetContentDistribution (nux::MAJOR_POSITION_CENTER);