Q3AccessibleTitleBar Class Reference

#include <q3complexwidgets.h>

Inheritance diagram for Q3AccessibleTitleBar:

Inheritance graph
[legend]
Collaboration diagram for Q3AccessibleTitleBar:

Collaboration graph
[legend]
List of all members.

Detailed Description

The Q3AccessibleTitleBar class implements the QAccessibleInterface for title bars.

Definition at line 48 of file q3complexwidgets.h.

Public Member Functions

 Q3AccessibleTitleBar (QWidget *w)
int childCount () const
QString text (Text t, int child) const
QRect rect (int child) const
Role role (int child) const
State state (int child) const
bool doAction (int action, int child, const QVariantList &params)

Protected Member Functions

Q3TitleBartitleBar () const


Constructor & Destructor Documentation

Q3AccessibleTitleBar::Q3AccessibleTitleBar ( QWidget w  )  [explicit]

Constructs a Q3AccessibleTitleBar object for w.

Definition at line 123 of file q3complexwidgets.cpp.

References titleBar().

00124 : QAccessibleWidget(w, TitleBar)
00125 {
00126     Q_ASSERT(titleBar());
00127 }

Here is the call graph for this function:


Member Function Documentation

int Q3AccessibleTitleBar::childCount (  )  const [virtual]

Reimplemented from QAccessibleWidget.

Definition at line 202 of file q3complexwidgets.cpp.

References titleBar().

00203 {
00204     if (!(titleBar()->windowFlags() & Qt::WStyle_SysMenu))
00205         return 0;
00206     int control = 3;
00207     if (!(titleBar()->windowFlags() & Qt::WStyle_Minimize))
00208         ++control;
00209     if (!(titleBar()->windowFlags() & Qt::WStyle_Maximize))
00210         ++control;
00211     return control;
00212 }

Here is the call graph for this function:

QString Q3AccessibleTitleBar::text ( Text  t,
int  child 
) const [virtual]

Reimplemented from QAccessibleWidget.

Definition at line 215 of file q3complexwidgets.cpp.

References QAccessible::Description, QWidget::isMaximized(), QWidget::isMinimized(), QAccessible::Name, QString::size(), QAccessibleWidget::text(), titleBar(), QAccessible::Value, Q3TitleBar::window(), and QWidget::windowTitle().

00216 {
00217     QString str = QAccessibleWidget::text(t, child);
00218     if (str.size())
00219         return str;
00220 
00221     QWidget *window = titleBar()->window();
00222     switch (t) {
00223     case Name:
00224         switch (child) {
00225         case 1:
00226             return Q3TitleBar::tr("System");
00227         case 3:
00228             if (window && window->isMinimized())
00229                 return Q3TitleBar::tr("Restore up");
00230             return Q3TitleBar::tr("Minimize");
00231         case 4:
00232             if (window && window->isMaximized())
00233                 return Q3TitleBar::tr("Restore down");
00234             return Q3TitleBar::tr("Maximize");
00235         case 5:
00236             return Q3TitleBar::tr("Close");
00237         default:
00238             break;
00239         }
00240         break;
00241     case Value:
00242         if (!child || child == 2)
00243             return window ? window->windowTitle() : QString();
00244         break;
00245 /*
00246     case DefaultAction:
00247         if (child > 2)
00248             return Q3TitleBar::tr("Press");
00249         break;
00250 */
00251     case Description:
00252         switch (child) {
00253         case 1:
00254             return Q3TitleBar::tr("Contains commands to manipulate the window");
00255         case 3:
00256             if (window && window->isMinimized())
00257                 return Q3TitleBar::tr("Puts a minimized back to normal");
00258             return Q3TitleBar::tr("Moves the window out of the way");
00259         case 4:
00260             if (window && window->isMaximized())
00261                 return Q3TitleBar::tr("Puts a maximized window back to normal");
00262             return Q3TitleBar::tr("Makes the window full screen");
00263         case 5:
00264             return Q3TitleBar::tr("Closes the window");
00265         default:
00266             return Q3TitleBar::tr("Displays the name of the window and contains controls to manipulate it");
00267         }
00268     default:
00269         break;
00270     }
00271     return str;
00272 }

