OpendTect-6_4  6.4
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
uiListBox Class Reference

List Box. More...

Inheritance diagram for uiListBox:
[legend]

Classes

class  Setup
 

Public Types

enum  LblPos {
  LeftTop, RightTop, LeftMid, RightMid,
  AboveLeft, AboveMid, AboveRight, BelowLeft,
  BelowMid, BelowRight
}
 

Public Member Functions

 uiListBox (uiParent *, const char *nm=0, OD::ChoiceMode cm=OD::ChooseOnlyOne)
 
 uiListBox (uiParent *, const Setup &, const char *nm=0)
 
virtual ~uiListBox ()
 
uiListBoxObj * box ()
 
uiGroupcheckGroup ()
 
uiCheckBoxmasterCheckBox ()
 
int nrLabels () const
 
uiLabellabel (int nr=0)
 
void setLabelText (const uiString &, int nr=0)
 
OD::ChoiceMode choiceMode () const
 
bool isMultiChoice () const
 
void setChoiceMode (OD::ChoiceMode)
 
void setMultiChoice (bool yn=true)
 
void setAllowNoneChosen (bool)
 
void setNotSelectable ()
 
int size () const
 
bool isEmpty () const
 
bool validIdx (int) const
 
bool isPresent (const char *) const
 
int maxNrOfChoices () const
 
Alignment::HPos alignment () const
 
void setAlignment (Alignment::HPos)
 
void setNrLines (int)
 
void setFieldWidth (int)
 
void setHSzPol (uiObject::SzPolicy)
 
void setVSzPol (uiObject::SzPolicy)
 
void setEmpty ()
 
void removeItem (int)
 
void removeItem (const char *)
 
void removeItem (const FixedString &fs)
 
void setAllowDuplicates (bool yn)
 
void addItem (const uiString &, bool marked=false, int id=-1)
 
void addItem (const uiString &, const uiPixmap &, int id=-1)
 
void addItem (const uiString &, const Color &, int id=-1)
 
void addItems (const char **)
 
void addItems (const BufferStringSet &)
 
void addItems (const uiStringSet &)
 
void insertItem (const uiString &, int idx=-1, bool marked=false, int id=-1)
 
void insertItem (const uiString &, const uiPixmap &, int idx=-1, int id=-1)
 
void insertItem (const uiString &, const Color &, int idx=-1, int id=-1)
 
void setPixmap (int, const Color &)
 
void setPixmap (int, const uiPixmap &)
 
void setIcon (int, const char *icon_identifier)
 
void setColor (int, const Color &)
 
Color getColor (int) const
 
void sortItems (bool asc=true)
 
int indexOf (const char *) const
 First match. More...
 
const char * textOfItem (int) const
 
void setItemText (int, const uiString &)
 
void getItems (BufferStringSet &) const
 
int currentItem () const
 
const char * getText () const
 
void setCurrentItem (int)
 
void setCurrentItem (const char *)
 First match. More...
 
void setCurrentItem (const FixedString &fs)
 
void setItemSelectable (int, bool)
 
int nrChosen () const
 
bool isChoosable (int) const
 
bool isChosen (int) const
 
int firstChosen () const
 
int nextChosen (int prev=-1) const
 
void getChosen (BufferStringSet &) const
 
void getChosen (TypeSet< int > &) const
 
void setChoosable (int, bool yn)
 
void setChosen (int, bool yn=true)
 
void setChosen (Interval< int >, bool yn=true)
 
void chooseAll (bool yn=true)
 
void setChosen (const BufferStringSet &)
 
void setChosen (const TypeSet< int > &)
 
bool isMarked (int) const
 
void setMarked (int, bool)
 
void setItemID (int idx, int id)
 
int currentItemID () const
 
int getItemID (int idx) const
 
int getItemIdx (int id) const
 First match. More...
 
void scrollToTop ()
 
void scrollToBottom ()
 
bool handleLongTabletPress ()
 
void disableRightClick (bool yn)
 
void blockScrolling (bool yn)
 
void offerReadWriteSelection (const CallBack &rcb, const CallBack &wcb)
 
