Changeset 97:23f0afd1a323 in glemon-0.x for main_win.cc
- Timestamp:
- 12/08/05 15:16:08 (19 years ago)
- Branch:
- gui
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk/gui@2424
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main_win.cc
r96 r97 75 75 ag->add( Gtk::Action::create("FileNewTab", "New _Tab"), 76 76 sigc::mem_fun(*this, &MainWin::newTab)); 77 ag->add( Gtk::Action::create("FileCloseTab", "_Close Tab"), 78 sigc::mem_fun(*this, &MainWin::closeTab)); 77 79 ag->add( Gtk::Action::create("FileNew", Gtk::Stock::NEW), 78 80 sigc::mem_fun(*this, &MainWin::newFile)); … … 132 134 " <menu action='FileMenu'>" 133 135 " <menuitem action='FileNewTab'/>" 136 " <menuitem action='FileCloseTab'/>" 134 137 " <menuitem action='FileNew'/>" 135 138 " <menuitem action='FileOpen'/>" … … 231 234 } 232 235 236 void MainWin::closeTab() 237 { 238 if(active_tab!=-1) 239 { 240 //tabs vector will be decreased with the deleted value 241 int size=tabs.size(); 242 if(size>1) 243 { 244 for(int i=active_tab+1;i<size;i++) 245 { 246 tabs[i-1]=tabs[i]; 247 } 248 } 249 250 //if size==1 resize will delete the only element 251 tabs.resize(size-1); 252 253 int old_active_tab=active_tab; 254 notebook.remove_page(active_tab); 255 256 //If the first tab was active, upon delete notebook 257 //will first switch one tab upper and not lower like 258 //in the case, when not the first tab was active. 259 //But after deletion it will become the first tab, 260 //and this should be registrated in tabs vector, 261 //as well. 262 if(old_active_tab==0) 263 { 264 onChangeTab(NULL,0); 265 } 266 267 //if this was the last page in notebook, there is 268 //no active_tab now 269 if(size==1) 270 { 271 active_tab=-1; 272 } 273 } 274 } 275 233 276 void MainWin::onChangeTab(GtkNotebookPage* page, guint page_num) 234 277 {
Note: See TracChangeset
for help on using the changeset viewer.