Here is the call graph for this function:

QRect Q3AccessibleTitleBar::rect ( int  child  )  const [virtual]

Reimplemented from QAccessibleWidget.

Definition at line 138 of file q3complexwidgets.cpp.

References QStyle::CC_TitleBar, QRect::height(), QWidget::mapToGlobal(), QAccessibleWidget::rect(), QStyle::SC_None, QStyle::SC_TitleBarCloseButton, QStyle::SC_TitleBarLabel, QStyle::SC_TitleBarMaxButton, QStyle::SC_TitleBarMinButton, QStyle::SC_TitleBarSysMenu, QWidget::style(), QStyle::subControlRect(), titleBar(), tp, QRect::width(), QRect::x(), and QRect::y().

00139 {
00140     if (!child)
00141         return QAccessibleWidget::rect(child);
00142 
00143     QStyle::SubControl sc;
00144     switch (child) {
00145     case 1:
00146         sc = QStyle::SC_TitleBarSysMenu;
00147         break;
00148     case 2:
00149         sc = QStyle::SC_TitleBarLabel;
00150         break;
00151     case 3:
00152         sc = QStyle::SC_TitleBarMinButton;
00153         break;
00154     case 4:
00155         sc = QStyle::SC_TitleBarMaxButton;
00156         break;
00157     case 5:
00158         sc = QStyle::SC_TitleBarCloseButton;
00159         break;
00160     default:
00161         sc = QStyle::SC_None;
00162         break;
00163     }
00164 
00165     QRect r;
00166     if (sc != QStyle::SC_None) {
00167         QStyleOptionTitleBar option;
00168         r = titleBar()->style()->subControlRect(QStyle::CC_TitleBar, &option, sc, titleBar());
00169     }
00170 
00171     QPoint tp = titleBar()->mapToGlobal(QPoint(0,0));
00172     return QRect(tp.x() + r.x(), tp.y() + r.y(), r.width(), r.height());
00173 }

Here is the call graph for this function:

QAccessible::Role Q3AccessibleTitleBar::role ( int  child  )  const [virtual]

Reimplemented from QAccessibleWidget.

Definition at line 275 of file q3complexwidgets.cpp.

References QAccessible::PushButton, and QAccessible::TitleBar.

00276 {
00277     switch (child)
00278     {
00279     case 1:
00280     case 3:
00281     case 4:
00282     case 5:
00283         return PushButton;
00284     default:
00285         return TitleBar;
00286     }
00287 }

QAccessible::State Q3AccessibleTitleBar::state ( int  child  )  const [virtual]

Reimplemented from QAccessibleWidget.

Definition at line 290 of file q3complexwidgets.cpp.

References QAccessibleWidget::state().

00291 {
00292     return QAccessibleWidget::state(child);
00293 }

Here is the call graph for this function:

bool Q3AccessibleTitleBar::doAction ( int  action,
int  child,
const QVariantList params 
) [virtual]

Reimplemented from QAccessibleWidget.

Definition at line 296 of file q3complexwidgets.cpp.

References QWidget::close(), QWidget::showMaximized(), QWidget::showMinimized(), QWidget::showNormal(), titleBar(), and Q3TitleBar::window().

00297 {
00298     switch (child) {
00299     case 3:
00300         if (titleBar()->window()->isMinimized())
00301             titleBar()->window()->showNormal();
00302         else
00303             titleBar()->window()->showMinimized();
00304         return true;
00305     case 4:
00306         if (titleBar()->window()->isMaximized())
00307             titleBar()->window()->showNormal();
00308         else
00309             titleBar()->window()->showMaximized();
00310         return true;
00311     case 5:
00312         titleBar()->window()->close();
00313         return true;
00314     default:
00315         break;
00316     }
00317     return false;
00318 }

Here is the call graph for this function:

Q3TitleBar * Q3AccessibleTitleBar::titleBar (  )  const [protected]

Returns the title bar.

Definition at line 132 of file q3complexwidgets.cpp.

References QAccessibleObject::object().

Referenced by childCount(), doAction(), Q3AccessibleTitleBar(), rect(), and text().

00133 {
00134     return qobject_cast<Q3TitleBar*>(object());
00135 }

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 15:39:59 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1