bool isItemChecked (int) const
 To be called by CmdDriver only, not for casual use. More...
 
 uiListBox (uiParent *, const BufferStringSet &, const char *nm=0)
 
 uiListBox (uiParent *, const BufferStringSet &, const char *nm, OD::ChoiceMode cm, int prefNrLines=0, int prefFieldWidth=0)
 
 uiListBox (uiParent *, const uiStringSet &, const char *nm, OD::ChoiceMode cm, int prefNrLines=0, int prefFieldWidth=0)
 
- Public Member Functions inherited from uiGroup
 uiGroup (uiParent *, const char *nm="uiGroup", bool manage=true)
 
virtual ~uiGroup ()
 
 operator const uiGroupObj * () const
 
 operator uiGroupObj * ()
 
 operator const uiObject & () const
 
 operator uiObject & ()
 
uiObjectattachObj ()
 
const uiObjectattachObj () const
 
uiParentparent ()
 
const uiParentparent () const
 
void setHSpacing (int)
 
void setVSpacing (int)
 
void setSpacing (int s=0)
 
void setBorder (int)
 
void setFrame (bool yn=true)
 
void setNoBackGround ()
 
uiObjecthAlignObj ()
 
void setHAlignObj (uiObject *o)
 
void setHAlignObj (uiGroup *o)
 
uiObjecthCenterObj ()
 
void setHCenterObj (uiObject *o)
 
void setHCenterObj (uiGroup *o)
 
void setIsMain (bool)
 internal use only. Tells the layout manager it's a toplevel mngr. More...
 
virtual uiMainWinmainwin ()
 
void setChildrenSensitive (bool)
 
virtual Notifier< uiBaseObject > & preFinalise ()
 
virtual Notifier< uiBaseObject > & postFinalise ()
 
virtual void setSize (const uiSize &)
 
- Public Member Functions inherited from uiParent
 uiParent (const char *nm, uiParentBody *)
 
void addChild (uiBaseObject &)
 
void manageChld (uiBaseObject &, uiObjectBody &)
 
void attachChild (constraintType tp, uiObject *child, uiObject *other, int margin, bool reciprocal)
 
const ObjectSet< uiBaseObject > * childList () const
 
uiObjectmainObject ()
 
const uiObjectmainObject () const
 
uiParentBodypbody ()
 
const uiParentBodypbody () const
 
void attach (constraintType t, int margin=-1)
 
void attach (constraintType t, uiParent *oth, int margin=-1, bool reciprocal=true)
 
void attach (constraintType t, uiObject *oth, int margin=-1, bool reciprocal=true)
 
virtual void display (bool yn, bool shrk=false, bool maximize=false)
 
bool isDisplayed () const
 
void setFocus ()
 
bool hasFocus () const
 
void setSensitive (bool yn=true)
 
bool sensitive () const
 
const uiFontfont () const
 
void setFont (const uiFont &f)
 
void setCaption (const uiString &c)
 
void setCursor (const MouseCursor &c)
 
uiSize actualsize (bool include_border) const
 
int prefHNrPics () const
 
int prefVNrPics () const
 
void setPrefHeight (int h)
 
void setPrefWidth (int w)
 
void setPrefHeightInChar (int h)
 
void setPrefHeightInChar (float h)
 
void setPrefWidthInChar (float w)
 
void setPrefWidthInChar (int w)
 
virtual void reDraw (bool deep)
 
void shallowRedraw (CallBacker *=0)
 
void deepRedraw (CallBacker *=0)
 
void setStretch (int h, int v)
 
Color backgroundColor () const
 
Color roBackgroundColor () const
 
void setBackgroundColor (const Color &c)
 
void translateText ()
 

Public Attributes

Notifier< uiListBoxselectionChanged
 
CNotifier< uiListBox, int > itemChosen
 
Notifier< uiListBoxdoubleClicked
 
Notifier< uiListBoxrightButtonClicked
 
Notifier< uiListBoxleftButtonClicked
 
Notifier< uiListBoxdeleteButtonPressed
 

Protected Member Functions

void mkLabel (const uiString &, LblPos)
 
void mkCheckGroup ()
 
void checkCB (CallBacker *)
 
void updateCheckState ()
 
void addItemNoUpdate (const uiString &, bool marked=false, int id=-1)
 
