added numObjects
This commit is contained in:
parent
511dca32f8
commit
ae9d3d84c9
2 changed files with 53 additions and 53 deletions
51
src/Tab.cc
51
src/Tab.cc
|
@ -19,7 +19,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: Tab.cc,v 1.19 2002/02/02 18:20:44 pekdon Exp $
|
||||
// $Id: Tab.cc,v 1.20 2002/02/04 06:50:48 fluxgen Exp $
|
||||
|
||||
#include "Tab.hh"
|
||||
|
||||
|
@ -152,11 +152,10 @@ void Tab::focus() {
|
|||
//-----------------------------------------
|
||||
void Tab::raise() {
|
||||
//get first tab
|
||||
Tab *first = 0;
|
||||
first = getFirst(this);
|
||||
Tab *tab = 0;
|
||||
//raise tabs
|
||||
for (; first!=0; first = first->m_next)
|
||||
m_win->getScreen()->raiseWindows(&first->m_tabwin, 1);
|
||||
for (tab = getFirst(this); tab!=0; tab = tab->m_next)
|
||||
m_win->getScreen()->raiseWindows(&tab->m_tabwin, 1);
|
||||
}
|
||||
|
||||
//-------------- lower --------------------
|
||||
|
@ -165,9 +164,9 @@ void Tab::raise() {
|
|||
//-----------------------------------------
|
||||
void Tab::lower() {
|
||||
Tab *current = this;
|
||||
FluxboxWindow *win = 0; //convinence
|
||||
FluxboxWindow *win = 0; //convenience
|
||||
//this have to be done in the correct order, otherwise we'll switch the window
|
||||
//beeing ontop in the group
|
||||
//being ontop in the group
|
||||
do {
|
||||
XLowerWindow(m_display, current->m_tabwin); //lower tabwin and tabs window
|
||||
win = current->getWindow();
|
||||
|
@ -199,6 +198,7 @@ void Tab::loadTheme() {
|
|||
} else
|
||||
m_focus_pm =
|
||||
image_ctrl->renderImage(m_size_w, m_size_h, pt);
|
||||
|
||||
if (tmp) image_ctrl->removeImage(tmp);
|
||||
|
||||
} else {
|
||||
|
@ -279,7 +279,7 @@ void Tab::stick() {
|
|||
|
||||
//now do stick for all windows in the list
|
||||
for (tab = getFirst(this); tab != 0; tab = tab->m_next) {
|
||||
FluxboxWindow *win = tab->m_win; //just for convenient
|
||||
FluxboxWindow *win = tab->m_win; //just for convenience
|
||||
if (win->isStuck()) {
|
||||
win->blackbox_attrib.flags ^= BaseDisplay::ATTRIB_OMNIPRESENT;
|
||||
win->blackbox_attrib.attrib ^= BaseDisplay::ATTRIB_OMNIPRESENT;
|
||||
|
@ -543,7 +543,7 @@ void Tab::calcIncrease(void) {
|
|||
|
||||
Tab *tab;
|
||||
int inc_x = 0, inc_y = 0;
|
||||
unsigned int tabs = 0, i = 0;
|
||||
unsigned int i = 0, tabs = numObjects();
|
||||
|
||||
if (m_win->getScreen()->getTabPlacement() == PTOP ||
|
||||
m_win->getScreen()->getTabPlacement() == PBOTTOM ||
|
||||
|
@ -588,8 +588,6 @@ void Tab::calcIncrease(void) {
|
|||
}
|
||||
}
|
||||
|
||||
for (tab = getFirst(this); tab!=0; tab = tab->m_next, tabs++);
|
||||
|
||||
for (tab = getFirst(this); tab!=0; tab = tab->m_next, i++) {
|
||||
|
||||
//TODO: move this out from here?
|
||||
|
@ -1067,16 +1065,23 @@ unsigned int Tab::calcRelativeWidth() {
|
|||
return ((m_win->getWidth() + m_win->getScreen()->getBorderWidth2x())/num);
|
||||
}
|
||||
|
||||
//--------------- numObjects -------------------
|
||||
// Returns the number of objects in
|
||||
// the TabGroup.
|
||||
//-----------------------------------------------
|
||||
unsigned int Tab::numObjects() {
|
||||
unsigned int num = 0;
|
||||
for (Tab *tab = getFirst(this); tab != 0; tab = tab->m_next, num++);
|
||||
return num;
|
||||
}
|
||||
|
||||
//------------- calcRelativeHeight -------
|
||||
// Returns: Calculated height for relative
|
||||
// alignment
|
||||
//----------------------------------------
|
||||
unsigned int Tab::calcRelativeHeight() {
|
||||
unsigned int num=0;
|
||||
//calculate num objs in list (extract this to a function?)
|
||||
for (Tab *first=getFirst(this); first!=0; first=first->m_next, num++);
|
||||
|
||||
return ((m_win->getHeight() + m_win->getScreen()->getBorderWidth2x())/num);
|
||||
return ((m_win->getHeight() +
|
||||
m_win->getScreen()->getBorderWidth2x())/numObjects());
|
||||
}
|
||||
|
||||
//------------- calcCenterXPos -----------
|
||||
|
@ -1084,11 +1089,8 @@ unsigned int Tab::calcRelativeHeight() {
|
|||
// centered alignment
|
||||
//----------------------------------------
|
||||
unsigned int Tab::calcCenterXPos() {
|
||||
unsigned int num=0;
|
||||
//calculate num objs in list (extract this to a function?)
|
||||
for (Tab *first=getFirst(this); first!=0; first=first->m_next, num++);
|
||||
|
||||
return (m_win->getXFrame() + ((m_win->getWidth() - (m_size_w * num)) / 2));
|
||||
return (m_win->getXFrame() + ((m_win->getWidth() -
|
||||
(m_size_w * numObjects())) / 2));
|
||||
}
|
||||
|
||||
//------------- calcCenterYPos -----------
|
||||
|
@ -1096,11 +1098,8 @@ unsigned int Tab::calcCenterXPos() {
|
|||
// centered alignment
|
||||
//----------------------------------------
|
||||
unsigned int Tab::calcCenterYPos() {
|
||||
unsigned int num=0;
|
||||
//calculate num objs in list (extract this to a function?)
|
||||
for (Tab *first=getFirst(this); first!=0; first=first->m_next, num++);
|
||||
|
||||
return (m_win->getYFrame() + ((m_win->getHeight() - (m_size_h * num)) / 2));
|
||||
return (m_win->getYFrame() + ((m_win->getHeight() -
|
||||
(m_size_h * numObjects())) / 2));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: Tab.hh,v 1.9 2002/01/27 12:52:02 fluxgen Exp $
|
||||
// $Id: Tab.hh,v 1.10 2002/02/04 06:51:15 fluxgen Exp $
|
||||
|
||||
#ifndef _TAB_HH_
|
||||
#define _TAB_HH_
|
||||
|
@ -100,6 +100,7 @@ private:
|
|||
int setPositionLRAlignHelper(Alignment align);
|
||||
void setTabWidth(unsigned int w);
|
||||
void setTabHeight(unsigned int h);
|
||||
unsigned int numObjects();
|
||||
unsigned int calcRelativeWidth();
|
||||
unsigned int calcRelativeHeight();
|
||||
unsigned int calcCenterXPos();
|
||||
|
|
Loading…
Reference in a new issue