Example #1
0
LayoutBase*
WidgetsDemo::createRadioGroup()
{
    VBoxLayout* group = new VBoxLayout();

    RadioButton* rb1 = new RadioButton("RadioButton 1");
    group->addWidget(rb1);

    RadioButton* rb2 = new RadioButton("RadioButton 2");
    group->addWidget(rb2);

    RadioButton* disabled = new RadioButton("RadioButton Disabled");
    disabled->setDisabled();
    group->addWidget(disabled);

    return group;
}
Example #2
0
LayoutBase*
WidgetsDemo::createCheckGroup()
{
    VBoxLayout* group = new VBoxLayout();

    CheckBox* cb1 = new CheckBox("CheckBox");
    group->addWidget(cb1);

    CheckBox* cb2 = new CheckBox("CheckBox Tri-state");
    cb2->setTriState(true);
    group->addWidget(cb2);

    CheckBox* disabled = new CheckBox("CheckBox Disabled");
    disabled->setDisabled();
    group->addWidget(disabled);

    return group;
}
Example #3
0
WidgetsDemo::WidgetsDemo(int argc, char* argv[])
        : Application(&argc, &argv, (AppOptions) (OptDaleAuto | OptSound))
{
    setMargins(5, 5, 5, 5);
    setLayout(new VBoxLayout());

    // ToolBar
    ToolBar* bar = new ToolBar();
    bar->addWidget(new Label("ilixi_widgets"));
    bar->addWidget(new Spacer(Horizontal));
    ToolBarButton* barButton = new ToolBarButton("Quit");
    barButton->setIcon(StyleHint::Cross);
    barButton->sigClicked.connect(sigc::ptr_fun(WidgetsDemo::quit));
    bar->addWidget(barButton);
    setToolbar(bar);

    // TabPanel
    TabPanel* tab = new TabPanel();
//    tab->surface()->setSurfaceFlag(Surface::SubSurface);
//    tab->surface()->unsetSurfaceFlag(Surface::SharedSurface);
    addWidget(tab);

    // Buttons Tab
    VBoxLayout* vBox = new VBoxLayout();
    tab->addTab(vBox, "Tab 1");

    // Label
    vBox->addWidget(createLabelGroup());
    vBox->addWidget(new LineSeperator());

    // CheckBox and RadioButton
    HBoxLayout* box1 = new HBoxLayout();
    box1->addWidget(createCheckGroup());
    box1->addWidget(createRadioGroup());
    vBox->addWidget(box1);
    vBox->addWidget(new LineSeperator());

    // PushButton
    vBox->addWidget(createPBGroup());
    vBox->addWidget(new LineSeperator());

    // ToolButton
    vBox->addWidget(createTBGroup());
    vBox->addWidget(new LineSeperator());

    // ButtonGroup
    DirectionalButton* db1 = new DirectionalButton("Left");
    DirectionalButton* db2 = new DirectionalButton("1");
    DirectionalButton* db3 = new DirectionalButton("2");
    DirectionalButton* db4 = new DirectionalButton("3");
    DirectionalButton* db5 = new DirectionalButton("Right");

    ButtonGroup* bg = new ButtonGroup(Horizontal);
    bg->addButton(db1);
    bg->addButton(db2);
    bg->addButton(db3);
    bg->addButton(db4);
    bg->addButton(db5);
    vBox->addWidget(bg);

    vBox->addWidget(new Spacer(Vertical));

    // Disabled
    VBoxLayout* vBox4 = new VBoxLayout();
    tab->addTab(vBox4, "Tab 2");
    tab->setTabEnabled(1, false);

    // LineInput Tab
    VBoxLayout* vBox2 = new VBoxLayout();
    tab->addTab(vBox2, "Tab 3");

    LineInput *li1 = new LineInput("123...");
    li1->sigTextEntered.connect(sigc::mem_fun(this, &WidgetsDemo::print));
    vBox2->addWidget(li1);
    vBox2->addWidget(new Spacer(Vertical));

    LineInput *li2 = new LineInput("Line input has some text...");
    vBox2->addWidget(li2);
    vBox2->addWidget(new Spacer(Vertical));

    LineInput *li3 = new LineInput("Line input has some text...");
    vBox2->addWidget(li3);
    vBox2->addWidget(new Spacer(Vertical));

    LineInput *li4 = new LineInput("Line input has some text...");
    vBox2->addWidget(li4);
    li4->setDisabled();
    vBox2->addWidget(new Spacer(Vertical));

    LineInput *li5 = new LineInput("Line input has some text...");
    vBox2->addWidget(li5);

    VBoxLayout* vBox3 = new VBoxLayout();
    tab->addTab(vBox3, "Tab 4");

    ProgressBar* bar1 = new ProgressBar();
    bar1->setValue(5);
    vBox3->addWidget(bar1);

    ProgressBar* bar1d = new ProgressBar();
    bar1d->setValue(5);
    bar1d->setDisabled();
    vBox3->addWidget(bar1d);

    Slider* slider1 = new Slider();
    slider1->sigValueChanged.connect(sigc::mem_fun(bar1, &ProgressBar::setValue));
    vBox3->addWidget(slider1);

    Slider* slider11 = new Slider();
    slider11->setValue(48);
    slider11->setDisabled();
    vBox3->addWidget(slider11);

    Slider* slider2 = new Slider();
    slider2->setInverted(true);
    slider2->sigValueChanged.connect(sigc::mem_fun(bar1, &ProgressBar::setValue));
    vBox3->addWidget(slider2);

    ScrollBar* sb1 = new ScrollBar(Horizontal);
    sb1->setRange(0, 10);
    vBox3->addWidget(sb1);

    ScrollBar* sb12 = new ScrollBar(Horizontal);
    sb12->setDisabled();
    sb12->setRange(0, 10);
    sb12->setValue(5);
    vBox3->addWidget(sb12);

    // Verticals
    HBoxLayout* vSliderLayout = new HBoxLayout();
    vBox3->addWidget(vSliderLayout);

    ProgressBar* bar2 = new ProgressBar();
    bar2->setValue(5);
    bar2->setOrientation(Vertical);
    vSliderLayout->addWidget(bar2);

    Slider* slider3 = new Slider();
    slider3->setOrientation(Vertical);
    slider3->sigValueChanged.connect(sigc::mem_fun(bar2, &ProgressBar::setValue));
    vSliderLayout->addWidget(slider3);

    Slider* slider4 = new Slider();
    slider4->setOrientation(Vertical);
    slider4->setInverted(true);
    slider4->sigValueChanged.connect(sigc::mem_fun(bar2, &ProgressBar::setValue));
    vSliderLayout->addWidget(slider4);

    ScrollBar* sb2 = new ScrollBar(Vertical);
    sb2->setRange(0, 10);
    vSliderLayout->addWidget(sb2);

    ComboBox::StringList list;

    char str[5];
    for (int i = 2005; i > 1900; --i)
    {
        sprintf(str, "%d", i);
        list.push_back(str);
    }

    ComboBox* co1 = new ComboBox("Select your date of birth:");
    co1->addItems(list);
    vBox3->addWidget(co1);

    SpinBox* spin1 = new SpinBox(5);
    vBox3->addWidget(spin1);


}
Example #4
0
Contacts::Contacts(ContactManager* manager, Widget* parent)
        : Frame(parent),
          _manager(manager),
          _dialogAddMode(1)
{
    VBoxLayout* box = new VBoxLayout();
    box->setHorizontalAlignment(Alignment::Center);
    setLayout(box);

    ButtonGroup* group1 = new ButtonGroup();
    addWidget(group1);

    _add = new DirectionalButton("Add");
    _add->setIcon(StyleHint::Plus);
    _add->sigClicked.connect(sigc::mem_fun(this, &Contacts::showAddContactDialog));
    group1->addButton(_add);

    _remove = new DirectionalButton("Remove");
    _remove->setDisabled();
    _remove->setIcon(StyleHint::Minus);
    _remove->sigClicked.connect(sigc::mem_fun(this, &Contacts::removeContact));
    group1->addButton(_remove);

    _edit = new DirectionalButton("Edit");
    _edit->setDisabled();
    _edit->setIcon(StyleHint::Edit);
    _edit->sigClicked.connect(sigc::mem_fun(this, &Contacts::showEditContactDialog));
    group1->addButton(_edit);

    _contactsList = new ListBox();
    _contactsList->setDrawFrame(true);
    _contactsList->sigIndexChanged.connect(sigc::mem_fun(this, &Contacts::updateButtons));
    addWidget(_contactsList);

    ButtonGroup* group2 = new ButtonGroup();
    addWidget(group2);

    _txt = new DirectionalButton("Text");
    _txt->setIcon(StyleHint::Comment);
    _txt->setDisabled();
//    _txt->sigClicked.connect(sigc::mem_fun(this, &Contacts::addContact));
    group2->addButton(_txt);

    _call = new DirectionalButton("Call");
    _call->setDisabled();
    _call->setIcon(StyleHint::Phone);
    _call->sigClicked.connect(sigc::bind<bool>(sigc::mem_fun(this, &Contacts::callContact), false));
    group2->addButton(_call);

    _video = new DirectionalButton("Video Call");
    _video->setDisabled();
    _video->setIcon(StyleHint::Camera);
    _video->sigClicked.connect(sigc::bind<bool>(sigc::mem_fun(this, &Contacts::callContact), true));
    group2->addButton(_video);

    _contactDialog = new Dialog("Add Contact", Dialog::OKCancelButtonOption);
    _contactDialog->setLayout(new VBoxLayout());
    _contactDialog->addWidget(new Label("Name:"));
    _nameInput = new LineInput("");
    _contactDialog->addWidget(_nameInput);
    Size s = _nameInput->preferredSize();
    _nameInput->setMinimumSize(PlatformManager::instance().getLayerSize().width() - 200, s.height());
    _contactDialog->addWidget(new Label("Address:"));
    _addrInput = new LineInput("");
    _contactDialog->addWidget(_addrInput);
    _contactDialog->sigAccepted.connect(sigc::mem_fun(this, &Contacts::handleDialogAccept));

    populate();
}
Example #5
0
ILXSoundMixer::ILXSoundMixer(int argc, char* argv[])
        : Application(&argc, &argv, AppOptions(OptDaleAuto | OptSound)),
          _soundComponent(NULL),
          _music(NULL),
          _bandSliderFont(NULL)
{
    setMargin(20);
    setLayout(new VBoxLayout());

    _bandSliderFont = new Font("Sans", 8);

    HBoxLayout* volStuff = new HBoxLayout();
    addWidget(volStuff);
    TabPanel* panel = new TabPanel();
    volStuff->addWidget(panel);

    //**********
    HBoxLayout* volHBox = new HBoxLayout();
    panel->addTab(volHBox, "Volume Control");

    GridLayout* volGrid = new GridLayout(8, 3);
    volHBox->addWidget(volGrid);
    volGrid->addWidget(new Label("Master Volume:"), 0, 0, 0, 3);

    _masterVolume = new Slider();
    _masterVolume->setRange(0, 1);
    _masterVolume->setValue(SoundDFB::getMasterVolume());
    _masterVolume->setStep(0.1);
    _masterVolume->setPageStep(0.2);
    _masterVolume->setUpdateMode(Slider::UponRelease);
    _masterVolume->sigValueChanged.connect(sigc::mem_fun(this, &ILXSoundMixer::changeMasterVolume));
    volGrid->addWidget(_masterVolume, 1, 0, 0, 2);

    _mute = new PushButton("Mute");
    _mute->setXConstraint(FixedConstraint);
    volGrid->addWidget(_mute, 1, 2);
    _mute->sigClicked.connect(sigc::mem_fun(this, &ILXSoundMixer::mute));

    volGrid->addWidget(new Label("Sound Effects:"), 2, 0, 0, 3);
    _effectsVolume = new Slider();
    _effectsVolume->setRange(0, 1);
    _effectsVolume->setValue(1);
    _effectsVolume->setStep(0.1);
    _effectsVolume->setPageStep(0.2);
    _effectsVolume->setUpdateMode(Slider::UponRelease);
    _effectsVolume->sigValueChanged.connect(sigc::mem_fun(this, &ILXSoundMixer::changeEffectsVolume));
    volGrid->addWidget(_effectsVolume, 3, 0, 0, 2);

    volGrid->addWidget(new Label("Balance:"), 4, 0, 0, 3);

    volGrid->addWidget(new Label("Front"), 5, 0);
    Slider* frSlider = new Slider();
    frSlider->setValue(50);
    volGrid->addWidget(frSlider, 5, 1);
    volGrid->addWidget(new Label("Rear"), 5, 2);

    volGrid->addWidget(new Label("Left"), 6, 0);
    Slider* lrSlider = new Slider();
    lrSlider->setValue(50);
    volGrid->addWidget(lrSlider, 6, 1);
    volGrid->addWidget(new Label("Right"), 6, 2);

    volGrid->addWidget(new Spacer(Vertical), 7, 0);

    GroupBox* volMeter = new GroupBox("Meter");
    VBoxLayout* volMeterLayout = new VBoxLayout();
    volMeterLayout->setHorizontalAlignment(Alignment::Center);
    volMeter->setLayout(volMeterLayout);
    volMeter->setXConstraint(FixedConstraint);
    volStuff->addWidget(volMeter);
    VolumeMeter* meter = new VolumeMeter();
    volMeter->addWidget(meter);
    volHBox->addWidget(volMeter);

    //*********
    VBoxLayout* eqBox = new VBoxLayout();
    panel->addTab(eqBox, "Equalizer");

    HBoxLayout* buttons = new HBoxLayout();
    buttons->addWidget(new CheckBox("EQ Enabled"));
    buttons->addWidget(new Spacer(Horizontal));
    buttons->addWidget(new PushButton("Load Preset"));
    buttons->addWidget(new PushButton("Save Preset"));
    PushButton* testSound = new PushButton("Test");
    testSound->sigClicked.connect(sigc::mem_fun(this, &ILXSoundMixer::playTestSound));
    buttons->addWidget(testSound);
    eqBox->addWidget(buttons);

    HBoxLayout* rowLevels = new HBoxLayout();
    rowLevels->setYConstraint(ExpandingConstraint);
    rowLevels->addWidget(new BandSlider("50Hz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("100Hz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("156Hz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("220Hz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("311Hz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("440Hz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("622Hz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("880Hz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("1.25KHz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("1.75KHz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("2.5KHz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("3.5KHz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("5KHz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("10KHz", _bandSliderFont));
    rowLevels->addWidget(new BandSlider("20KHz", _bandSliderFont));
    eqBox->addWidget(rowLevels);

#if ILIXI_HAVE_COMPOSITOR
    DaleDFB::comaGetComponent("SoundMixer", &_soundComponent);
    if (_soundComponent)
        _soundComponent->Listen(_soundComponent, SoundMixer::VolumeChanged, volumeListener, this);
#endif
    _music = new Music(ILIXI_DATADIR"soundmixer/test.wav");
    _music->setRepeat(true);

}