- Protected Member Functions inherited from uiGroup
virtual uiObjectmainobject ()
 
virtual void attach_ (constraintType, uiObject *oth, int margin=-1, bool reciprocal=true)
 
virtual void reDraw_ (bool deep)
 
void setShrinkAllowed (bool)
 
bool shrinkAllowed ()
 
void bodyDel (CallBacker *)
 
void uiobjDel (CallBacker *)
 
void setFrameStyle (int)
 
void reSizeChildren (const uiObject *, float, float)
 

Protected Attributes

uiListBoxObj * lb_
 
ObjectSet< uiLabellbls_
 
uiGroupcheckgrp_
 
uiCheckBoxcb_
 
- Protected Attributes inherited from uiGroup
uiGroupObjgrpobj_
 
uiGroupParentBodybody_
 

Private Member Functions

 mODTextTranslationClass (uiListBox) friend class i_listMessenger
 
void translateText ()
 
void menuCB (CallBacker *)
 
void handleCheckChange (mQtclass(QListWidgetItem *))
 
void usrChooseAll (bool yn=true)
 
bool isNone () const
 
int optimumFieldWidth (int minwdth=20, int maxwdth=40) const
 
void updateFields2ChoiceMode ()
 
void initNewItem (int)
 
void setItemCheckable (int, bool)
 
void setItemsCheckable (bool yn)
 
void setAllItemsChecked (bool)
 
void setItemChecked (int, bool)
 
void setItemChecked (const char *, bool)
 
bool isItemChecked (const char *) const
 
int nrChecked () const
 
void setCheckedItems (const BufferStringSet &)
 
void setCheckedItems (const TypeSet< int > &)
 
void getCheckedItems (BufferStringSet &) const
 
void getCheckedItems (TypeSet< int > &) const
 

Static Private Member Functions

static int cDefNrLines ()
 == 7 More...
 

Private Attributes

OD::ChoiceMode choicemode_
 
Alignment::HPos alignment_
 
bool allowduplicates_
 
uiMenurightclickmnu_
 
BufferString rettxt_
 
OD::ButtonState buttonstate_
 
CallBack savecb_
 
CallBack retrievecb_
 
bool scrollingblocked_
 

Friends

class uiListBoxBody
 

Additional Inherited Members

- Static Public Member Functions inherited from uiGroup
static uiGroupgtDynamicCastToGrp (mQtclass(QWidget *))
 

Detailed Description

List Box.

The size of the box is determined automatically (prefNrLines=0) but can be overruled by setNrLines().

If the user can select multiple items, then there is a difference between selected and current item. In the old (Windows) style, you got something that resembles having many current items. Two main problems make us want to phase out this style: The fact that the user can in fact choose multiple items is visually hidden, In many styles you don't know what the current item is after selecting blocks Especially the first problem is a big thing.

New style multi-select works with a check boxes in front of each item. This delivers a challenge because what if the current item is not checked?

This is the basis for the 'chosen' concept, which works in both single- and multi-selection modes. In multi-selection, an item is chosen if it is checked. If no box is checked, then you can have the listbox report the current item as the chosen item. To switch this off, tell the listbox that no chosen is a valid thing, i.e. pick the ZeroOrMore mode.

Lastly, you can have some of the items marked. This will be done by surrounding the item with curly braces, like: '{the item}'. This will not affect selection/checked/chosen status.

Member Enumeration Documentation

Enumerator
LeftTop 
RightTop 
LeftMid 
RightMid 
AboveLeft 
AboveMid 
AboveRight 
BelowLeft 
BelowMid 
BelowRight 

Constructor & Destructor Documentation

uiListBox::uiListBox ( uiParent ,
const char *  nm = 0,
OD::ChoiceMode  cm = OD::ChooseOnlyOne 
)
uiListBox::uiListBox ( uiParent ,
const Setup ,
const char *  nm = 0 
)
virtual uiListBox::~uiListBox ( )
virtual
uiListBox::uiListBox ( uiParent ,
const BufferStringSet ,
const char *  nm = 0 
)
uiListBox::uiListBox ( uiParent ,
const BufferStringSet ,
const char *  nm,
OD::ChoiceMode  cm,
int  prefNrLines = 0,
int  prefFieldWidth = 0 
)
uiListBox::uiListBox ( uiParent ,
const uiStringSet ,
const char *  nm,
OD::ChoiceMode  cm,
int  prefNrLines = 0,
int  prefFieldWidth = 0 
)

