#include "application.h"
#include <iostream>

using namespace std;
using namespace genv;

textBox* text1;
textBox* text2;
listBox* list1;
listBox* list2;
button* B_add1;
button* B_add2;
button* B_right;
button* B_left;

void add1_Click(int x, int y, char button, widget* me)
{
    list1->addItem(text1->getText());
}

void add2_Click(int x, int y, char button, widget* me)
{
    list2->addItem(text2->getText());
}

void right_Click(int x, int y, char button, widget* me)
{
    list2->addItem(list1->getItem(list1->getIndex()));
    list1->deleteItem(list1->getIndex());
}

void left_Click(int x, int y, char button, widget* me)
{
    list1->addItem(list2->getItem(list2->getIndex()));
    list2->deleteItem(list2->getIndex());
}

/// ---- Main ------------------------
int main ()
{
    application App(480, 400);

    App.add( text1 = new textBox( 20, 20, 150, 30) );
    App.add( text2 = new textBox( 250, 20, 150, 30) );
    vector<string> temp = { "Szoveg1", "Szoveg2", "Szoveg3" };
    App.add( list1 = new listBox( 20, 70, 150, 300, temp) );
    App.add( list2 = new listBox( 250, 70, 150, 300, temp) );
    App.add( B_add1 = new button( 200, 20, 30, 30, "+", add1_Click ) );
    App.add( B_add2 = new button( 420, 20, 30, 30, "+", add2_Click ) );
    App.add( B_right = new button( 200, 70, 40, 30, ">>", right_Click ) );
    App.add( B_left = new button( 200, 120, 40, 30, "<<", left_Click ) );

    /// ---------------------
    App.run();

    return 0;
}
