aboutsummaryrefslogtreecommitdiff
path: root/src/uicmd.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/uicmd.cc')
-rw-r--r--src/uicmd.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/uicmd.cc b/src/uicmd.cc
index a46fd7c5..957bedd7 100644
--- a/src/uicmd.cc
+++ b/src/uicmd.cc
@@ -189,6 +189,7 @@ public:
Fl_Wizard *wizard(void) { return Wizard; }
int num_tabs() { return (Pack ? Pack->children() : 0); }
void switch_tab(CustTabButton *cbtn);
+ void switch_tab(int index);
void prev_tab(void);
void next_tab(void);
void set_tab_label(UI *ui, const char *title);
@@ -487,6 +488,15 @@ void CustTabs::next_tab()
}
/**
+ * Make index tab the active one, starting from 0.
+ */
+void CustTabs::switch_tab(int index)
+{
+ if (index >= 0 && index < num_tabs())
+ switch_tab((CustTabButton*)Pack->child(index));
+}
+
+/**
* Set this UI's tab button label.
*/
void CustTabs::set_tab_label(UI *ui, const char *label)
@@ -1684,3 +1694,14 @@ void a_UIcmd_focus_location(void *vbw)
BW2UI(bw)->focus_location();
}
+/*
+ * Focus the tab at index, starting from 0.
+ */
+void a_UIcmd_focus_tab(void *vbw, int index)
+{
+ BrowserWindow *bw = (BrowserWindow*)vbw;
+ UI *ui = BW2UI(bw);
+ CustTabs *tabs = ui->tabs();
+ if (tabs)
+ tabs->switch_tab(index);
+}