Member Function Documentation

void uiListBox::addItem ( const uiString ,
bool  marked = false,
int  id = -1 
)
void uiListBox::addItem ( const uiString ,
const uiPixmap ,
int  id = -1 
)
void uiListBox::addItem ( const uiString ,
const Color ,
int  id = -1 
)
void uiListBox::addItemNoUpdate ( const uiString ,
bool  marked = false,
int  id = -1 
)
protected
void uiListBox::addItems ( const char **  )
void uiListBox::addItems ( const BufferStringSet )
void uiListBox::addItems ( const uiStringSet )
Alignment::HPos uiListBox::alignment ( ) const
inline
void uiListBox::blockScrolling ( bool  yn)
inline
uiListBoxObj* uiListBox::box ( )
inline
static int uiListBox::cDefNrLines ( )
staticprivate

== 7

void uiListBox::checkCB ( CallBacker )
protected
uiGroup* uiListBox::checkGroup ( )
inline
OD::ChoiceMode uiListBox::choiceMode ( ) const
inline
void uiListBox::chooseAll ( bool  yn = true)
int uiListBox::currentItem ( ) const
int uiListBox::currentItemID ( ) const
void uiListBox::disableRightClick ( bool  yn)
int uiListBox::firstChosen ( ) const
void uiListBox::getCheckedItems ( BufferStringSet ) const
private
void uiListBox::getCheckedItems ( TypeSet< int > &  ) const
private
void uiListBox::getChosen ( BufferStringSet ) const
void uiListBox::getChosen ( TypeSet< int > &  ) const
Color uiListBox::getColor ( int  ) const
int uiListBox::getItemID ( int  idx) const
int uiListBox::getItemIdx ( int  id) const

First match.

void uiListBox::getItems ( BufferStringSet ) const
const char* uiListBox::getText ( ) const
inline
void uiListBox::handleCheckChange ( mQtclass(QListWidgetItem *)  )
private
bool uiListBox::handleLongTabletPress ( )
int uiListBox::indexOf ( const char *  ) const

First match.

void uiListBox::initNewItem ( int  )
private
void uiListBox::insertItem ( const uiString ,
int  idx = -1,
bool  marked = false,
int  id = -1 
)
void uiListBox::insertItem ( const uiString ,
const uiPixmap ,
int  idx = -1,
int  id = -1 
)
void uiListBox::insertItem ( const uiString ,
const Color ,
int  idx = -1,
int  id = -1 
)
bool uiListBox::isChoosable ( int  ) const
bool uiListBox::isChosen ( int  ) const
bool uiListBox::isEmpty ( ) const
inline
bool uiListBox::isItemChecked ( const char *  ) const
private
bool uiListBox::isItemChecked ( int  ) const

To be called by CmdDriver only, not for casual use.

