8d2739fad688b4838fcb040e9d74b1195ea9546f
[sdk] / ide / src / dialogs / ProjectActiveConfig.ec
1 import "ide"
2
3 class ProjectActiveConfig : Window
4 {
5    text = $"Project Active Configuration";
6    background = formColor;
7    borderStyle = fixed;
8    minClientSize = { 568, 40 };
9    hasClose = true;
10    tabCycle = true;
11    size = { 568, 40 };
12
13    Project project;
14    property Project project
15    {
16       set
17       {
18          project = value;
19
20          if(project)
21          {
22             DataRow row;
23             ProjectConfig cfg;
24
25             for(cfg : project.configurations)
26             {
27                row = config.AddString(cfg.name);
28                row.tag = (int)cfg;
29                if(cfg == project.config)
30                   config.currentRow = row;
31             }
32          }
33       }
34    }
35
36    Button ok
37    {
38       this, size = { 80 }, position = { 392, 8 };
39       text = $"OK", isDefault = true;
40
41       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
42       {
43          ProjectConfig activeConfig = (ProjectConfig)config.currentRow.tag;
44          if(activeConfig != project.config)
45          {
46             project.config = activeConfig;
47             ide.projectView.Update(null);
48          }
49          Destroy(DialogResult::ok);
50          return true;
51       }
52    };
53    
54    Button cancel
55    {
56       this, size = { 80 }, position = { 480, 8 };
57       text = $"Cancel", hotKey = escape, id = DialogResult::cancel;
58       NotifyClicked = ButtonCloseDialog;
59    };
60
61    Label { this, position = { 20, 14 }, labeledWindow = config };
62    DropBox config
63    {
64       this, position = { 160, 8 }, size = { 220 };
65       text = $"Active Configuration", hotKey = altA;
66    };
67    
68 }