added numObjects
This commit is contained in:
parent
511dca32f8
commit
ae9d3d84c9
2 changed files with 53 additions and 53 deletions
53
src/Tab.cc
53
src/Tab.cc
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "Tab.hh"
|
||||||
|
|
||||||
|
@ -152,11 +152,10 @@ void Tab::focus() {
|
||||||
//-----------------------------------------
|
//-----------------------------------------
|
||||||
void Tab::raise() {
|
void Tab::raise() {
|
||||||
//get first tab
|
//get first tab
|
||||||
Tab *first = 0;
|
Tab *tab = 0;
|
||||||
first = getFirst(this);
|
|
||||||
//raise tabs
|
//raise tabs
|
||||||
for (; first!=0; first = first->m_next)
|
for (tab = getFirst(this); tab!=0; tab = tab->m_next)
|
||||||
m_win->getScreen()->raiseWindows(&first->m_tabwin, 1);
|
m_win->getScreen()->raiseWindows(&tab->m_tabwin, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------- lower --------------------
|
//-------------- lower --------------------
|
||||||
|
@ -165,9 +164,9 @@ void Tab::raise() {
|
||||||
//-----------------------------------------
|
//-----------------------------------------
|
||||||
void Tab::lower() {
|
void Tab::lower() {
|
||||||
Tab *current = this;
|
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
|
//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 {
|
do {
|
||||||
XLowerWindow(m_display, current->m_tabwin); //lower tabwin and tabs window
|
XLowerWindow(m_display, current->m_tabwin); //lower tabwin and tabs window
|
||||||
win = current->getWindow();
|
win = current->getWindow();
|
||||||
|
@ -199,6 +198,7 @@ void Tab::loadTheme() {
|
||||||
} else
|
} else
|
||||||
m_focus_pm =
|
m_focus_pm =
|
||||||
image_ctrl->renderImage(m_size_w, m_size_h, pt);
|
image_ctrl->renderImage(m_size_w, m_size_h, pt);
|
||||||
|
|
||||||
if (tmp) image_ctrl->removeImage(tmp);
|
if (tmp) image_ctrl->removeImage(tmp);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -279,7 +279,7 @@ void Tab::stick() {
|
||||||
|
|
||||||
//now do stick for all windows in the list
|
//now do stick for all windows in the list
|
||||||
for (tab = getFirst(this); tab != 0; tab = tab->m_next) {
|
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()) {
|
if (win->isStuck()) {
|
||||||
win->blackbox_attrib.flags ^= BaseDisplay::ATTRIB_OMNIPRESENT;
|
win->blackbox_attrib.flags ^= BaseDisplay::ATTRIB_OMNIPRESENT;
|
||||||
win->blackbox_attrib.attrib ^= BaseDisplay::ATTRIB_OMNIPRESENT;
|
win->blackbox_attrib.attrib ^= BaseDisplay::ATTRIB_OMNIPRESENT;
|
||||||
|
@ -543,7 +543,7 @@ void Tab::calcIncrease(void) {
|
||||||
|
|
||||||
Tab *tab;
|
Tab *tab;
|
||||||
int inc_x = 0, inc_y = 0;
|
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 ||
|
if (m_win->getScreen()->getTabPlacement() == PTOP ||
|
||||||
m_win->getScreen()->getTabPlacement() == PBOTTOM ||
|
m_win->getScreen()->getTabPlacement() == PBOTTOM ||
|
||||||
|
@ -588,9 +588,7 @@ 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++) {
|
||||||
|
|
||||||
for (tab = getFirst(this); tab!=0; tab = tab->m_next, i++){
|
|
||||||
|
|
||||||
//TODO: move this out from here?
|
//TODO: move this out from here?
|
||||||
if ((m_win->getScreen()->getTabPlacement() == PTOP ||
|
if ((m_win->getScreen()->getTabPlacement() == PTOP ||
|
||||||
|
@ -1067,16 +1065,23 @@ unsigned int Tab::calcRelativeWidth() {
|
||||||
return ((m_win->getWidth() + m_win->getScreen()->getBorderWidth2x())/num);
|
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 -------
|
//------------- calcRelativeHeight -------
|
||||||
// Returns: Calculated height for relative
|
// Returns: Calculated height for relative
|
||||||
// alignment
|
// alignment
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
unsigned int Tab::calcRelativeHeight() {
|
unsigned int Tab::calcRelativeHeight() {
|
||||||
unsigned int num=0;
|
return ((m_win->getHeight() +
|
||||||
//calculate num objs in list (extract this to a function?)
|
m_win->getScreen()->getBorderWidth2x())/numObjects());
|
||||||
for (Tab *first=getFirst(this); first!=0; first=first->m_next, num++);
|
|
||||||
|
|
||||||
return ((m_win->getHeight() + m_win->getScreen()->getBorderWidth2x())/num);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------- calcCenterXPos -----------
|
//------------- calcCenterXPos -----------
|
||||||
|
@ -1084,11 +1089,8 @@ unsigned int Tab::calcRelativeHeight() {
|
||||||
// centered alignment
|
// centered alignment
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
unsigned int Tab::calcCenterXPos() {
|
unsigned int Tab::calcCenterXPos() {
|
||||||
unsigned int num=0;
|
return (m_win->getXFrame() + ((m_win->getWidth() -
|
||||||
//calculate num objs in list (extract this to a function?)
|
(m_size_w * numObjects())) / 2));
|
||||||
for (Tab *first=getFirst(this); first!=0; first=first->m_next, num++);
|
|
||||||
|
|
||||||
return (m_win->getXFrame() + ((m_win->getWidth() - (m_size_w * num)) / 2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------- calcCenterYPos -----------
|
//------------- calcCenterYPos -----------
|
||||||
|
@ -1096,11 +1098,8 @@ unsigned int Tab::calcCenterXPos() {
|
||||||
// centered alignment
|
// centered alignment
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
unsigned int Tab::calcCenterYPos() {
|
unsigned int Tab::calcCenterYPos() {
|
||||||
unsigned int num=0;
|
return (m_win->getYFrame() + ((m_win->getHeight() -
|
||||||
//calculate num objs in list (extract this to a function?)
|
(m_size_h * numObjects())) / 2));
|
||||||
for (Tab *first=getFirst(this); first!=0; first=first->m_next, num++);
|
|
||||||
|
|
||||||
return (m_win->getYFrame() + ((m_win->getHeight() - (m_size_h * num)) / 2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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_
|
#ifndef _TAB_HH_
|
||||||
#define _TAB_HH_
|
#define _TAB_HH_
|
||||||
|
@ -100,6 +100,7 @@ private:
|
||||||
int setPositionLRAlignHelper(Alignment align);
|
int setPositionLRAlignHelper(Alignment align);
|
||||||
void setTabWidth(unsigned int w);
|
void setTabWidth(unsigned int w);
|
||||||
void setTabHeight(unsigned int h);
|
void setTabHeight(unsigned int h);
|
||||||
|
unsigned int numObjects();
|
||||||
unsigned int calcRelativeWidth();
|
unsigned int calcRelativeWidth();
|
||||||
unsigned int calcRelativeHeight();
|
unsigned int calcRelativeHeight();
|
||||||
unsigned int calcCenterXPos();
|
unsigned int calcCenterXPos();
|
||||||
|
|
Loading…
Reference in a new issue