Qt logo

qsplitter.h


This is the verbatim text of the qsplitter.h include file. It is is provided only for illustration; the copyright remains with Troll Tech.
/****************************************************************************
** $Id: qsplitter.h,v 1.11.2.1 1998/08/19 16:02:43 agulbra Exp $
**
** Defintion of  QSplitter class
**
**  Created:  980105
**
** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
**
** This file is part of Troll Tech's internal development tree for Qt.
**
** This header text will be replaced by an appropriate text by the
** mkdist script which generates external distributions.
**
** If you are using the Qt Professional Edition or the Qt Free Edition,
** please notify Troll Tech at <info@troll.no> if you see this text.
**
** To Troll Tech developers: This header was generated by the script
** fixcopyright-int. It has the same number of text lines as the free
** and professional editions to avoid line number inconsistency.
**
*****************************************************************************/
#ifndef QSPLITTER_H
#define QSPLITTER_H

#ifndef QT_H
#include "qframe.h"
#endif // QT_H

class QInternalSplitter;

class Q_EXPORT QSplitter : public QFrame
{
        Q_OBJECT
public:
    enum Orientation { Horizontal, Vertical };
    enum ResizeMode { Stretch, KeepSize };
    
    QSplitter( QWidget *parent=0, const char *name=0 );
    QSplitter( Orientation, QWidget *parent=0, const char *name=0 );

    void setOrientation( Orientation );
    Orientation orientation() const { return orient; }

    void setResizeMode( QWidget *w, ResizeMode );

    bool event( QEvent * );

    void setOpaqueResize( bool = TRUE );
    bool opaqueResize() const { return opaque; }

    void moveToFirst( QWidget * );
    void moveToLast( QWidget * );
    
    //void setHidden( QWidget *, bool );
    //bool isHidden( QWidget *) const;

    void refresh() { recalc( TRUE ); }
    
protected:
    void childInsertEvent( QChildEvent * );
    void childRemoveEvent( QChildEvent * );
    void layoutHintEvent( QEvent * );
    void resizeEvent( QResizeEvent * );

    void moveSplitter( QCOORD pos );
    virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y,
                               QCOORD w, QCOORD h );

    int adjustPos( int );
    void setRubberband( int );
    // virtual int border2()

private:
    void init();
    void recalc( bool update = FALSE );
    int hit( QPoint p );
    void doResize();
    QWidget *splitterWidget();

    void startMoving();
    void moveTo( QPoint );
    void stopMoving( );



    QCOORD pick( const QPoint &p ) const
    { return orient == Horizontal ? p.x() : p.y(); }
    QCOORD pick( const QSize &s ) const
    { return orient == Horizontal ? s.width() : s.height(); }

    QCOORD trans( const QPoint &p ) const
    { return orient == Vertical ? p.x() : p.y(); }
    QCOORD trans( const QSize &s ) const
    { return orient == Vertical ? s.width() : s.height(); }

    QCOORD newpos() const;

    QWidget *w1;
    QWidget *w2;
    int moving;
    //    bool w1show;
    //    bool w2show;
    QWidget *fixedWidget;
    QInternalSplitter *d;
    bool opaque;

    Orientation orient;
    QCOORD bord; //half border
    friend class QInternalSplitter;
};


#endif //QSPLITTER_H


Copyright © 1998 Troll TechTrademarks
Qt version 1.41