1 /**
2  * File name: child.cpp
3  * Project: Redkite (A small GUI toolkit)
4  *
5  * Copyright (C) 2020 Iurie Nistor <http://geontime.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 
28 #include <vector>
29 
main(int arc,char ** argv)30 int main(int arc, char **argv)
31 {
32         RkMain app(arc, argv);
33 
34         // Create main window.
35         auto mainWindow = new RkWidget(&app);
36         mainWindow->setTitle("Main Window");
37 	mainWindow->setPosition(180, 180);
38         mainWindow->setSize(400, 500);
39 
40          int x = 10;
41          int y = 10;
42          RK_LOG_DEBUG("create childs");
43          for (auto i = 0; i < 10; i++) {
44                  RK_LOG_DEBUG("create child " << i);
45                  auto child = new RkWidget(mainWindow);
46                  child->setTitle("Child[" + std::to_string(i) + "] - LEVEL 1");
47                  child->setPosition(x, y);
48                  child->setSize(60, 60);
49                  child->setBorderWidth(1);
50                  child->setBorderColor(0, 255, 0);
51                  child->show();
52 
53                  auto child_l = new RkWidget(child);
54                  child_l->setTitle("Child[" + std::to_string(i) + "] - LEVEL 2");
55                  child_l->setPosition(10, 10);
56                  child_l->setSize(30, 30);
57                  child_l->setBorderWidth(1);
58                  child_l->setBorderColor(0, 0, 255);
59                  child_l->show();
60 
61                  x += 65;
62                  if (x > 650) {
63                          y += 65;
64                          x = 10;
65                  }
66         }
67 
68         mainWindow->show();
69         int res = app.exec();
70         return res;
71 }
72 
73 
74