Back to index

salome-gui  6.5.0
Classes | Functions
QtxWorkstack.cxx File Reference
#include "QtxWorkstack.h"
#include "QtxAction.h"
#include <QMenu>
#include <QStyle>
#include <QRegExp>
#include <QLayout>
#include <QPainter>
#include <QDataStream>
#include <QFocusEvent>
#include <QMouseEvent>
#include <QRubberBand>
#include <QApplication>
#include <QStyleOption>
#include <QInputDialog>
#include <QStackedWidget>
#include <QAbstractButton>

Go to the source code of this file.

Classes

class  QtxWorkstackArea::WidgetEvent
 Internal class used to forward child widgets events to the workarea. More...
class  QtxWorkstackArea::RestoreEvent
 Internal class used to forward restore info events to the workarea. More...
class  CloseButton

Functions

static void setSizes (QIntList &szList, const int item_ind, const int new_near, const int new_this, const int new_farr)
 Calculate sizes of the splitter widget for the workarea.
static int positionSimple (QIntList &szList, const int nb, const int splitter_size, const int item_ind, const int item_rel_pos, const int need_pos, const int splitter_pos)
 Calculate sizes of the splitter widget for the workarea.

Function Documentation

static int positionSimple ( QIntList szList,
const int  nb,
const int  splitter_size,
const int  item_ind,
const int  item_rel_pos,
const int  need_pos,
const int  splitter_pos 
) [static]

Calculate sizes of the splitter widget for the workarea.

Definition at line 2252 of file QtxWorkstack.cxx.

{
  if (item_ind == 0) { // cannot move in this splitter
    return (need_pos - splitter_pos);
  }

  int delta = 0;
  int new_prev = 0;
  int new_this = szList[item_ind];
  int new_next = 0;

  bool isToCheck = false;

  if (need_pos < splitter_pos) {
    // Set size of all previous workareas to zero <--
    if (item_ind == nb - 1) {
      // item iz last in the splitter, it will occupy all the splitter
      new_this = splitter_size;
    } else {
      // recompute size of next items in splitter
      new_next = (splitter_size - new_this) / (nb - item_ind - 1);
    }
    delta = need_pos - splitter_pos;

  } else if (need_pos > (splitter_pos + splitter_size)) {
    // Set size of all next workareas to zero -->
    // recompute size of previous items in splitter
    new_this = 0;
    new_prev = (splitter_size - new_this) / item_ind;
    delta = need_pos - (splitter_pos + splitter_size - new_this);

  } else { // required position lays inside this splitter
    // Move workarea inside splitter into required position <->
    int new_item_rel_pos = need_pos - splitter_pos;
    new_prev = new_item_rel_pos / item_ind;
    if (need_pos < (splitter_pos + item_rel_pos)) {
      // Make previous workareas smaller, next - bigger
      // No problem to keep old size of the widget
    } else {
      // Make previous workareas bigger, next - smaller
      if (new_this > splitter_size - new_item_rel_pos) {
        new_this = splitter_size - new_item_rel_pos;
      }
      // jfa to do: in this case fixed size of next widgets could prevent right resizing
      isToCheck = true;
    }
    if (item_ind == nb - 1) {
      new_this = splitter_size - new_item_rel_pos;
    } else {
      new_next = (splitter_size - new_item_rel_pos - new_this) / (nb - item_ind - 1);
    }
    delta = 0;
  }

  setSizes (szList, item_ind, new_prev, new_this, new_next);
  return delta;
}

Here is the call graph for this function:

static void setSizes ( QIntList szList,
const int  item_ind,
const int  new_near,
const int  new_this,
const int  new_farr 
) [static]

Calculate sizes of the splitter widget for the workarea.

Definition at line 2054 of file QtxWorkstack.cxx.

{
  // set size to all items before an item # <item_ind>
  int cur_pos = 0;
  QIntList::iterator its = szList.begin();
  for (; its != szList.end() && cur_pos < item_ind; ++its, ++cur_pos) {
    *its = new_near;
  }
  if (its == szList.end()) return;
  // set size to item # <item_ind>
  *its = new_this;
  ++its;
  // set size to all items after an item # <item_ind>
  for (; its != szList.end(); ++its) {
    *its = new_farr;
  }
}

Here is the caller graph for this function: