1 /**
2  * File name: List.cpp
3  * Project: Redkite (A small GUI toolkit)
4  *
5  * Copyright (C) 2020 Iurie Nistor <http://iuriepage.wordpress.com>
6  *
7  * This file is part of Redkite.
8  *
9  * Redkite is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */
23 
24 #include "RkMain.h"
25 #include "RkWidget.h"
26 #include "RkLog.h"
27 #include "RkList.h"
28 
29 class StringListModel
30 
main(int arc,char ** argv)31 int main(int arc, char **argv)
32 {
33         RkMain app(arc, argv);
34 
35         // Create main window.
36         auto mainWindow = new RkWidget(&app);
37         mainWindow->setTitle("Main Window");
38 	mainWindow->setPosition(180, 180);
39         mainWindow->setSize(400, 500);
40 
41          int x = 10;
42          int y = 10;
43          RK_LOG_DEBUG("create childs");
44          for (auto i = 0; i < 10; i++) {
45                  RK_LOG_DEBUG("create child " << i);
46                  auto child = new RkWidget(mainWindow);
47                  child->setTitle("Child[" + std::to_string(i) + "] - LEVEL 1");
48                  child->setPosition(x, y);
49                  child->setSize(60, 60);
50                  child->setBorderWidth(1);
51                  child->setBorderColor(0, 255, 0);
52                  child->show();
53 
54                  auto child_l = new RkWidget(child);
55                  child_l->setTitle("Child[" + std::to_string(i) + "] - LEVEL 2");
56                  child_l->setPosition(10, 10);
57                  child_l->setSize(30, 30);
58                  child_l->setBorderWidth(1);
59                  child_l->setBorderColor(0, 0, 255);
60                  child_l->show();
61 
62                  x += 65;
63                  if (x > 650) {
64                          y += 65;
65                          x = 10;
66                  }
67         }
68 
69         mainWindow->show();
70         int res = app.exec();
71         return res;
72 }
73