Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |
The TQFrame class is the base class of widgets that can have a frame. More...
#include <ntqframe.h>
Inherits TQWidget.
Inherited by TQGroupBox, TQScrollView, TQDockWindow, TQGrid, TQHBox, TQLabel, TQLCDNumber, TQLineEdit, TQMenuBar, TQPopupMenu, TQProgressBar, TQSplitter, TQToolBox, and TQWidgetStack.
It draws a frame and calls a virtual function, drawContents(), to fill in the frame. This function is reimplemented by subclasses. There are also two other less useful functions: drawFrame() and frameChanged().
TQPopupMenu uses this to "raise" the menu above the surrounding screen. TQProgressBar has a "sunken" look. TQLabel has a flat look. The frames of widgets like these can be changed.
TQLabel label(...); label.setFrameStyle( TQFrame::Panel | TQFrame::Raised ); label.setLineWidth( 2 ); TQProgressBar pbar(...); label.setFrameStyle( TQFrame::NoFrame );
The TQFrame class can also be used directly for creating simple frames without any contents, although usually you would use a TQHBox or TQVBox because they automatically lay out the widgets you put inside the frame.
A frame widget has four attributes: frameStyle(), lineWidth(), midLineWidth(), and margin().
The frame style is specified by a frame shape and a shadow style. The frame shapes are NoFrame, Box, Panel, StyledPanel, PopupPanel, WinPanel, ToolBarPanel, MenuBarPanel, HLine and VLine; the shadow styles are Plain, Raised and Sunken.
The line width is the width of the frame border.
The mid-line width specifies the width of an extra line in the middle of the frame, which uses a third color to obtain a special 3D effect. Notice that a mid-line is only drawn for Box, HLine and VLine frames that are raised or sunken.
The margin is the gap between the frame and the contents of the frame.
This table shows the most useful combinations of styles and widths (and some rather useless ones):
See also Abstract Widget Classes.
This enum type defines the 3D effect used for TQFrame's frame.
Shadow interacts with TQFrame::Shape, the lineWidth() and the midLineWidth(). See the picture of the frames in the class description.
See also TQFrame::Shape, lineWidth, and midLineWidth.
This enum type defines the shapes of a TQFrame's frame.
When it does not call TQStyle, Shape interacts with TQFrame::Shadow, the lineWidth() and the midLineWidth() to create the total result. See the picture of the frames in the class description.
See also TQFrame::Shadow, TQFrame::style(), and TQStyle::drawPrimitive().
The parent, name and f arguments are passed to the TQWidget constructor.
Returns the rectangle inside the frame. See the "contentsRect" property for details.
The TQPainter is already open when you get it, and you must leave it open. Painter transformations are switched off on entry. If you transform the painter, remember to take the frame into account and reset transformation before returning.
This function is reimplemented by subclasses that draw something inside the frame. It should only draw inside contentsRect(). The default function does nothing.
See also contentsRect and TQPainter::setClipRect().
Reimplemented in TQLabel, TQLCDNumber, TQMenuBar, and TQPopupMenu.
This function is virtual, but in general you do not need to reimplement it. If you do, note that the TQPainter is already open and must remain open.
See also frameRect, contentsRect, drawContents(), frameStyle(), and palette.
This function can be reimplemented by subclasses that need to know when the frame attributes change.
The default implementation calls update().
Returns the frame rectangle. See the "frameRect" property for details.
Returns the frame shadow value from the frame style. See the "frameShadow" property for details.
Returns the frame shape value from the frame style. See the "frameShape" property for details.
Returns the frame style.
The default value is TQFrame::NoFrame.
See also setFrameStyle(), frameShape, and frameShadow.
Example: scrollview/scrollview.cpp.
Returns the width of the frame that is drawn. See the "frameWidth" property for details.
Returns the line width. See the "lineWidth" property for details.
Returns the width of the margin. See the "margin" property for details.
Returns the width of the mid-line. See the "midLineWidth" property for details.
Paints the frame and the contents.
Opens the painter on the frame and calls drawFrame(), then drawContents().
Examples: life/life.cpp and qfd/fontdisplayer.cpp.
Reimplemented from TQWidget.
Adjusts the frame rectangle for the resized widget. The frame rectangle is elastic, and the surrounding area is static.
The resulting frame rectangle may be null or invalid. You can use setMinimumSize() to avoid those possibilities.
Nothing is done if the frame rectangle is a null rectangle already.
Example: life/life.cpp.
Reimplemented from TQWidget.
Sets the frame rectangle. See the "frameRect" property for details.
Sets the frame shadow value from the frame style. See the "frameShadow" property for details.
Sets the frame shape value from the frame style. See the "frameShape" property for details.
The style is the bitwise OR between a frame shape and a frame shadow style. See the illustration in the class documentation.
The frame shapes are given in TQFrame::Shape and the shadow styles in TQFrame::Shadow.
If a mid-line width greater than 0 is specified, an additional line is drawn for Raised or Sunken Box, HLine, and VLine frames. The mid-color of the current color group is used for drawing middle lines.
See also Illustration, frameStyle(), colorGroup, and TQColorGroup.
Examples: cursor/cursor.cpp, layout/layout.cpp, listboxcombo/listboxcombo.cpp, rangecontrols/rangecontrols.cpp, scrollview/scrollview.cpp, tabdialog/tabdialog.cpp, and tictac/tictac.cpp.
Sets the line width. See the "lineWidth" property for details.
Sets the width of the margin. See the "margin" property for details.
Sets the width of the mid-line. See the "midLineWidth" property for details.
This property holds the rectangle inside the frame.
Get this property's value with contentsRect().
See also frameRect and drawContents().
This property holds the frame rectangle.
The frame rectangle is the rectangle the frame is drawn in. By default, this is the entire widget. Setting this property does not cause a widget update.
If this property is set to a null rectangle (for example TQRect(0, 0, 0, 0)), then the frame rectangle is equivalent to the widget rectangle.
See also contentsRect.
Set this property's value with setFrameRect() and get this property's value with frameRect().
This property holds the frame shadow value from the frame style.
Set this property's value with setFrameShadow() and get this property's value with frameShadow().
See also frameStyle() and frameShape.
This property holds the frame shape value from the frame style.
Set this property's value with setFrameShape() and get this property's value with frameShape().
See also frameStyle() and frameShadow.
This property holds the width of the frame that is drawn.
Note that the frame width depends on the frame style, not only the line width and the mid-line width. For example, the style NoFrame always has a frame width of 0, whereas the style Panel has a frame width equivalent to the line width. The frame width also includes the margin.
See also lineWidth, midLineWidth, frameStyle(), and margin.
Get this property's value with frameWidth().
This property holds the line width.
Note that the total line width for HLine and VLine is given by frameWidth(), not lineWidth().
The default value is 1.
See also midLineWidth and frameWidth.
Set this property's value with setLineWidth() and get this property's value with lineWidth().
This property holds the width of the margin.
The margin is the distance between the innermost pixel of the frame and the outermost pixel of contentsRect(). It is included in frameWidth().
The margin is filled according to backgroundMode().
The default value is 0.
See also margin, lineWidth, and frameWidth.
Set this property's value with setMargin() and get this property's value with margin().
This property holds the width of the mid-line.
The default value is 0.
See also lineWidth and frameWidth.
Set this property's value with setMidLineWidth() and get this property's value with midLineWidth().
This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.
Copyright © 2007 Trolltech | Trademarks | TQt 3.3.8
|