bool uiListBox::isMarked ( int  ) const
bool uiListBox::isMultiChoice ( ) const
inline
bool uiListBox::isNone ( ) const
inlineprivate
bool uiListBox::isPresent ( const char *  ) const
uiLabel* uiListBox::label ( int  nr = 0)
inline
uiCheckBox* uiListBox::masterCheckBox ( )
inline
int uiListBox::maxNrOfChoices ( ) const
void uiListBox::menuCB ( CallBacker )
private
void uiListBox::mkCheckGroup ( )
protected
void uiListBox::mkLabel ( const uiString ,
LblPos   
)
protected
uiListBox::mODTextTranslationClass ( uiListBox  )
private
int uiListBox::nextChosen ( int  prev = -1) const
int uiListBox::nrChecked ( ) const
private
int uiListBox::nrChosen ( ) const
int uiListBox::nrLabels ( ) const
inline
void uiListBox::offerReadWriteSelection ( const CallBack rcb,
const CallBack wcb 
)
inline
int uiListBox::optimumFieldWidth ( int  minwdth = 20,
int  maxwdth = 40 
) const
private
void uiListBox::removeItem ( int  )
void uiListBox::removeItem ( const char *  )
void uiListBox::removeItem ( const FixedString fs)
inline
void uiListBox::scrollToBottom ( )
void uiListBox::scrollToTop ( )
void uiListBox::setAlignment ( Alignment::HPos  )
void uiListBox::setAllItemsChecked ( bool  )
private
void uiListBox::setAllowDuplicates ( bool  yn)
void uiListBox::setAllowNoneChosen ( bool  )
void uiListBox::setCheckedItems ( const BufferStringSet )
private
void uiListBox::setCheckedItems ( const TypeSet< int > &  )
private
void uiListBox::setChoiceMode ( OD::ChoiceMode  )
void uiListBox::setChoosable ( int  ,
bool  yn 
)
void uiListBox::setChosen ( int  ,
bool  yn = true 
)
void uiListBox::setChosen ( Interval< int >  ,
bool  yn = true 
)
void uiListBox::setChosen ( const BufferStringSet )
void uiListBox::setChosen ( const TypeSet< int > &  )
void uiListBox::setColor ( int  ,
const Color  
)
void uiListBox::setCurrentItem ( int  )
void uiListBox::setCurrentItem ( const char *  )

First match.

void uiListBox::setCurrentItem ( const FixedString fs)
inline
void uiListBox::setEmpty ( )
void uiListBox::setFieldWidth ( int  )
void uiListBox::setHSzPol ( uiObject::SzPolicy  )
void uiListBox::setIcon ( int  ,
const char *  icon_identifier 
)
void uiListBox::setItemCheckable ( int  ,
bool   
)
private
void uiListBox::setItemChecked ( int  ,
bool   
)
private
void uiListBox::setItemChecked ( const char *  ,
bool   
)
private
void uiListBox::setItemID ( int  idx,
int  id 
)
void uiListBox::setItemsCheckable ( bool  yn)
inlineprivate
void uiListBox::setItemSelectable ( int  ,
bool   
)
void uiListBox::setItemText ( int  ,
const uiString  
)
void uiListBox::setLabelText ( const uiString ,
int  nr = 0 
)
void uiListBox::setMarked ( int  ,
bool   
)
void uiListBox::setMultiChoice ( bool  yn = true)
void uiListBox::setNotSelectable ( )
void uiListBox::setNrLines ( int  )
void uiListBox::setPixmap ( int  ,
const Color  
)
void uiListBox::setPixmap ( int  ,
const uiPixmap  
)
void uiListBox::setVSzPol ( uiObject::SzPolicy  )
int uiListBox::size ( ) const
void uiListBox::sortItems ( bool  asc = true)
const char* uiListBox::textOfItem ( int  ) const
void uiListBox::translateText ( )
private
void uiListBox::updateCheckState ( )
protected
void uiListBox::updateFields2ChoiceMode ( )
private
void uiListBox::usrChooseAll ( bool  yn = true)
private
bool uiListBox::validIdx ( int  ) const

Friends And Related Function Documentation

friend class uiListBoxBody
friend

Member Data Documentation

Alignment::HPos uiListBox::alignment_
private
bool uiListBox::allowduplicates_
private
OD::ButtonState uiListBox::buttonstate_
private
uiCheckBox* uiListBox::cb_
protected
uiGroup* uiListBox::checkgrp_
protected
OD::ChoiceMode uiListBox::choicemode_
private
Notifier<uiListBox> uiListBox::deleteButtonPressed
Notifier<uiListBox> uiListBox::doubleClicked
CNotifier<uiListBox,int> uiListBox::itemChosen
uiListBoxObj* uiListBox::lb_
protected
ObjectSet<uiLabel> uiListBox::lbls_
protected
Notifier<uiListBox> uiListBox::leftButtonClicked
CallBack uiListBox::retrievecb_
private
BufferString uiListBox::rettxt_
mutableprivate
Notifier<uiListBox> uiListBox::rightButtonClicked
uiMenu& uiListBox::rightclickmnu_
private
CallBack uiListBox::savecb_
private
bool uiListBox::scrollingblocked_
private
Notifier<uiListBox> uiListBox::selectionChanged

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019