Ecere Software
/
sdk
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5bcef46
)
ecere/gui/controls/TabControl: Tweaks to remove and add tabs
author
Jerome St-Louis
<jerome@ecere.com>
Sat, 14 Mar 2015 05:56:55 +0000
(
01:56
-0400)
committer
Jerome St-Louis
<jerome@ecere.com>
Sat, 14 Mar 2015 05:56:55 +0000
(
01:56
-0400)
ecere/src/gui/controls/TabControl.ec
patch
|
blob
|
history
diff --git
a/ecere/src/gui/controls/TabControl.ec
b/ecere/src/gui/controls/TabControl.ec
index
e1e2e91
..
e39553f
100644
(file)
--- a/
ecere/src/gui/controls/TabControl.ec
+++ b/
ecere/src/gui/controls/TabControl.ec
@@
-572,18
+572,25
@@
public class TabControl : Window
public void AddTab(Tab tab)
{
public void AddTab(Tab tab)
{
- tab.parent = this;
+ if(tab.parent != this)
+ {
+ tab.parent = this;
+ return;
+ }
tab.autoCreate = false;
tab.id = numTabs;
tab.autoCreate = false;
tab.id = numTabs;
- tab.button = TabButton
+ if(!tab.button)
{
{
- parent = tabButtons,
- master = this, stayDown = true,
- text = tab.text, id = (int64)(intptr)tab, NotifyClicked = NotifyClicked,
- tab = tab,
- background = background;
- };
- incref tab.button;
+ tab.button = TabButton
+ {
+ parent = tabButtons,
+ master = this, stayDown = true,
+ text = tab.text, id = (int64)(intptr)tab, NotifyClicked = NotifyClicked,
+ tab = tab,
+ background = background;
+ };
+ incref tab.button;
+ }
if(created)
{
if(created)
{
@@
-614,7
+621,7
@@
public class TabControl : Window
{
Window child;
Tab fallbackTab = null;
{
Window child;
Tab fallbackTab = null;
- tab.parent = null;
+
//
tab.parent = null;
for(child = tabButtons.children.first; child; child = child.next)
{
if(child._class == class(TabButton))
for(child = tabButtons.children.first; child; child = child.next)
{
if(child._class == class(TabButton))
@@
-623,7
+630,10
@@
public class TabControl : Window
if(button.id == (int64)(intptr)tab)
{
if(button.created)
if(button.id == (int64)(intptr)tab)
{
if(button.created)
+ {
button.Destroy(0);
button.Destroy(0);
+ numTabs--;
+ }
break;
}
else
break;
}
else
@@
-636,12
+646,13
@@
public class TabControl : Window
fallbackTab = tabButtons.children.first ? ((TabButton)tabButtons.children.first).tab : null;
if(fallbackTab)
fallbackTab.SelectTab();
fallbackTab = tabButtons.children.first ? ((TabButton)tabButtons.children.first).tab : null;
if(fallbackTab)
fallbackTab.SelectTab();
+ else
+ curTab = null;
/*curTab = fallbackTab;
curButton = curTab.button;
curButton.checked = true;
curTab.autoCreate = true;*/
}
/*curTab = fallbackTab;
curButton = curTab.button;
curButton.checked = true;
curTab.autoCreate = true;*/
}
- numTabs--;
}
~TabControl()
}
~TabControl()