diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 15:17:53 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 15:17:53 -0500 |
commit | dda8474928bd7276e1fad8fb7a601e7c83ff2bc2 (patch) | |
tree | 7f83910598b33b12730035f086df20b5a53ab99c /tqtinterface/qt4/plugins | |
parent | 6260b6178868c03aab1644bf93b0ef043654bdb0 (diff) | |
download | experimental-dda8474928bd7276e1fad8fb7a601e7c83ff2bc2.tar.gz experimental-dda8474928bd7276e1fad8fb7a601e7c83ff2bc2.zip |
Added TQt4 HEAD
Diffstat (limited to 'tqtinterface/qt4/plugins')
55 files changed, 5661 insertions, 0 deletions
diff --git a/tqtinterface/qt4/plugins/src/accessible/accessible.pro b/tqtinterface/qt4/plugins/src/accessible/accessible.pro new file mode 100644 index 0000000..c3f4913 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/accessible/accessible.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs + +accessibility { + SUBDIRS += widgets +} diff --git a/tqtinterface/qt4/plugins/src/accessible/widgets/main.cpp b/tqtinterface/qt4/plugins/src/accessible/widgets/main.cpp new file mode 100644 index 0000000..450bfed --- /dev/null +++ b/tqtinterface/qt4/plugins/src/accessible/widgets/main.cpp @@ -0,0 +1,226 @@ +#include "tqaccessiblewidget.h" +#include "tqaccessiblemenu.h" + +#include <tqtoolbutton.h> +#include <tqtoolbar.h> +#include <tqvariant.h> + +class AccessibleFactory : public TQAccessibleFactoryInterface, public TQLibraryInterface +{ +public: + AccessibleFactory(); + + TQRESULT queryInterface( const TQUuid &, TQUnknownInterface **iface ); + TQ_REFCOUNT + + TQStringList featureList() const; + TQRESULT createAccessibleInterface( const TQString &classname, TQObject *object, TQAccessibleInterface **iface ); + + bool init(); + void cleanup(); + bool canUnload() const; +}; + +AccessibleFactory::AccessibleFactory() +{ +} + +TQRESULT AccessibleFactory::queryInterface( const TQUuid &iid, TQUnknownInterface **iface ) +{ + *iface = 0; + if ( iid == IID_TQUnknown ) + *iface = (TQUnknownInterface*)(TQFeatureListInterface*)(TQAccessibleFactoryInterface*)this; + else if ( iid == IID_TQFeatureList ) + *iface = (TQFeatureListInterface*)this; + else if ( iid == IID_TQAccessibleFactory ) + *iface = (TQAccessibleFactoryInterface*)this; + else if ( iid == IID_TQLibrary ) + *iface = (TQLibraryInterface*)this; + else + return TQE_NOINTERFACE; + + (*iface)->addRef(); + return TQS_OK; +} + +TQStringList AccessibleFactory::featureList() const +{ + TQStringList list; + list << "TQLineEdit"; + list << "TQComboBox"; + list << "TQSpinBox"; + list << "TQSpinWidget"; + list << "TQDial"; + list << "TQScrollBar"; + list << "TQSlider"; + list << "TQToolButton"; + list << "TQCheckBox"; + list << "TQRadioButton"; + list << "TQButton"; + list << "TQViewportWidget"; + list << "TQClipperWidget"; + list << "TQTextEdit"; +#ifndef TQT_NO_ICONVIEW + list << "TQIconView"; +#endif + list << "TQListView"; + list << "TQListBox"; + list << "TQTable"; + list << "TQDialog"; + list << "TQMessageBox"; + list << "TQMainWindow"; + list << "TQLabel"; + list << "TQGroupBox"; + list << "TQStatusBar"; + list << "TQProgressBar"; + list << "TQToolBar"; + list << "TQMenuBar"; + list << "TQPopupMenu"; + list << "TQHeader"; + list << "TQTabBar"; + list << "TQTitleBar"; + list << "TQWorkspaceChild"; + list << "TQSizeGrip"; + list << "TQSplitterHandle"; + list << "TQToolBarSeparator"; + list << "TQDockWindowHandle"; + list << "TQDockWindowResizeHandle"; + list << "TQTipLabel"; + list << "TQFrame"; + list << "TQWidgetStack"; + list << "TQWidget"; + list << "TQScrollView"; + + return list; +} + +TQRESULT AccessibleFactory::createAccessibleInterface( const TQString &classname, TQObject *object, TQAccessibleInterface **iface ) +{ + *iface = 0; + + if ( classname == "TQLineEdit" ) { + *iface = new TQAccessibleText( object, EditableText ); + } else if ( classname == "TQComboBox" ) { + *iface = new TQAccessibleComboBox( object ); + } else if ( classname == "TQSpinBox" ) { + *iface = new TQAccessibleRangeControl( object, SpinBox ); + } else if ( classname == "TQSpinWidget" ) { + *iface = new TQAccessibleSpinWidget( object ); + } else if ( classname == "TQDial" ) { + *iface = new TQAccessibleRangeControl( object, Dial ); + } else if ( classname == "TQScrollBar" ) { + *iface = new TQAccessibleScrollBar( object ); + } else if ( classname == "TQSlider" ) { + *iface = new TQAccessibleSlider( object ); + } else if ( classname == "TQToolButton" ) { + TQToolButton *tb = (TQToolButton*)object; + if ( !tb->popup() ) + *iface = new TQAccessibleButton( object, PushButton ); + else if ( !tb->popupDelay() ) + *iface = new TQAccessibleButton( object, ButtonDropDown ); + else + *iface = new TQAccessibleButton( object, ButtonMenu ); + } else if ( classname == "TQCheckBox" ) { + *iface = new TQAccessibleButton( object, CheckBox ); + } else if ( classname == "TQRadioButton" ) { + *iface = new TQAccessibleButton( object, RadioButton ); + } else if ( classname == "TQButton" ) { + *iface = new TQAccessibleButton( object, PushButton ); + } else if ( classname == "TQViewportWidget" ) { + *iface = new TQAccessibleViewport( object, object->tqparent() ); + } else if ( classname == "TQClipperWidget" ) { + *iface = new TQAccessibleViewport( object, object->tqparent()->tqparent() ); + } else if ( classname == "TQTextEdit" ) { + *iface = new TQAccessibleTextEdit( object ); +#ifndef TQT_NO_ICONVIEW + } else if ( classname == "TQIconView" ) { + *iface = new TQAccessibleIconView( object ); +#endif + } else if ( classname == "TQListView" ) { + *iface = new TQAccessibleListView( object ); + } else if ( classname == "TQListBox" ) { + *iface = new TQAccessibleListBox( object ); + } else if ( classname == "TQTable" ) { + *iface = new TQAccessibleScrollView( object, Table ); + } else if ( classname == "TQDialog" ) { + *iface = new TQAccessibleWidget( object, Dialog ); + } else if ( classname == "TQMessageBox" ) { + *iface = new TQAccessibleWidget( object, AlertMessage ); + } else if ( classname == "TQMainWindow" ) { + *iface = new TQAccessibleWidget( object, Application ); + } else if ( classname == "TQLabel" || classname == "TQLCDNumber" ) { + *iface = new TQAccessibleDisplay( object, StaticText ); + } else if ( classname == "TQGroupBox" ) { + *iface = new TQAccessibleDisplay( object, Grouping ); + } else if ( classname == "TQStatusBar" ) { + *iface = new TQAccessibleWidget( object, tqStatusBar ); + } else if ( classname == "TQProgressBar" ) { + *iface = new TQAccessibleRangeControl( object, ProgressBar ); + } else if ( classname == "TQToolBar" ) { + TQToolBar *tb = (TQToolBar*)object; + *iface = new TQAccessibleWidget( object, ToolBar, tb->label() ); + } else if ( classname == "TQMenuBar" ) { + *iface = new TQAccessibleMenuBar( object ); + } else if ( classname == "TQPopupMenu" ) { + *iface = new TQAccessiblePopup( object ); + } else if ( classname == "TQHeader" ) { + *iface = new TQAccessibleHeader( object ); + } else if ( classname == "TQTabBar" ) { + *iface = new TQAccessibleTabBar( object ); + } else if ( classname == "TQTitleBar" ) { + *iface = new TQAccessibleTitleBar( object ); + } else if ( classname == "TQWorkspaceChild" ) { + *iface = new TQAccessibleWidget( object, Window ); + } else if ( classname == "TQSizeGrip" ) { + *iface = new TQAccessibleWidget( object, Grip ); + } else if ( classname == "TQSplitterHandle" ) { + *iface = new TQAccessibleWidget( object, Separator, TQString::null, + TQString::null, TQString::null, TQString::null, + TQString::null, TQString::null, TQAccessible::Moveable ); + } else if ( classname == "TQToolBarSeparator" ) { + *iface = new TQAccessibleWidget( object, TQAccessible::Separator, TQString::null, + TQString::null, TQString::null, TQString::null, + TQString::null, TQString::null, TQAccessible::Unavailable ); + } else if ( classname == "TQDockWindowHandle" ) { + *iface = new TQAccessibleWidget( object, TQAccessible::Grip, object->property( "caption" ).toString(), + TQString::null, TQString::null, TQString::null, + TQString::null, TQString::null, TQAccessible::Moveable ); + } else if ( classname == "TQDockWindowResizeHandle" ) { + *iface = new TQAccessibleWidget( object, TQAccessible::Separator, TQString::null, + TQString::null, TQString::null, TQString::null, + TQString::null, TQString::null, TQAccessible::Moveable ); + } else if ( classname == "TQTipLabel" ) { + *iface = new TQAccessibleWidget( object, ToolTip ); + } else if ( classname == "TQFrame" ) { + *iface = new TQAccessibleWidget( object, Border ); + } else if ( classname == "TQWidgetStack" ) { + *iface = new TQAccessibleWidgetStack( object ); + } else if ( classname == "TQWidget" ) { + *iface = new TQAccessibleWidget( object ); + } else if ( classname == "TQScrollView" ) { + *iface = new TQAccessibleScrollView( object, Client ); + } else + return TQE_NOINTERFACE; + + (*iface)->addRef(); + return TQS_OK; +} + +bool AccessibleFactory::init() +{ + return TRUE; +} + +void AccessibleFactory::cleanup() +{ +} + +bool AccessibleFactory::canUnload() const +{ + return (TQAccessibleWidget::objects == 0); +} + +TQ_EXPORT_COMPONENT() +{ + TQ_CREATE_INSTANCE( AccessibleFactory ) +} diff --git a/tqtinterface/qt4/plugins/src/accessible/widgets/qaccessiblemenu.cpp b/tqtinterface/qt4/plugins/src/accessible/widgets/qaccessiblemenu.cpp new file mode 100644 index 0000000..21a99b1 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/accessible/widgets/qaccessiblemenu.cpp @@ -0,0 +1,323 @@ +#include "tqaccessiblemenu.h" + +#include <tqpopupmenu.h> +#include <tqmenubar.h> +#include <tqstyle.h> + +class MyPopupMenu : public TQPopupMenu +{ + friend class TQAccessiblePopup; +}; + +TQAccessiblePopup::TQAccessiblePopup( TQObject *o ) +: TQAccessibleWidget( o ) +{ + TQ_ASSERT( o->inherits("TQPopupMenu") ); +} + +TQPopupMenu *TQAccessiblePopup::popupMenu() const +{ + return (TQPopupMenu*)object(); +} + +int TQAccessiblePopup::childCount() const +{ + return popupMenu()->count(); +} + +TQRESULT TQAccessiblePopup::queryChild( int /*control*/, TQAccessibleInterface **iface ) const +{ + *iface = 0; + return TQS_FALSE; +} + +TQRect TQAccessiblePopup::rect( int control ) const +{ + if ( !control ) + return TQAccessibleWidget::rect( control ); + + TQRect r = popupMenu()->itemGeometry( control - 1 ); + TQPoint tlp = popupMenu()->mapToGlobal( TQPoint( 0,0 ) ); + + return TQRect( tlp.x() + r.x(), tlp.y() + r.y(), r.width(), r.height() ); +} + +int TQAccessiblePopup::controlAt( int x, int y ) const +{ + TQPoint p = popupMenu()->mapFromGlobal( TQPoint( x,y ) ); + MyPopupMenu *mp = (MyPopupMenu*)popupMenu(); + return mp->itemAtPos( p, FALSE ) + 1; +} + +int TQAccessiblePopup::navigate( NavDirection direction, int startControl ) const +{ + if ( direction != NavFirstChild && direction != NavLastChild && direction != NavFocusChild && !startControl ) + return TQAccessibleWidget::navigate( direction, startControl ); + + switch ( direction ) { + case NavFirstChild: + return 1; + case NavLastChild: + return childCount(); + case NavNext: + case NavDown: + return (startControl + 1) > childCount() ? -1 : startControl + 1; + case NavPrevious: + case NavUp: + return (startControl - 1) < 1 ? -1 : startControl - 1; + default: + break; + } + return -1; +} + +TQString TQAccessiblePopup::text( Text t, int control ) const +{ + TQString tx = TQAccessibleWidget::text( t, control ); + if ( !!tx ) + return tx; + + int id; + TQMenuItem *item = 0; + if ( control ) { + id = popupMenu()->idAt( control - 1 ); + item = popupMenu()->tqfindItem( id ); + } + + switch ( t ) { + case Name: + if ( !control ) + return popupMenu()->caption(); + return stripAmp( popupMenu()->text( id ) ); + case Help: + return popupMenu()->whatsThis( id ); + case Accelerator: + return hotKey( popupMenu()->text( id ) ); + case DefaultAction: + if ( !item || item->isSeparator() || !item->isEnabled() ) + break; + if ( item->popup() ) + return TQPopupMenu::tr("Open"); + return TQPopupMenu::tr("Execute"); + default: + break; + } + return tx; +} + +TQAccessible::Role TQAccessiblePopup::role( int control ) const +{ + if ( !control ) + return PopupMenu; + + TQMenuItem *item = popupMenu()->tqfindItem( popupMenu()->idAt( control -1 ) ); + if ( item && item->isSeparator() ) + return Separator; + return MenuItem; +} + +TQAccessible::State TQAccessiblePopup::state( int control ) const +{ + int s = TQAccessibleWidget::state( control ); + if ( !control ) + return (State)s; + + int id = popupMenu()->idAt( control -1 ); + TQMenuItem *item = popupMenu()->tqfindItem( id ); + if ( !item ) + return (State)s; + + if ( popupMenu()->style().tqstyleHint( TQStyle::SH_PopupMenu_MouseTracking ) ) + s |= HotTracked; + if ( item->isSeparator() || !item->isEnabled() ) + s |= Unavailable; + if ( popupMenu()->isCheckable() && item->isChecked() ) + s |= Checked; + if ( popupMenu()->isItemActive( id ) ) + s |= Focused; + + return (State)s; +} + +bool TQAccessiblePopup::doDefaultAction( int control ) +{ + if ( !control ) + return FALSE; + + int id = popupMenu()->idAt( control -1 ); + TQMenuItem *item = popupMenu()->tqfindItem( id ); + if ( !item || !item->isEnabled() ) + return FALSE; + + popupMenu()->activateItemAt( control - 1); + return TRUE; +} + +bool TQAccessiblePopup::setFocus( int control ) +{ + if ( !control ) + return FALSE; + + int id = popupMenu()->idAt( control -1 ); + TQMenuItem *item = popupMenu()->tqfindItem( id ); + if ( !item || !item->isEnabled() ) + return FALSE; + + popupMenu()->setActiveItem( control - 1 ); + return TRUE; +} + + +class MyMenuBar : public TQMenuBar +{ + friend class TQAccessibleMenuBar; +}; + +TQAccessibleMenuBar::TQAccessibleMenuBar( TQObject *o ) +: TQAccessibleWidget( o ) +{ + TQ_ASSERT( o->inherits( "TQMenuBar" ) ); +} + +TQMenuBar *TQAccessibleMenuBar::menuBar() const +{ + return (TQMenuBar*)object(); +} + +int TQAccessibleMenuBar::childCount() const +{ + return menuBar()->count(); +} + +TQRESULT TQAccessibleMenuBar::queryChild( int /*control*/, TQAccessibleInterface **iface ) const +{ + *iface = 0; + return TQS_FALSE; +} + +TQRect TQAccessibleMenuBar::rect( int control ) const +{ + if ( !control ) + return TQAccessibleWidget::rect( control ); + + MyMenuBar *mb = (MyMenuBar*)menuBar(); + TQRect r = mb->tqitemRect( control - 1 ); + TQPoint tlp = mb->mapToGlobal( TQPoint( 0,0 ) ); + + return TQRect( tlp.x() + r.x(), tlp.y() + r.y(), r.width(), r.height() ); +} + +int TQAccessibleMenuBar::controlAt( int x, int y ) const +{ + MyMenuBar *mb = (MyMenuBar*)menuBar(); + TQPoint p = mb->mapFromGlobal( TQPoint( x,y ) ); + return mb->itemAtPos( p ) + 1; +} + +int TQAccessibleMenuBar::navigate( NavDirection direction, int startControl ) const +{ + if ( direction != NavFirstChild && direction != NavLastChild && direction != NavFocusChild && !startControl ) + return TQAccessibleWidget::navigate( direction, startControl ); + + switch ( direction ) { + case NavFirstChild: + return 1; + case NavLastChild: + return childCount(); + case NavNext: + case NavRight: + return (startControl + 1) > childCount() ? -1 : startControl + 1; + case NavPrevious: + case NavLeft: + return (startControl - 1) < 1 ? -1 : startControl - 1; + default: + break; + } + + return -1; +} + +TQString TQAccessibleMenuBar::text( Text t, int control ) const +{ + TQString tx = TQAccessibleWidget::text( t, control ); + if ( !!tx ) + return tx; + if ( !control ) + return tx; + + int id = menuBar()->idAt( control - 1 ); + switch ( t ) { + case Name: + return stripAmp( menuBar()->text( id ) ); + case Accelerator: + tx = hotKey( menuBar()->text( id ) ); + if ( !!tx ) + return "Alt + "+tx; + break; + case DefaultAction: + return TQMenuBar::tr("Open"); + default: + break; + } + + return tx; +} + +TQAccessible::Role TQAccessibleMenuBar::role( int control ) const +{ + if ( !control ) + return MenuBar; + + TQMenuItem *item = menuBar()->tqfindItem( menuBar()->idAt( control -1 ) ); + if ( item && item->isSeparator() ) + return Separator; + return MenuItem; +} + +TQAccessible::State TQAccessibleMenuBar::state( int control ) const +{ + int s = TQAccessibleWidget::state( control ); + if ( !control ) + return (State)s; + + int id = menuBar()->idAt( control -1 ); + TQMenuItem *item = menuBar()->tqfindItem( id ); + if ( !item ) + return (State)s; + + if ( menuBar()->style().tqstyleHint( TQStyle::SH_PopupMenu_MouseTracking ) ) + s |= HotTracked; + if ( item->isSeparator() || !item->isEnabled() ) + s |= Unavailable; + if ( menuBar()->isItemActive( id ) ) + s |= Focused; + + return (State)s; +} + +bool TQAccessibleMenuBar::doDefaultAction( int control ) +{ + if ( !control ) + return FALSE; + + int id = menuBar()->idAt( control -1 ); + TQMenuItem *item = menuBar()->tqfindItem( id ); + if ( !item || !item->isEnabled() ) + return FALSE; + + menuBar()->activateItemAt( control - 1); + return TRUE; +} + +bool TQAccessibleMenuBar::setFocus( int control ) +{ + if ( !control ) + return FALSE; + + int id = menuBar()->idAt( control -1 ); + TQMenuItem *item = menuBar()->tqfindItem( id ); + if ( !item || !item->isEnabled() ) + return FALSE; + + return TRUE; +} diff --git a/tqtinterface/qt4/plugins/src/accessible/widgets/qaccessiblemenu.h b/tqtinterface/qt4/plugins/src/accessible/widgets/qaccessiblemenu.h new file mode 100644 index 0000000..c510cd5 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/accessible/widgets/qaccessiblemenu.h @@ -0,0 +1,55 @@ +#ifndef TQACCESSIBLEMENU_H +#define TQACCESSIBLEMENU_H + +#include "tqaccessiblewidget.h" + +class TQPopupMenu; +class TQMenuBar; + +class TQAccessiblePopup : public TQAccessibleWidget +{ +public: + TQAccessiblePopup( TQObject *o ); + + int childCount() const; + TQRESULT queryChild( int control, TQAccessibleInterface ** ) const; + + TQRect rect( int control ) const; + int controlAt( int x, int y ) const; + int navigate( NavDirection direction, int control ) const; + + TQString text( Text t, int control ) const; + Role role( int control ) const; + State state( int control ) const; + + bool doDefaultAction( int control ); + bool setFocus( int control ); + +protected: + TQPopupMenu *popupMenu() const; +}; + +class TQAccessibleMenuBar : public TQAccessibleWidget +{ +public: + TQAccessibleMenuBar( TQObject *o ); + + int childCount() const; + TQRESULT queryChild( int control, TQAccessibleInterface ** ) const; + + TQRect rect( int control ) const; + int controlAt( int x, int y ) const; + int navigate( NavDirection direction, int control ) const; + + TQString text( Text t, int control ) const; + Role role( int control ) const; + State state( int control ) const; + + bool doDefaultAction( int control ); + bool setFocus( int control ); + +protected: + TQMenuBar *menuBar() const; +}; + +#endif // TQACCESSIBLEMENU_H diff --git a/tqtinterface/qt4/plugins/src/accessible/widgets/qaccessiblewidget.cpp b/tqtinterface/qt4/plugins/src/accessible/widgets/qaccessiblewidget.cpp new file mode 100644 index 0000000..6741bf0 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/accessible/widgets/qaccessiblewidget.cpp @@ -0,0 +1,2856 @@ +#include "tqaccessiblewidget.h" + +#include <tqapplication.h> +#include <tqstyle.h> +#include <tqobjectlist.h> +#include <tqpushbutton.h> +#include <tqslider.h> +#include <tqdial.h> +#include <tqspinbox.h> +#include <tqscrollbar.h> +#include <tqslider.h> +#include <tqlineedit.h> +#include <tqlabel.h> +#include <tqlcdnumber.h> +#include <tqprogressbar.h> +#include <tqgroupbox.h> +#include <tqtoolbutton.h> +#include <tqwhatsthis.h> +#include <tqtooltip.h> +#include <tqscrollview.h> +#include <tqheader.h> +#include <tqtabbar.h> +#include <tqcombobox.h> +#include <tqrangecontrol.h> +#include <tqlistbox.h> +#include <tqlistview.h> +#include <tqiconview.h> +#include <tqtextedit.h> +#include <tqwidgetstack.h> +#include <private/tqtitlebar_p.h> + + +TQString buddyString( TQWidget *widget ) +{ + TQWidget *tqparent = widget->parentWidget(); + TQObjectList *ol = tqparent->queryList( "TQLabel", 0, FALSE, FALSE ); + if ( !ol || !ol->count() ) { + delete ol; + return TQString::null; + } + + TQString str; + + TQObjectListIt it(*ol); + while ( it.current() ) { + TQLabel *label = (TQLabel*)it.current(); + ++it; + if ( label->buddy() == widget ) { + str = label->text(); + break; + } + } + delete ol; + if ( !!str ) + return str; + + if ( tqparent->inherits( "TQGroupBox" ) ) + return ((TQGroupBox*)tqparent)->title(); + + return TQString::null; +} + +TQString stripAmp( const TQString &text ) +{ + if ( text.isEmpty() ) + return text; + + TQString n = text; + for ( uint i = 0; i < n.length(); i++ ) { + if ( n[(int)i] == '&' ) + n.remove( i, 1 ); + } + return n; +} + +TQString hotKey( const TQString &text ) +{ + if ( text.isEmpty() ) + return text; + + TQString n = text; + int fa = 0; + bool ac = FALSE; + while ( ( fa = n.tqfind( "&", fa ) ) != -1 ) { + if ( n.at(fa+1) != '&' ) { + ac = TRUE; + break; + } + } + if ( fa != -1 && ac ) + return TQString( n.at(fa + 1) ); + + return TQString::null; +} + +/*! + \class TQAccessibleWidget qaccessiblewidget.h + \brief The TQAccessibleWidget class implements the TQAccessibleInterface for TQWidgets. +*/ + +ulong TQAccessibleWidget::objects = 0; + +/*! + Creates a TQAccessibleWidget object for \a o. + \a role, \a name, \a description, \a value, \a help, \a defAction, + \a accelerator and \a state are optional parameters for static values + of the object's property. +*/ +TQAccessibleWidget::TQAccessibleWidget( TQObject *o, Role role, TQString name, + TQString description, TQString value, TQString help, TQString defAction, TQString accelerator, State state ) + : TQAccessibleObject( o ), role_(role), state_(state), name_(name), + description_(description),value_(value),help_(help), + defAction_(defAction), accelerator_(accelerator) +{ + objects++; +} + +TQAccessibleWidget::~TQAccessibleWidget() +{ + objects--; +} + +/*! Returns the widget. */ +TQWidget *TQAccessibleWidget::widget() const +{ + TQ_ASSERT(object()->isWidgetType()); + if ( !object()->isWidgetType() ) + return 0; + return (TQWidget*)object(); +} + +/*! \reimp */ +int TQAccessibleWidget::controlAt( int x, int y ) const +{ + TQWidget *w = widget(); + TQPoint gp = w->mapToGlobal( TQPoint( 0, 0 ) ); + if ( !TQRect( gp.x(), gp.y(), w->width(), w->height() ).tqcontains( x, y ) ) + return -1; + + TQPoint rp = w->mapFromGlobal( TQPoint( x, y ) ); + + TQObjectList *list = w->queryList( "TQWidget", 0, FALSE, FALSE ); + + if ( !list || list->isEmpty() ) + return 0; + + TQObjectListIt it( *list ); + TQWidget *child = 0; + int index = 1; + while ( ( child = (TQWidget*)it.current() ) ) { + if ( !child->isTopLevel() && !child->isHidden() && child->tqgeometry().tqcontains( rp ) ) { + delete list; + return index; + } + ++it; + ++index; + } + delete list; + return 0; +} + +/*! \reimp */ +TQRect TQAccessibleWidget::rect( int control ) const +{ +#if defined(TQT_DEBUG) + if ( control ) + qWarning( "TQAccessibleWidget::rect: This implementation does not support subelements! (ID %d unknown for %s)", control, widget()->className() ); +#else + TQ_UNUSED(control) +#endif + TQWidget *w = widget(); + TQPoint wpos = w->mapToGlobal( TQPoint( 0, 0 ) ); + + return TQRect( wpos.x(), wpos.y(), w->width(), w->height() ); +} + +/*! \reimp */ +int TQAccessibleWidget::navigate( NavDirection dir, int startControl ) const +{ +#if defined(TQT_DEBUG) + if ( startControl ) + qWarning( "TQAccessibleWidget::navigate: This implementation does not support subelements! (ID %d unknown for %s)", startControl, widget()->className() ); +#else + TQ_UNUSED(startControl); +#endif + TQWidget *w = widget(); + switch ( dir ) { + case NavFirstChild: + { + TQObjectList *list = w->queryList( "TQWidget", 0, FALSE, FALSE ); + bool has = !list->isEmpty(); + delete list; + return has ? 1 : -1; + } + case NavLastChild: + { + TQObjectList *list = w->queryList( "TQWidget", 0, FALSE, FALSE ); + bool has = !list->isEmpty(); + delete list; + return has ? childCount() : -1; + } + case NavNext: + case NavPrevious: + { + TQWidget *tqparent = w->parentWidget(); + TQObjectList *sl = tqparent ? tqparent->queryList( "TQWidget", 0, FALSE, FALSE ) : 0; + if ( !sl ) + return -1; + TQObject *sib; + TQObjectListIt it( *sl ); + int index; + if ( dir == NavNext ) { + index = 1; + while ( ( sib = it.current() ) ) { + ++it; + ++index; + if ( sib == w ) + break; + } + } else { + it.toLast(); + index = sl->count(); + while ( ( sib = it.current() ) ) { + --it; + --index; + if ( sib == w ) + break; + } + } + sib = it.current(); + delete sl; + if ( sib ) + return index; + return -1; + } + break; + case NavFocusChild: + { + if ( w->hasFocus() ) + return 0; + + TQWidget *w2 = w->tqfocusWidget(); + if ( !w2 ) + return -1; + + TQObjectList *list = w->queryList( "TQWidget", 0, FALSE, FALSE ); + int index = list->tqfindRef( w2 ); + delete list; + return ( index != -1 ) ? index+1 : -1; + } + default: + qWarning( "TQAccessibleWidget::navigate: unhandled request" ); + break; + }; + return -1; +} + +/*! \reimp */ +int TQAccessibleWidget::childCount() const +{ + TQObjectList *cl = widget()->queryList( "TQWidget", 0, FALSE, FALSE ); + if ( !cl ) + return 0; + + int count = cl->count(); + delete cl; + return count; +} + +/*! \reimp */ +TQRESULT TQAccessibleWidget::queryChild( int control, TQAccessibleInterface **iface ) const +{ + *iface = 0; + TQObjectList *cl = widget()->queryList( "TQWidget", 0, FALSE, FALSE ); + if ( !cl ) + return TQS_FALSE; + + TQObject *o = 0; + if ( cl->count() >= (uint)control ) + o = cl->at( control-1 ); + delete cl; + + if ( !o ) + return TQS_FALSE; + + return TQAccessible::queryAccessibleInterface( o, iface ); +} + +/*! \reimp */ +TQRESULT TQAccessibleWidget::queryParent( TQAccessibleInterface **iface ) const +{ + return TQAccessible::queryAccessibleInterface( widget()->parentWidget(), iface ); +} + +/*! \reimp */ +bool TQAccessibleWidget::doDefaultAction( int control ) +{ +#if defined(TQT_DEBUG) + if ( control ) + qWarning( "TQAccessibleWidget::doDefaultAction: This implementation does not support subelements! (ID %d unknown for %s)", control, widget()->className() ); +#else + TQ_UNUSED(control) +#endif + return FALSE; +} + +/*! \reimp */ +TQString TQAccessibleWidget::text( Text t, int control ) const +{ + switch ( t ) { + case DefaultAction: + return defAction_; + case Description: + if ( !control && description_.isNull() ) { + TQString desc = TQToolTip::textFor( widget() ); + return desc; + } + return description_; + case Help: + if ( !control && help_.isNull() ) { + TQString help = TQWhatsThis::textFor( widget() ); + return help; + } + return help_; + case Accelerator: + return accelerator_; + case Name: + { + if ( !control && name_.isNull() && widget()->isTopLevel() ) + return widget()->caption(); + return name_; + } + case Value: + return value_; + default: + break; + } + return TQString::null; +} + +/*! \reimp */ +void TQAccessibleWidget::setText( Text t, int /*control*/, const TQString &text ) +{ + switch ( t ) { + case DefaultAction: + defAction_ = text; + break; + case Description: + description_ = text; + break; + case Help: + help_ = text; + break; + case Accelerator: + accelerator_ = text; + break; + case Name: + name_ = text; + break; + case Value: + value_ = text; + break; + default: + break; + } +} + +/*! \reimp */ +TQAccessible::Role TQAccessibleWidget::role( int control ) const +{ + if ( !control ) + return role_; + return NoRole; +} + +/*! \reimp */ +TQAccessible::State TQAccessibleWidget::state( int control ) const +{ + if ( control ) + return Normal; + + if ( state_ != Normal ) + return state_; + + int state = Normal; + + TQWidget *w = widget(); + if ( w->isHidden() ) + state |= Invisible; + if ( w->focusPolicy() != TQWidget::NoFocus && w->isActiveWindow() ) + state |= Focusable; + if ( w->hasFocus() ) + state |= Focused; + if ( !w->isEnabled() ) + state |= Unavailable; + if ( w->isTopLevel() ) { + state |= Moveable; + if ( w->tqminimumSize() != w->tqmaximumSize() ) + state |= Sizeable; + } + + return (State)state; +} + +/*! \reimp */ +bool TQAccessibleWidget::setFocus( int control ) +{ +#if defined(TQT_DEBUG) + if ( control ) + qWarning( "TQAccessibleWidget::setFocus: This implementation does not support subelements! (ID %d unknown for %s)", control, widget()->className() ); +#else + TQ_UNUSED(control) +#endif + if ( widget()->focusPolicy() != TQWidget::NoFocus ) { + widget()->setFocus(); + return TRUE; + } + return FALSE; +} + +/*! \reimp */ +bool TQAccessibleWidget::setSelected( int, bool, bool ) +{ +#if defined(TQT_DEBUG) + qWarning( "TQAccessibleWidget::setSelected: This function not supported for simple widgets." ); +#endif + return FALSE; +} + +/*! \reimp */ +void TQAccessibleWidget::clearSelection() +{ +#if defined(TQT_DEBUG) + qWarning( "TQAccessibleWidget::clearSelection: This function not supported for simple widgets." ); +#endif +} + +/*! \reimp */ +TQMemArray<int> TQAccessibleWidget::selection() const +{ + return TQMemArray<int>(); +} + +/*! + \class TQAccessibleWidgetStack tqaccessible.h + \brief The TQAccessibleWidgetStack class implements the TQAccessibleInterface for widget stacks. +*/ + +/*! + Creates a TQAccessibleWidgetStack object for \a o. +*/ +TQAccessibleWidgetStack::TQAccessibleWidgetStack( TQObject *o ) +: TQAccessibleWidget( o ) +{ + TQ_ASSERT( o->inherits("TQWidgetStack") ); +} + +/*! Returns the widget stack. */ +TQWidgetStack *TQAccessibleWidgetStack::widgetStack() const +{ + return (TQWidgetStack*)object(); +} + +/*! \reimp */ +int TQAccessibleWidgetStack::controlAt( int, int ) const +{ + return widgetStack()->id( widgetStack()->visibleWidget() ) + 1; +} + +/*! \reimp */ +TQRESULT TQAccessibleWidgetStack::queryChild( int control, TQAccessibleInterface **iface ) const +{ + if ( !control ) { + *iface = (TQAccessibleInterface*)this; + return TQS_OK; + } + + TQWidget *widget = widgetStack()->widget( control - 1 ); + if ( !widget ) + return TQAccessibleWidget::queryChild( control, iface ); + return TQAccessible::queryAccessibleInterface( widgetStack()->widget( control - 1 ), iface ); +} + + +/*! + \class TQAccessibleButton tqaccessible.h + \brief The TQAccessibleButton class implements the TQAccessibleInterface for button type widgets. +*/ + +/*! + Creates a TQAccessibleButton object for \a o. + \a role, \a description and \a help are propagated to the TQAccessibleWidget constructor. +*/ +TQAccessibleButton::TQAccessibleButton( TQObject *o, Role role, TQString description, + TQString /* help */ ) +: TQAccessibleWidget( o, role, TQString::null, description, TQString::null, + TQString::null, TQString::null, TQString::null ) +{ + TQ_ASSERT(o->inherits("TQButton")); +} + +/*! \reimp */ +bool TQAccessibleButton::doDefaultAction( int control ) +{ + if ( !widget()->isEnabled() ) + return FALSE; + + Role r = role(control); + if ( r == PushButton || r == CheckBox || r == RadioButton ) { + ((TQButton*)object())->animateClick(); + } else if ( object()->inherits("TQToolButton") ) { + TQToolButton *tb = (TQToolButton*)object(); + tb->openPopup(); + } + + return TRUE; +} + +/*! \reimp */ +TQString TQAccessibleButton::text( Text t, int control ) const +{ + TQString tx = TQAccessibleWidget::text( t, control ); + if ( !!tx ) + return tx; + + switch ( t ) { + case DefaultAction: + switch( role(control) ) { + case PushButton: + return TQButton::tr("Press"); + case CheckBox: + if ( state(control) & Checked ) + return TQButton::tr("UnCheck"); + return TQButton::tr("Check"); + case RadioButton: + return TQButton::tr("Check"); + default: + return TQButton::tr("Press"); + } + case Accelerator: + tx = hotKey( ((TQButton*)widget())->text() ); + if ( !!tx ) { + tx = "Alt + "+tx; + } else { + tx = hotKey( buddyString( widget() ) ); + if ( !!tx ) + tx = "Alt + "+tx; + } + return tx; + case Name: + tx = ((TQButton*)widget())->text(); + if ( tx.isEmpty() && widget()->inherits("TQToolButton") ) + tx = ((TQToolButton*)widget())->textLabel(); + if ( tx.isEmpty() ) + tx = buddyString( widget() ); + + return stripAmp( tx ); + default: + break; + } + return tx; +} + +/*! \reimp */ +TQAccessible::State TQAccessibleButton::state( int control ) const +{ + int state = TQAccessibleWidget::state( control ); + + TQButton *b = (TQButton*)widget(); + if ( b->state() == TQButton::On ) + state |= Checked; + else if ( b->state() == TQButton::NoChange ) + state |= Mixed; + if ( b->isDown() ) + state |= Pressed; + if ( b->inherits( "TQPushButton" ) ) { + TQPushButton *pb = (TQPushButton*)b; + if ( pb->isDefault() ) + state |= Default; + } + + return (State)state; +} + +/*! + \class TQAccessibleRangeControl qaccessiblewidget.h + \brief The TQAccessibleRangeControl class implements the TQAccessibleInterface for range controls. +*/ + +/*! + Constructs a TQAccessibleRangeControl object for \a o. + \a role, \a name, \a description, \a help, \a defAction and \a accelerator + are propagated to the TQAccessibleWidget constructor. +*/ +TQAccessibleRangeControl::TQAccessibleRangeControl( TQObject *o, Role role, TQString name, + TQString description, TQString help, TQString defAction, TQString accelerator ) +: TQAccessibleWidget( o, role, name, description, TQString::null, help, defAction, accelerator ) +{ +} + +/*! \reimp */ +TQString TQAccessibleRangeControl::text( Text t, int control ) const +{ + TQString tx = TQAccessibleWidget::text( t, control ); + if ( !!tx ) + return stripAmp(tx); + + switch ( t ) { + case Name: + return stripAmp( buddyString( widget() ) ); + case Accelerator: + tx = hotKey( buddyString( widget() ) ); + if ( !!tx ) + return "Alt + "+tx; + break; + case Value: + if ( widget()->inherits( "TQSlider" ) ) { + TQSlider *s = (TQSlider*)widget(); + return TQString::number( s->value() ); + } else if ( widget()->inherits( "TQDial" ) ) { + TQDial *d = (TQDial*)widget(); + return TQString::number( d->value() ); + } else if ( widget()->inherits( "TQSpinBox" ) ) { + TQSpinBox *s = (TQSpinBox*)widget(); + return s->text(); + } else if ( widget()->inherits( "TQScrollBar" ) ) { + TQScrollBar *s = (TQScrollBar*)widget(); + return TQString::number( s->value() ); + } else if ( widget()->inherits( "TQProgressBar" ) ) { + TQProgressBar *p = (TQProgressBar*)widget(); + return TQString::number( p->progress() ); + } + default: + break; + } + return tx; +} + + +/*! + \class TQAccessibleSpinWidget qaccessiblewidget.h + \brief The TQAccessibleSpinWidget class implements the TQAccessibleInterface for up/down widgets. +*/ + +/*! + Constructs a TQAccessibleSpinWidget object for \a o. +*/ +TQAccessibleSpinWidget::TQAccessibleSpinWidget( TQObject *o ) +: TQAccessibleRangeControl( o, SpinBox ) +{ +} + +/*! \reimp */ +int TQAccessibleSpinWidget::controlAt( int x, int y ) const +{ + TQPoint tl = widget()->mapFromGlobal( TQPoint( x, y ) ); + if ( ((TQSpinWidget*)widget())->upRect().tqcontains( tl ) ) + return 1; + else if ( ((TQSpinWidget*)widget())->downRect().tqcontains( tl ) ) + return 2; + + return -1; +} + +/*! \reimp */ +TQRect TQAccessibleSpinWidget::rect( int control ) const +{ + TQRect rect; + switch( control ) { + case 1: + rect = ((TQSpinWidget*)widget())->upRect(); + break; + case 2: + rect = ((TQSpinWidget*)widget())->downRect(); + break; + default: + rect = widget()->rect(); + } + TQPoint tl = widget()->mapToGlobal( TQPoint( 0, 0 ) ); + return TQRect( tl.x() + rect.x(), tl.y() + rect.y(), rect.width(), rect.height() ); +} + +/*! \reimp */ +int TQAccessibleSpinWidget::navigate( NavDirection direction, int startControl ) const +{ + if ( direction != NavFirstChild && direction != NavLastChild && direction != NavFocusChild && !startControl ) + return TQAccessibleWidget::navigate( direction, startControl ); + + switch ( direction ) { + case NavFirstChild: + return 1; + case NavLastChild: + return 2; + case NavNext: + case NavDown: + startControl += 1; + if ( startControl > 2 ) + return -1; + return startControl; + case NavPrevious: + case NavUp: + startControl -= 1; + if ( startControl < 1 ) + return -1; + return startControl; + default: + break; + } + + return -1; +} + +/*! \reimp */ +int TQAccessibleSpinWidget::childCount() const +{ + return 2; +} + +/*! \reimp */ +TQRESULT TQAccessibleSpinWidget::queryChild( int /*control*/, TQAccessibleInterface **iface ) const +{ + *iface = 0; + return TQS_FALSE; +} + +/*! \reimp */ +TQString TQAccessibleSpinWidget::text( Text t, int control ) const +{ + switch ( t ) { + case Name: + switch ( control ) { + case 1: + return TQSpinWidget::tr("More"); + case 2: + return TQSpinWidget::tr("Less"); + default: + break; + } + break; + case DefaultAction: + switch( control ) { + case 1: + case 2: + return TQSpinWidget::tr("Press"); + default: + break; + } + break; + default: + break; + } + return TQAccessibleRangeControl::text( t, control ); +} + +/*! \reimp */ +TQAccessible::Role TQAccessibleSpinWidget::role( int control ) const +{ + switch( control ) { + case 1: + return PushButton; + case 2: + return PushButton; + default: + break; + } + return TQAccessibleRangeControl::role( control ); +} + +/*! \reimp */ +TQAccessible::State TQAccessibleSpinWidget::state( int control ) const +{ + int state = TQAccessibleRangeControl::state( control ); + switch( control ) { + case 1: + if ( !((TQSpinWidget*)widget())->isUpEnabled() ) + state |= Unavailable; + return (State)state; + case 2: + if ( !((TQSpinWidget*)widget())->isDownEnabled() ) + state |= Unavailable; + return (State)state; + default: + break; + } + return TQAccessibleRangeControl::state( control ); +} + +/*! \reimp */ +bool TQAccessibleSpinWidget::doDefaultAction( int control ) +{ + switch( control ) { + case 1: + if ( !((TQSpinWidget*)widget())->isUpEnabled() ) + return FALSE; + ((TQSpinWidget*)widget())->stepUp(); + return TRUE; + case 2: + if ( !((TQSpinWidget*)widget())->isDownEnabled() ) + return FALSE; + ((TQSpinWidget*)widget())->stepDown(); + return TRUE; + default: + break; + } + return TQAccessibleRangeControl::doDefaultAction( control ); +} + +/*! + \class TQAccessibleScrollBar qaccessiblewidget.h + \brief The TQAccessibleScrollBar class implements the TQAccessibleInterface for scroll bars. +*/ + +/*! + Constructs a TQAccessibleScrollBar object for \a o. + \a name, \a description, \a help, \a defAction and \a accelerator + are propagated to the TQAccessibleRangeControl constructor. +*/ +TQAccessibleScrollBar::TQAccessibleScrollBar( TQObject *o, TQString name, + TQString description, TQString help, TQString defAction, TQString accelerator ) +: TQAccessibleRangeControl( o, ScrollBar, name, description, help, defAction, accelerator ) +{ + TQ_ASSERT( o->inherits("TQScrollBar" ) ); +} + +/*! Returns the scroll bar. */ +TQScrollBar *TQAccessibleScrollBar::scrollBar() const +{ + return (TQScrollBar*)widget(); +} + +/*! \reimp */ +int TQAccessibleScrollBar::controlAt( int x, int y ) const +{ + for ( int i = 1; i <= childCount(); i++ ) { + if ( rect(i).tqcontains( x,y ) ) + return i; + } + return 0; +} + +/*! \reimp */ +TQRect TQAccessibleScrollBar::rect( int control ) const +{ + TQRect rect; + TQRect srect = scrollBar()->sliderRect(); + int sz = scrollBar()->style().tqpixelMetric( TQStyle::PM_ScrollBarExtent, scrollBar() ); + switch ( control ) { + case 1: + if ( scrollBar()->orientation() == Vertical ) + rect = TQRect( 0, 0, sz, sz ); + else + rect = TQRect( 0, 0, sz, sz ); + break; + case 2: + if ( scrollBar()->orientation() == Vertical ) + rect = TQRect( 0, sz, sz, srect.y() - sz ); + else + rect = TQRect( sz, 0, srect.x() - sz, sz ); + break; + case 3: + rect = srect; + break; + case 4: + if ( scrollBar()->orientation() == Vertical ) + rect = TQRect( 0, srect.bottom(), sz, scrollBar()->rect().height() - srect.bottom() - sz ); + else + rect = TQRect( srect.right(), 0, scrollBar()->rect().width() - srect.right() - sz, sz ) ; + break; + case 5: + if ( scrollBar()->orientation() == Vertical ) + rect = TQRect( 0, scrollBar()->rect().height() - sz, sz, sz ); + else + rect = TQRect( scrollBar()->rect().width() - sz, 0, sz, sz ); + break; + default: + return TQAccessibleRangeControl::rect( control ); + } + + TQPoint tp = scrollBar()->mapToGlobal( TQPoint( 0,0 ) ); + return TQRect( tp.x() + rect.x(), tp.y() + rect.y(), rect.width(), rect.height() ); +} + +/*! \reimp */ +int TQAccessibleScrollBar::navigate( NavDirection direction, int startControl ) const +{ + if ( direction != NavFirstChild && direction != NavLastChild && direction != NavFocusChild && !startControl ) + return TQAccessibleRangeControl::navigate( direction, startControl ); + + switch ( direction ) { + case NavFirstChild: + return 1; + case NavLastChild: + return 5; + case NavNext: + return startControl == childCount() ? -1 : startControl + 1; + case NavDown: + if ( scrollBar()->orientation() == Horizontal ) + break; + return startControl == childCount() ? -1 : startControl + 1; + case NavRight: + if ( scrollBar()->orientation() == Vertical ) + break; + return startControl == childCount() ? -1 : startControl + 1; + case NavPrevious: + return startControl == 1 ? -1 : startControl - 1; + case NavUp: + if ( scrollBar()->orientation() == Horizontal ) + break; + return startControl == 1 ? -1 : startControl - 1; + case NavLeft: + if ( scrollBar()->orientation() == Vertical ) + break; + return startControl == 1 ? -1 : startControl - 1; + default: + break; + } + + return -1; +} + +/*! \reimp */ +int TQAccessibleScrollBar::childCount() const +{ + return 5; +} + +/*! \reimp */ +TQRESULT TQAccessibleScrollBar::queryChild( int /*control*/, TQAccessibleInterface **iface ) const +{ + *iface = 0; + return TQS_FALSE; +} + +/*! \reimp */ +TQString TQAccessibleScrollBar::text( Text t, int control ) const +{ + switch ( t ) { + case Value: + if ( control && control != 3 ) + return TQString::null; + break; + case Name: + switch ( control ) { + case 1: + return TQScrollBar::tr("Line up"); + case 2: + return TQScrollBar::tr("Page up"); + case 3: + return TQScrollBar::tr("Position"); + case 4: + return TQScrollBar::tr("Page down"); + case 5: + return TQScrollBar::tr("Line down"); + } + break; + case DefaultAction: + if ( control != 3 ) + return TQScrollBar::tr("Press"); + break; + default: + break; + + } + return TQAccessibleRangeControl::text( t, control ); +} + +/*! \reimp */ +TQAccessible::Role TQAccessibleScrollBar::role( int control ) const +{ + switch ( control ) { + case 1: + case 2: + return PushButton; + case 3: + return Indicator; + case 4: + case 5: + return PushButton; + default: + return ScrollBar; + } +} + +/*! \reimp */ +bool TQAccessibleScrollBar::doDefaultAction( int control ) +{ + switch ( control ) { + case 1: + scrollBar()->subtractLine(); + return TRUE; + case 2: + scrollBar()->subtractPage(); + return TRUE; + case 4: + scrollBar()->addPage(); + return TRUE; + case 5: + scrollBar()->addLine(); + return TRUE; + default: + return FALSE; + } +} + +/*! + \class TQAccessibleSlider qaccessiblewidget.h + \brief The TQAccessibleScrollBar class implements the TQAccessibleInterface for sliders. +*/ + +/*! + Constructs a TQAccessibleScrollBar object for \a o. + \a name, \a description, \a help, \a defAction and \a accelerator + are propagated to the TQAccessibleRangeControl constructor. +*/ +TQAccessibleSlider::TQAccessibleSlider( TQObject *o, TQString name, + TQString description, TQString help, TQString defAction, TQString accelerator ) +: TQAccessibleRangeControl( o, ScrollBar, name, description, help, defAction, accelerator ) +{ + TQ_ASSERT( o->inherits("TQSlider" ) ); +} + +/*! Returns the slider. */ +TQSlider *TQAccessibleSlider::slider() const +{ + return (TQSlider*)widget(); +} + +/*! \reimp */ +int TQAccessibleSlider::controlAt( int x, int y ) const +{ + for ( int i = 1; i <= childCount(); i++ ) { + if ( rect(i).tqcontains( x,y ) ) + return i; + } + return 0; +} + +/*! \reimp */ +TQRect TQAccessibleSlider::rect( int control ) const +{ + TQRect rect; + TQRect srect = slider()->sliderRect(); + switch ( control ) { + case 1: + if ( slider()->orientation() == Vertical ) + rect = TQRect( 0, 0, slider()->width(), srect.y() ); + else + rect = TQRect( 0, 0, srect.x(), slider()->height() ); + break; + case 2: + rect = srect; + break; + case 3: + if ( slider()->orientation() == Vertical ) + rect = TQRect( 0, srect.y() + srect.height(), slider()->width(), slider()->height()- srect.y() - srect.height() ); + else + rect = TQRect( srect.x() + srect.width(), 0, slider()->width() - srect.x() - srect.width(), slider()->height() ); + break; + default: + return TQAccessibleRangeControl::rect( control ); + } + + TQPoint tp = slider()->mapToGlobal( TQPoint( 0,0 ) ); + return TQRect( tp.x() + rect.x(), tp.y() + rect.y(), rect.width(), rect.height() ); +} + +/*! \reimp */ +int TQAccessibleSlider::navigate( NavDirection direction, int startControl ) const +{ + if ( direction != NavFirstChild && direction != NavLastChild && direction != NavFocusChild && !startControl ) + return TQAccessibleRangeControl::navigate( direction, startControl ); + + switch ( direction ) { + case NavFirstChild: + return 1; + case NavLastChild: + return childCount(); + case NavNext: + return startControl == childCount() ? -1 : startControl + 1; + case NavDown: + if ( slider()->orientation() == Horizontal ) + break; + return startControl == childCount() ? -1 : startControl + 1; + case NavRight: + if ( slider()->orientation() == Vertical ) + break; + return startControl == childCount() ? -1 : startControl + 1; + case NavPrevious: + return startControl == 1 ? -1 : startControl - 1; + case NavUp: + if ( slider()->orientation() == Horizontal ) + break; + return startControl == 1 ? -1 : startControl - 1; + case NavLeft: + if ( slider()->orientation() == Vertical ) + break; + return startControl == 1 ? -1 : startControl - 1; + default: + break; + } + + return -1; +} + +/*! \reimp */ +int TQAccessibleSlider::childCount() const +{ + return 3; +} + +/*! \reimp */ +TQRESULT TQAccessibleSlider::queryChild( int /*control*/, TQAccessibleInterface **iface ) const +{ + *iface = 0; + return TQS_FALSE; +} + +/*! \reimp */ +TQString TQAccessibleSlider::text( Text t, int control ) const +{ + switch ( t ) { + case Value: + if ( control && control != 2 ) + return TQString::null; + break; + case Name: + switch ( control ) { + case 1: + return TQSlider::tr("Page up"); + case 2: + return TQSlider::tr("Position"); + case 3: + return TQSlider::tr("Page down"); + } + break; + case DefaultAction: + if ( control != 2 ) + return TQSlider::tr("Press"); + break; + default: + break; + } + return TQAccessibleRangeControl::text( t, control ); +} + +/*! \reimp */ +TQAccessible::Role TQAccessibleSlider::role( int control ) const +{ + switch ( control ) { + case 1: + return PushButton; + case 2: + return Indicator; + case 3: + return PushButton; + default: + return Slider; + } +} + +/*! \reimp */ +bool TQAccessibleSlider::doDefaultAction( int control ) +{ + switch ( control ) { + case 1: + slider()->subtractLine(); + return TRUE; + case 3: + slider()->addLine(); + return TRUE; + default: + return FALSE; + } +} + + +/*! + \class TQAccessibleText qaccessiblewidget.h + \brief The TQAccessibleText class implements the TQAccessibleInterface for widgets with editable text. +*/ + +/*! + Constructs a TQAccessibleText object for \a o. + \a role, \a name, \a description, \a help, \a defAction and \a accelerator + are propagated to the TQAccessibleWidget constructor. +*/ +TQAccessibleText::TQAccessibleText( TQObject *o, Role role, TQString name, TQString description, TQString help, TQString defAction, TQString accelerator ) +: TQAccessibleWidget( o, role, name, description, TQString::null, help, defAction, accelerator ) +{ +} + +/*! \reimp */ +TQString TQAccessibleText::text( Text t, int control ) const +{ + TQString str = TQAccessibleWidget::text( t, control ); + if ( !!str ) + return str; + switch ( t ) { + case Name: + return stripAmp( buddyString( widget() ) ); + case Accelerator: + str = hotKey( buddyString( widget() ) ); + if ( !!str ) + return "Alt + "+str; + break; + case Value: + if ( widget()->inherits( "TQLineEdit" ) ) + return ((TQLineEdit*)widget())->text(); + break; + default: + break; + } + return str; +} + +/*! \reimp */ +void TQAccessibleText::setText(Text t, int control, const TQString &text) +{ + if (t != Value || !widget()->inherits("TQLineEdit") || control) { + TQAccessibleWidget::setText(t, control, text); + return; + } + ((TQLineEdit*)widget())->setText(text); +} + +/*! \reimp */ +TQAccessible::State TQAccessibleText::state( int control ) const +{ + int state = TQAccessibleWidget::state( control ); + + if ( widget()->inherits( "TQLineEdit" ) ) { + TQLineEdit *l = (TQLineEdit*)widget(); + if ( l->isReadOnly() ) + state |= ReadOnly; + if ( l->echoMode() == TQLineEdit::Password ) + state |= Protected; + state |= Selectable; + if ( l->hasSelectedText() ) + state |= Selected; + } + + return (State)state; +} + +/*! + \class TQAccessibleDisplay qaccessiblewidget.h + \brief The TQAccessibleDisplay class implements the TQAccessibleInterface for widgets that display static information. +*/ + +/*! + Constructs a TQAccessibleDisplay object for \a o. + \a role, \a description, \a value, \a help, \a defAction and \a accelerator + are propagated to the TQAccessibleWidget constructor. +*/ +TQAccessibleDisplay::TQAccessibleDisplay( TQObject *o, Role role, TQString description, TQString value, TQString help, TQString defAction, TQString accelerator ) +: TQAccessibleWidget( o, role, TQString::null, description, value, help, defAction, accelerator ) +{ +} + +/*! \reimp */ +TQAccessible::Role TQAccessibleDisplay::role( int control ) const +{ + if ( widget()->inherits( "TQLabel" ) ) { + TQLabel *l = (TQLabel*)widget(); + if ( l->pixmap() || l->picture() ) + return Graphic; +#ifndef TQT_NO_PICTURE + if ( l->picture() ) + return Graphic; +#endif +#ifndef TQT_NO_MOVIE + if ( l->movie() ) + return Animation; +#endif + } + return TQAccessibleWidget::role( control ); +} + +/*! \reimp */ +TQString TQAccessibleDisplay::text( Text t, int control ) const +{ + TQString str = TQAccessibleWidget::text( t, control ); + if ( !!str ) + return str; + + switch ( t ) { + case Name: + if ( widget()->inherits( "TQLabel" ) ) { + return stripAmp( ((TQLabel*)widget())->text() ); + } else if ( widget()->inherits( "TQLCDNumber" ) ) { + TQLCDNumber *l = (TQLCDNumber*)widget(); + if ( l->numDigits() ) + return TQString::number( l->value() ); + return TQString::number( l->intValue() ); + } else if ( widget()->inherits( "TQGroupBox" ) ) { + return stripAmp( ((TQGroupBox*)widget())->title() ); + } + break; + default: + break; + } + return str; +} + + +/*! + \class TQAccessibleHeader qaccessiblewidget.h + \brief The TQAccessibleHeader class implements the TQAccessibleInterface for header widgets. +*/ + +/*! + Constructs a TQAccessibleHeader object for \a o. + \a role, \a description, \a value, \a help, \a defAction and \a accelerator + are propagated to the TQAccessibleWidget constructor. +*/ +TQAccessibleHeader::TQAccessibleHeader( TQObject *o, TQString description, + TQString value, TQString help, TQString defAction, TQString accelerator ) + : TQAccessibleWidget( o, NoRole, description, value, help, defAction, accelerator ) +{ + TQ_ASSERT(widget()->inherits("TQHeader")); +} + +/*! Returns the TQHeader. */ +TQHeader *TQAccessibleHeader::header() const +{ + return (TQHeader *)widget(); +} + +/*! \reimp */ +int TQAccessibleHeader::controlAt( int x, int y ) const +{ + TQPoint point = header()->mapFromGlobal( TQPoint( x, y ) ); + for ( int i = 0; i < header()->count(); i++ ) { + if ( header()->sectionRect( i ).tqcontains( point ) ) + return i+1; + } + return -1; +} + +/*! \reimp */ +TQRect TQAccessibleHeader::rect( int control ) const +{ + TQPoint zero = header()->mapToGlobal( TQPoint ( 0,0 ) ); + TQRect sect = header()->sectionRect( control - 1 ); + return TQRect( sect.x() + zero.x(), sect.y() + zero.y(), sect.width(), sect.height() ); +} + +/*! \reimp */ +int TQAccessibleHeader::navigate( NavDirection direction, int startControl ) const +{ + if ( direction != NavFirstChild && direction != NavLastChild && direction != NavFocusChild && !startControl ) + return TQAccessibleWidget::navigate( direction, startControl ); + + int count = header()->count(); + switch ( direction ) { + case NavFirstChild: + return 1; + case NavLastChild: + return count; + case NavNext: + return startControl + 1 > count ? -1 : startControl + 1; + case NavPrevious: + return startControl - 1 < 1 ? -1 : startControl - 1; + case NavUp: + if ( header()->orientation() == Vertical ) + return startControl - 1 < 1 ? -1 : startControl - 1; + return -1; + case NavDown: + if ( header()->orientation() == Vertical ) + return startControl + 1 > count ? -1 : startControl + 1; + break; + case NavLeft: + if ( header()->orientation() == Horizontal ) + return startControl - 1 < 1 ? -1 : startControl - 1; + break; + case NavRight: + if ( header()->orientation() == Horizontal ) + return startControl + 1 > count ? -1 : startControl + 1; + break; + default: + break; + } + return -1; +} + +/*! \reimp */ +int TQAccessibleHeader::childCount() const +{ + return header()->count(); +} + +/*! \reimp */ +TQRESULT TQAccessibleHeader::queryChild( int /*control*/, TQAccessibleInterface **iface ) const +{ + *iface = 0; + return TQS_FALSE; +} + +/*! \reimp */ +TQString TQAccessibleHeader::text( Text t, int control ) const +{ + TQString str = TQAccessibleWidget::text( t, control ); + if ( !!str ) + return str; + + switch ( t ) { + case Name: + return header()->label( control - 1 ); + default: + break; + } + return str; +} + +/*! \reimp */ +TQAccessible::Role TQAccessibleHeader::role( int /*control*/ ) const +{ + if ( header()->orientation() == Qt::Horizontal ) + return ColumnHeader; + else + return RowHeader; +} + +/*! \reimp */ +TQAccessible::State TQAccessibleHeader::state( int control ) const +{ + return TQAccessibleWidget::state( control ); +} + + +/*! + \class TQAccessibleTabBar qaccessiblewidget.h + \brief The TQAccessibleTabBar class implements the TQAccessibleInterface for tab bars. +*/ + +/*! + Constructs a TQAccessibleTabBar object for \a o. + \a role, \a description, \a value, \a help, \a defAction and \a accelerator + are propagated to the TQAccessibleWidget constructor. +*/ +TQAccessibleTabBar::TQAccessibleTabBar( TQObject *o, TQString description, + TQString value, TQString help, TQString defAction, TQString accelerator ) + : TQAccessibleWidget( o, NoRole, description, value, help, defAction, accelerator ) +{ + TQ_ASSERT(widget()->inherits("TQTabBar")); +} + +/*! Returns the TQHeader. */ +TQTabBar *TQAccessibleTabBar::tabBar() const +{ + return (TQTabBar*)widget(); +} + +/*! \reimp */ +int TQAccessibleTabBar::controlAt( int x, int y ) const +{ + int wc = TQAccessibleWidget::controlAt( x, y ); + if ( wc ) + return wc + tabBar()->count(); + + TQPoint tp = tabBar()->mapFromGlobal( TQPoint( x,y ) ); + TQTab *tab = tabBar()->selectTab( tp ); + return tabBar()->indexOf( tab->identifier() ) + 1; +} + +/*! \reimp */ +TQRect TQAccessibleTabBar::rect( int control ) const +{ + if ( !control ) + return TQAccessibleWidget::rect( 0 ); + if ( control > tabBar()->count() ) { + TQAccessibleInterface *iface; + TQAccessibleWidget::queryChild( control - tabBar()->count(), &iface ); + if ( !iface ) + return TQRect(); + return iface->rect( 0 ); + } + + TQTab *tab = tabBar()->tabAt( control - 1 ); + + TQPoint tp = tabBar()->mapToGlobal( TQPoint( 0,0 ) ); + TQRect rec = tab->rect(); + return TQRect( tp.x() + rec.x(), tp.y() + rec.y(), rec.width(), rec.height() ); +} + +/*! \reimp */ +TQRESULT TQAccessibleTabBar::queryChild( int /*control*/, TQAccessibleInterface **iface ) const +{ + *iface = 0; + return TQS_FALSE; +} + +/*! \reimp */ +int TQAccessibleTabBar::navigate( NavDirection direction, int startControl ) const +{ + if ( direction != NavFirstChild && direction != NavLastChild && direction != NavFocusChild && !startControl ) + return TQAccessibleWidget::navigate( direction, startControl ); + + switch ( direction ) { + case NavFirstChild: + return 1; + break; + case NavLastChild: + return childCount(); + break; + case NavNext: + case NavRight: + return startControl + 1 > childCount() ? -1 : startControl + 1; + case NavPrevious: + case NavLeft: + return startControl -1 < 1 ? -1 : startControl - 1; + default: + break; + } + return -1; +} + +/*! \reimp */ +int TQAccessibleTabBar::childCount() const +{ + int wc = TQAccessibleWidget::childCount(); + wc += tabBar()->count(); + return wc; +} + +/*! \reimp */ +TQString TQAccessibleTabBar::text( Text t, int control ) const +{ + TQString str = TQAccessibleWidget::text( t, control ); + if ( !!str ) + return str; + + if ( !control ) + return TQAccessibleWidget::text( t, control ); + if ( control > tabBar()->count() ) { + TQAccessibleInterface *iface; + TQAccessibleWidget::queryChild( control - tabBar()->count(), &iface ); + if ( !iface ) + return TQAccessibleWidget::text( t, 0 ); + return iface->text( t, 0 ); + } + + TQTab *tab = tabBar()->tabAt( control - 1 ); + if ( !tab ) + return TQAccessibleWidget::text( t, 0 ); + + switch ( t ) { + case Name: + return stripAmp( tab->text() ); + case DefaultAction: + return TQTabBar::tr( "Switch" ); + default: + break; + } + return str; +} + +/*! \reimp */ +TQAccessible::Role TQAccessibleTabBar::role( int control ) const +{ + if ( !control ) + return PageTabList; + if ( control > tabBar()->count() ) { + TQAccessibleInterface *iface; + TQAccessibleWidget::queryChild( control - tabBar()->count(), &iface ); + if ( !iface ) + return TQAccessibleWidget::role( 0 ); + return iface->role( 0 ); + } + + return PageTab; +} + +/*! \reimp */ +TQAccessible::State TQAccessibleTabBar::state( int control ) const +{ + int st = TQAccessibleWidget::state( 0 ); + + if ( !control ) + return (State)st; + if ( control > tabBar()->count() ) { + TQAccessibleInterface *iface; + TQAccessibleWidget::queryChild( control - tabBar()->count(), &iface ); + if ( !iface ) + return (State)st; + return iface->state( 0 ); + } + + TQTab *tab = tabBar()->tabAt( control - 1 ); + if ( !tab ) + return (State)st; + + if ( !tab->isEnabled() ) + st |= Unavailable; + else + st |= Selectable; + + if ( tabBar()->currentTab() == tab->identifier() ) + st |= Selected; + + return (State)st; +} + +/*! \reimp */ +bool TQAccessibleTabBar::doDefaultAction( int control ) +{ + if ( !control ) + return FALSE; + if ( control > tabBar()->count() ) { + TQAccessibleInterface *iface; + TQAccessibleWidget::queryChild( control - tabBar()->count(), &iface ); + if ( !iface ) + return FALSE; + return iface->doDefaultAction( 0 ); + } + + TQTab *tab = tabBar()->tabAt( control - 1 ); + if ( !tab || !tab->isEnabled() ) + return FALSE; + tabBar()->setCurrentTab( tab ); + return TRUE; +} + +/*! \reimp */ +bool TQAccessibleTabBar::setSelected( int control, bool on, bool extend ) +{ + if ( !control || !on || extend || control > tabBar()->count() ) + return FALSE; + + TQTab *tab = tabBar()->tabAt( control - 1 ); + if ( !tab || !tab->isEnabled() ) + return FALSE; + tabBar()->setCurrentTab( tab ); + return TRUE; +} + +/*! \reimp */ +void TQAccessibleTabBar::clearSelection() +{ +} + +/*! \reimp */ +TQMemArray<int> TQAccessibleTabBar::selection() const +{ + TQMemArray<int> array( 1 ); + array.at(0) = tabBar()->indexOf( tabBar()->currentTab() ) + 1; + + return array; +} + +/*! + \class TQAccessibleComboBox qaccessiblewidget.h + \brief The TQAccessibleComboBox class implements the TQAccessibleInterface for editable and read-only combo boxes. +*/ + + +/*! + Constructs a TQAccessibleComboBox object for \a o. +*/ +TQAccessibleComboBox::TQAccessibleComboBox( TQObject *o ) +: TQAccessibleWidget( o, ComboBox ) +{ + TQ_ASSERT(o->inherits("TQComboBox")); +} + +/*! + Returns the combo box. +*/ +TQComboBox *TQAccessibleComboBox::comboBox() const +{ + return (TQComboBox*)object(); +} + +/*! \reimp */ +int TQAccessibleComboBox::controlAt( int x, int y ) const +{ + for ( int i = childCount(); i >= 0; --i ) { + if ( rect( i ).tqcontains( x, y ) ) + return i; + } + return -1; +} + +/*! \reimp */ +TQRect TQAccessibleComboBox::rect( int control ) const +{ + TQPoint tp; + TQRect r; + + switch( control ) { + case 1: + if ( comboBox()->editable() ) { + tp = comboBox()->lineEdit()->mapToGlobal( TQPoint( 0,0 ) ); + r = comboBox()->lineEdit()->rect(); + } else { + tp = comboBox()->mapToGlobal( TQPoint( 0,0 ) ); + r = comboBox()->style().querySubControlMetrics( TQStyle::CC_ComboBox, comboBox(), TQStyle::SC_ComboBoxEditField ); + } + break; + case 2: + tp = comboBox()->mapToGlobal( TQPoint( 0,0 ) ); + r = comboBox()->style().querySubControlMetrics( TQStyle::CC_ComboBox, comboBox(), TQStyle::SC_ComboBoxArrow ); + break; + default: + return TQAccessibleWidget::rect( control ); + } + return TQRect( tp.x() + r.x(), tp.y() + r.y(), r.width(), r.height() ); +} + +/*! \reimp */ +int TQAccessibleComboBox::navigate( NavDirection direction, int startControl ) const +{ + if ( direction != NavFirstChild && direction != NavLastChild && direction != NavFocusChild && !startControl ) + return TQAccessibleWidget::navigate( direction, startControl ); + + switch ( direction ) { + case NavFirstChild: + return 1; + break; + case NavLastChild: + return childCount(); + break; + case NavNext: + case NavRight: + return startControl + 1 > childCount() ? -1 : startControl + 1; + case NavPrevious: + case NavLeft: + return startControl -1 < 1 ? -1 : startControl - 1; + default: + break; + } + return -1; +} + +/*! \reimp */ +int TQAccessibleComboBox::childCount() const +{ + return 2; +} + +/*! \reimp */ +TQRESULT TQAccessibleComboBox::queryChild( int /*control*/, TQAccessibleInterface **iface ) const +{ + *iface = 0; + return TQS_FALSE; +} + +/*! \reimp */ +TQString TQAccessibleComboBox::text( Text t, int control ) const +{ + TQString str; + + switch ( t ) { + case Name: + if ( control < 2 ) + return stripAmp( buddyString( comboBox() ) ); + return TQComboBox::tr("Open"); + case Accelerator: + if ( control < 2 ) { + str = hotKey( buddyString( comboBox() ) ); + if ( !!str ) + return "Alt + " + str; + return str; + } + return TQComboBox::tr("Alt + Down Arrow" ); + case Value: + if ( control < 2 ) { + if ( comboBox()->editable() ) + return comboBox()->lineEdit()->text(); + return comboBox()->currentText(); + } + break; + case DefaultAction: + if ( control == 2 ) + return TQComboBox::tr("Open"); + break; + default: + str = TQAccessibleWidget::text( t, 0 ); + break; + } + return str; +} + +/*! \reimp */ +TQAccessible::Role TQAccessibleComboBox::role( int control ) const +{ + switch ( control ) { + case 0: + return ComboBox; + case 1: + if ( comboBox()->editable() ) + return EditableText; + return StaticText; + case 2: + return PushButton; + default: + return List; + } +} + +/*! \reimp */ +TQAccessible::State TQAccessibleComboBox::state( int /*control*/ ) const +{ + return TQAccessibleWidget::state( 0 ); +} + +/*! \reimp */ +bool TQAccessibleComboBox::doDefaultAction( int control ) +{ + if ( control != 2 ) + return FALSE; + comboBox()->popup(); + return TRUE; +} + +/*! + \class TQAccessibleTitleBar qaccessiblewidget.h + \brief The TQAccessibleTitleBar class implements the TQAccessibleInterface for title bars. +*/ + +/*! + Constructs a TQAccessibleComboBox object for \a o. +*/ +TQAccessibleTitleBar::TQAccessibleTitleBar( TQObject *o ) +: TQAccessibleWidget( o, ComboBox ) +{ + TQ_ASSERT(o->inherits("TQTitleBar")); +} + +/*! + Returns the title bar. +*/ +TQTitleBar *TQAccessibleTitleBar::titleBar() const +{ + return (TQTitleBar*)object(); +} + +/*! \reimp */ +int TQAccessibleTitleBar::controlAt( int x, int y ) const +{ + int ctrl = titleBar()->style().querySubControl( TQStyle::CC_TitleBar, titleBar(), titleBar()->mapFromGlobal( TQPoint( x,y ) ) ); + + switch ( ctrl ) + { + case TQStyle::SC_TitleBarSysMenu: + return 1; + case TQStyle::SC_TitleBarLabel: + return 2; + case TQStyle::SC_TitleBarMinButton: + return 3; + case TQStyle::SC_TitleBarMaxButton: + return 4; + case TQStyle::SC_TitleBarCloseButton: + return 5; + default: + break; + } + return 0; +} + +/*! \reimp */ +TQRect TQAccessibleTitleBar::rect( int control ) const +{ + if ( !control ) + return TQAccessibleWidget::rect( control ); + + TQRect r; + switch ( control ) { + case 1: + r = titleBar()->style().querySubControlMetrics( TQStyle::CC_TitleBar, titleBar(), TQStyle::SC_TitleBarSysMenu ); + break; + case 2: + r = titleBar()->style().querySubControlMetrics( TQStyle::CC_TitleBar, titleBar(), TQStyle::SC_TitleBarLabel ); + break; + case 3: + r = titleBar()->style().querySubControlMetrics( TQStyle::CC_TitleBar, titleBar(), TQStyle::SC_TitleBarMinButton ); + break; + case 4: + r = titleBar()->style().querySubControlMetrics( TQStyle::CC_TitleBar, titleBar(), TQStyle::SC_TitleBarMaxButton ); + break; + case 5: + r = titleBar()->style().querySubControlMetrics( TQStyle::CC_TitleBar, titleBar(), TQStyle::SC_TitleBarCloseButton ); + break; + default: + break; + } + + TQPoint tp = titleBar()->mapToGlobal( TQPoint( 0,0 ) ); + return TQRect( tp.x() + r.x(), tp.y() + r.y(), r.width(), r.height() ); +} + +/*! \reimp */ +int TQAccessibleTitleBar::navigate( NavDirection direction, int startControl ) const +{ + if ( direction != NavFirstChild && direction != NavLastChild && direction != NavFocusChild && !startControl ) + return TQAccessibleWidget::navigate( direction, startControl ); + + switch ( direction ) { + case NavFirstChild: + return 1; + break; + case NavLastChild: + return childCount(); + break; + case NavNext: + case NavRight: + return startControl + 1 > childCount() ? -1 : startControl + 1; + case NavPrevious: + case NavLeft: + return startControl -1 < 1 ? -1 : startControl - 1; + default: + break; + } + return -1; +} + +/*! \reimp */ +int TQAccessibleTitleBar::childCount() const +{ + return 5; +} + +/*! \reimp */ +TQRESULT TQAccessibleTitleBar::queryChild( int /*control*/, TQAccessibleInterface **iface ) const +{ + *iface = 0; + return TQS_FALSE; +} + +/*! \reimp */ +TQString TQAccessibleTitleBar::text( Text t, int control ) const +{ + TQString str = TQAccessibleWidget::text( t, control ); + if ( !!str ) + return str; + + switch ( t ) { + case Name: + switch ( control ) { + case 1: + return TQTitleBar::tr("System"); + case 3: + if ( titleBar()->window()->isMinimized() ) + return TQTitleBar::tr("Restore up"); + return TQTitleBar::tr("Minimize"); + case 4: + if ( titleBar()->window()->isMaximized() ) + return TQTitleBar::tr("Restore down"); + return TQTitleBar::tr("Maximize"); + case 5: + return TQTitleBar::tr("Close"); + default: + break; + } + break; + case Value: + if ( !control || control == 2 ) + return titleBar()->window()->caption(); + break; + case DefaultAction: + if ( control > 2 ) + return TQTitleBar::tr("Press"); + break; + case Description: + switch ( control ) { + case 1: + return TQTitleBar::tr("Contains commands to manipulate the window"); + case 3: + if ( titleBar()->window()->isMinimized() ) + return TQTitleBar::tr("Puts a minimized back to normal"); + return TQTitleBar::tr("Moves the window out of the way"); + case 4: + if ( titleBar()->window()->isMaximized() ) + return TQTitleBar::tr("Puts a maximized window back to normal"); + return TQTitleBar::tr("Makes the window full screen"); + case 5: + return TQTitleBar::tr("Closes the window"); + default: + return TQTitleBar::tr("Displays the name of the window and tqcontains controls to manipulate it"); + } + default: + break; + } + return str; +} + +/*! \reimp */ +TQAccessible::Role TQAccessibleTitleBar::role( int control ) const +{ + switch ( control ) + { + case 1: + case 3: + case 4: + case 5: + return PushButton; + default: + return TitleBar; + } +} + +/*! \reimp */ +TQAccessible::State TQAccessibleTitleBar::state( int control ) const +{ + return TQAccessibleWidget::state( control ); +} + +/*! \reimp */ +bool TQAccessibleTitleBar::doDefaultAction( int control ) +{ + switch ( control ) { + case 3: + if ( titleBar()->window()->isMinimized() ) + titleBar()->window()->showNormal(); + else + titleBar()->window()->showMinimized(); + return TRUE; + case 4: + if ( titleBar()->window()->isMaximized() ) + titleBar()->window()->showNormal(); + else + titleBar()->window()->showMaximized(); + return TRUE; + case 5: + titleBar()->window()->close(); + return TRUE; + default: + break; + } + return FALSE; +} + + +/*! + \class TQAccessibleViewport qaccessiblewidget.h + \brief The TQAccessibleViewport class hides the viewport of scrollviews for accessibility. + \internal +*/ + +TQAccessibleViewport::TQAccessibleViewport( TQObject *o, TQObject *sv ) + : TQAccessibleWidget( o ) +{ + TQ_ASSERT( sv->inherits("TQScrollView") ); + scrollview = (TQScrollView*)sv; +} + +TQAccessibleScrollView *TQAccessibleViewport::scrollView() const +{ + TQAccessibleInterface *iface = 0; + queryAccessibleInterface( scrollview, &iface ); + TQ_ASSERT(iface); + return (TQAccessibleScrollView *)iface; +} + +int TQAccessibleViewport::controlAt( int x, int y ) const +{ + int control = TQAccessibleWidget::controlAt( x, y ); + if ( control > 0 ) + return control; + + TQPoint p = widget()->mapFromGlobal( TQPoint( x,y ) ); + return scrollView()->itemAt( p.x(), p.y() ); +} + +TQRect TQAccessibleViewport::rect( int control ) const +{ + if ( !control ) + return TQAccessibleWidget::rect( control ); + TQRect rect = scrollView()->tqitemRect( control ); + TQPoint tl = widget()->mapToGlobal( TQPoint( 0,0 ) ); + return TQRect( tl.x() + rect.x(), tl.y() + rect.y(), rect.width(), rect.height() ); +} + +int TQAccessibleViewport::navigate( NavDirection direction, int startControl ) const +{ + if ( direction != NavFirstChild && direction != NavLastChild && direction != NavFocusChild && !startControl ) + return TQAccessibleWidget::navigate( direction, startControl ); + + // ### call itemUp/Down etc. here + const int items = scrollView()->itemCount(); + switch( direction ) { + case NavFirstChild: + return 1; + case NavLastChild: + return items; + case NavNext: + case NavDown: + return startControl + 1 > items ? -1 : startControl + 1; + case NavPrevious: + case NavUp: + return startControl - 1 < 1 ? -1 : startControl - 1; + default: + break; + } + + return -1; +} + +int TQAccessibleViewport::childCount() const +{ + int widgets = TQAccessibleWidget::childCount(); + return widgets ? widgets : scrollView()->itemCount(); +} + +TQString TQAccessibleViewport::text( Text t, int control ) const +{ + return scrollView()->text( t, control ); +} + +bool TQAccessibleViewport::doDefaultAction( int control ) +{ + return scrollView()->doDefaultAction( control ); +} + +TQAccessible::Role TQAccessibleViewport::role( int control ) const +{ + return scrollView()->role( control ); +} + +TQAccessible::State TQAccessibleViewport::state( int control ) const +{ + return scrollView()->state( control ); +} + +bool TQAccessibleViewport::setFocus( int control ) +{ + return scrollView()->setFocus( control ); +} + +bool TQAccessibleViewport::setSelected( int control, bool on, bool extend ) +{ + return scrollView()->setSelected( control, on, extend ); +} + +void TQAccessibleViewport::clearSelection() +{ + scrollView()->clearSelection(); +} + +TQMemArray<int> TQAccessibleViewport::selection() const +{ + return scrollView()->selection(); +} + +/*! + \class TQAccessibleScrollView qaccessiblewidget.h + \brief The TQAccessibleScrollView class implements the TQAccessibleInterface for scrolled widgets. +*/ + +/*! + Constructs a TQAccessibleScrollView object for \a o. + \a role, \a description, \a value, \a help, \a defAction and \a accelerator + are propagated to the TQAccessibleWidget constructor. +*/ +TQAccessibleScrollView::TQAccessibleScrollView( TQObject *o, Role role, TQString name, + TQString description, TQString value, TQString help, TQString defAction, TQString accelerator ) + : TQAccessibleWidget( o, role, name, description, value, help, defAction, accelerator ) +{ +} + +/*! \reimp */ +TQString TQAccessibleScrollView::text( Text t, int control ) const +{ + TQString str = TQAccessibleWidget::text( t, control ); + if ( !!str ) + return str; + switch ( t ) { + case Name: + return buddyString( widget() ); + default: + break; + } + + return str; +} + +/*! + Returns the ID of the item at viewport position \a x, \a y. +*/ +int TQAccessibleScrollView::itemAt( int /*x*/, int /*y*/ ) const +{ + return 0; +} + +/*! + Returns the location of the item with ID \a item in viewport coordinates. +*/ +TQRect TQAccessibleScrollView::tqitemRect( int /*item*/ ) const +{ + return TQRect(); +} + +/*! + Returns the number of items. +*/ +int TQAccessibleScrollView::itemCount() const +{ + return 0; +} + +/*! + \class TQAccessibleListBox qaccessiblewidget.h + \brief The TQAccessibleListBox class implements the TQAccessibleInterface for list boxes. +*/ + +/*! + Constructs a TQAccessibleListBox object for \a o. +*/ +TQAccessibleListBox::TQAccessibleListBox( TQObject *o ) + : TQAccessibleScrollView( o, List ) +{ + TQ_ASSERT(widget()->inherits("TQListBox")); +} + +/*! Returns the list box. */ +TQListBox *TQAccessibleListBox::listBox() const +{ + return (TQListBox*)widget(); +} + +/*! \reimp */ +int TQAccessibleListBox::itemAt( int x, int y ) const +{ + TQListBoxItem *item = listBox()->itemAt( TQPoint( x, y ) ); + return listBox()->index( item ) + 1; +} + +/*! \reimp */ +TQRect TQAccessibleListBox::tqitemRect( int item ) const +{ + return listBox()->tqitemRect( listBox()->item( item-1 ) ); +} + +/*! \reimp */ +int TQAccessibleListBox::itemCount() const +{ + return listBox()->count(); +} + +/*! \reimp */ +TQString TQAccessibleListBox::text( Text t, int control ) const +{ + if ( !control || t != Name ) + return TQAccessibleScrollView::text( t, control ); + + TQListBoxItem *item = listBox()->item( control - 1 ); + if ( item ) + return item->text(); + return TQString::null; +} + +/*! \reimp */ +TQAccessible::Role TQAccessibleListBox::role( int control ) const +{ + if ( !control ) + return TQAccessibleScrollView::role( control ); + return ListItem; +} + +/*! \reimp */ +TQAccessible::State TQAccessibleListBox::state( int control ) const +{ + int state = TQAccessibleScrollView::state( control ); + TQListBoxItem *item; + if ( !control || !( item = listBox()->item( control - 1 ) ) ) + return (State)state; + + if ( item->isSelectable() ) { + if ( listBox()->selectionMode() == TQListBox::Multi ) + state |= MultiSelectable; + else if ( listBox()->selectionMode() == TQListBox::Extended ) + state |= ExtSelectable; + else if ( listBox()->selectionMode() == TQListBox::Single ) + state |= Selectable; + if ( item->isSelected() ) + state |= Selected; + } + if ( listBox()->focusPolicy() != TQWidget::NoFocus ) { + state |= Focusable; + if ( item->isCurrent() ) + state |= Focused; + } + if ( !listBox()->itemVisible( item ) ) + state |= Invisible; + + return (State)state; +} + +/*! \reimp */ +bool TQAccessibleListBox::setFocus( int control ) +{ + bool res = TQAccessibleScrollView::setFocus( 0 ); + if ( !control || !res ) + return res; + + TQListBoxItem *item = listBox()->item( control -1 ); + if ( !item ) + return FALSE; + listBox()->setCurrentItem( item ); + return TRUE; +} + +/*! \reimp */ +bool TQAccessibleListBox::setSelected( int control, bool on, bool extend ) +{ + if ( !control || ( extend && + listBox()->selectionMode() != TQListBox::Extended && + listBox()->selectionMode() != TQListBox::Multi ) ) + return FALSE; + + TQListBoxItem *item = listBox()->item( control -1 ); + if ( !item ) + return FALSE; + if ( !extend ) { + listBox()->setSelected( item, on ); + } else { + int current = listBox()->currentItem(); + bool down = control > current; + for ( int i = current; i != control;) { + down ? i++ : i--; + listBox()->setSelected( i, on ); + } + + } + return TRUE; +} + +/*! \reimp */ +void TQAccessibleListBox::clearSelection() +{ + listBox()->clearSelection(); +} + +/*! \reimp */ +TQMemArray<int> TQAccessibleListBox::selection() const +{ + TQMemArray<int> array; + uint size = 0; + const uint c = listBox()->count(); + array.resize( c ); + for ( uint i = 0; i < c; ++i ) { + if ( listBox()->isSelected( i ) ) { + ++size; + array[ (int)size-1 ] = i+1; + } + } + array.resize( size ); + return array; +} + +/*! + \class TQAccessibleListView qaccessiblewidget.h + \brief The TQAccessibleListView class implements the TQAccessibleInterface for list views. +*/ + +static TQListViewItem *tqfindLVItem( TQListView* listView, int control ) +{ + int id = 1; + TQListViewItemIterator it( listView ); + TQListViewItem *item = it.current(); + while ( item && id < control ) { + ++it; + ++id; + item = it.current(); + } + return item; +} + +/*! + Constructs a TQAccessibleListView object for \a o. +*/ +TQAccessibleListView::TQAccessibleListView( TQObject *o ) + : TQAccessibleScrollView( o, Outline ) +{ +} + +/*! Returns the list view. */ +TQListView *TQAccessibleListView::listView() const +{ + TQ_ASSERT(widget()->inherits("TQListView")); + return (TQListView*)widget(); +} + +/*! \reimp */ +int TQAccessibleListView::itemAt( int x, int y ) const +{ + TQListViewItem *item = listView()->itemAt( TQPoint( x, y ) ); + if ( !item ) + return 0; + + TQListViewItemIterator it( listView() ); + int c = 1; + while ( it.current() ) { + if ( it.current() == item ) + return c; + ++c; + ++it; + } + return 0; +} + +/*! \reimp */ +TQRect TQAccessibleListView::tqitemRect( int control ) const +{ + TQListViewItem *item = tqfindLVItem( listView(), control ); + if ( !item ) + return TQRect(); + return listView()->tqitemRect( item ); +} + +/*! \reimp */ +int TQAccessibleListView::itemCount() const +{ + TQListViewItemIterator it( listView() ); + int c = 0; + while ( it.current() ) { + ++c; + ++it; + } + + return c; +} + +/*! \reimp */ +TQString TQAccessibleListView::text( Text t, int control ) const +{ + if ( !control || t != Name ) + return TQAccessibleScrollView::text( t, control ); + + TQListViewItem *item = tqfindLVItem( listView(), control ); + if ( !item ) + return TQString::null; + return item->text( 0 ); +} + +/*! \reimp */ +TQAccessible::Role TQAccessibleListView::role( int control ) const +{ + if ( !control ) + return TQAccessibleScrollView::role( control ); + return OutlineItem; +} + +/*! \reimp */ +TQAccessible::State TQAccessibleListView::state( int control ) const +{ + int state = TQAccessibleScrollView::state( control ); + TQListViewItem *item; + if ( !control || !( item = tqfindLVItem( listView(), control ) ) ) + return (State)state; + + if ( item->isSelectable() ) { + if ( listView()->selectionMode() == TQListView::Multi ) + state |= MultiSelectable; + else if ( listView()->selectionMode() == TQListView::Extended ) + state |= ExtSelectable; + else if ( listView()->selectionMode() == TQListView::Single ) + state |= Selectable; + if ( item->isSelected() ) + state |= Selected; + } + if ( listView()->focusPolicy() != TQWidget::NoFocus ) { + state |= Focusable; + if ( item == listView()->currentItem() ) + state |= Focused; + } + if ( item->childCount() ) { + if ( item->isOpen() ) + state |= Expanded; + else + state |= Collapsed; + } + if ( !listView()->tqitemRect( item ).isValid() ) + state |= Invisible; + + if ( item->rtti() == TQCheckListItem::RTTI ) { + if ( ((TQCheckListItem*)item)->isOn() ) + state|=Checked; + } + return (State)state; +} + +/*! \reimp +TQAccessibleInterface *TQAccessibleListView::focusChild( int *control ) const +{ + TQListViewItem *item = listView()->currentItem(); + if ( !item ) + return 0; + + TQListViewItemIterator it( listView() ); + int c = 1; + while ( it.current() ) { + if ( it.current() == item ) { + *control = c; + return (TQAccessibleInterface*)this; + } + ++c; + ++it; + } + return 0; +} +*/ +/*! \reimp */ +bool TQAccessibleListView::setFocus( int control ) +{ + bool res = TQAccessibleScrollView::setFocus( 0 ); + if ( !control || !res ) + return res; + + TQListViewItem *item = tqfindLVItem( listView(), control ); + if ( !item ) + return FALSE; + listView()->setCurrentItem( item ); + return TRUE; +} + +/*! \reimp */ +bool TQAccessibleListView::setSelected( int control, bool on, bool extend ) +{ + if ( !control || ( extend && + listView()->selectionMode() != TQListView::Extended && + listView()->selectionMode() != TQListView::Multi ) ) + return FALSE; + + TQListViewItem *item = tqfindLVItem( listView(), control ); + if ( !item ) + return FALSE; + if ( !extend ) { + listView()->setSelected( item, on ); + } else { + TQListViewItem *current = listView()->currentItem(); + if ( !current ) + return FALSE; + bool down = item->itemPos() > current->itemPos(); + TQListViewItemIterator it( current ); + while ( it.current() ) { + listView()->setSelected( it.current(), on ); + if ( it.current() == item ) + break; + if ( down ) + ++it; + else + --it; + } + } + return TRUE; +} + +/*! \reimp */ +void TQAccessibleListView::clearSelection() +{ + listView()->clearSelection(); +} + +/*! \reimp */ +TQMemArray<int> TQAccessibleListView::selection() const +{ + TQMemArray<int> array; + uint size = 0; + int id = 1; + array.resize( size ); + TQListViewItemIterator it( listView() ); + while ( it.current() ) { + if ( it.current()->isSelected() ) { + ++size; + array.resize( size ); + array[ (int)size-1 ] = id; + } + ++it; + ++id; + } + return array; +} + +#ifndef TQT_NO_ICONVIEW +/*! + \class TQAccessibleIconView qaccessiblewidget.h + \brief The TQAccessibleIconView class implements the TQAccessibleInterface for icon views. +*/ + +static TQIconViewItem *tqfindIVItem( TQIconView *iconView, int control ) +{ + int id = 1; + TQIconViewItem *item = iconView->firstItem(); + while ( item && id < control ) { + item = item->nextItem(); + ++id; + } + + return item; +} + +/*! + Constructs a TQAccessibleIconView object for \a o. +*/ +TQAccessibleIconView::TQAccessibleIconView( TQObject *o ) + : TQAccessibleScrollView( o, Outline ) +{ + TQ_ASSERT(widget()->inherits("TQIconView")); +} + +/*! Returns the icon view. */ +TQIconView *TQAccessibleIconView::iconView() const +{ + return (TQIconView*)widget(); +} + +/*! \reimp */ +int TQAccessibleIconView::itemAt( int x, int y ) const +{ + TQIconViewItem *item = iconView()->tqfindItem( TQPoint( x, y ) ); + return iconView()->index( item ) + 1; +} + +/*! \reimp */ +TQRect TQAccessibleIconView::tqitemRect( int control ) const +{ + TQIconViewItem *item = tqfindIVItem( iconView(), control ); + + if ( !item ) + return TQRect(); + return item->rect(); +} + +/*! \reimp */ +int TQAccessibleIconView::itemCount() const +{ + return iconView()->count(); +} + +/*! \reimp */ +TQString TQAccessibleIconView::text( Text t, int control ) const +{ + if ( !control || t != Name ) + return TQAccessibleScrollView::text( t, control ); + + TQIconViewItem *item = tqfindIVItem( iconView(), control ); + if ( !item ) + return TQString::null; + return item->text(); +} + +/*! \reimp */ +TQAccessible::Role TQAccessibleIconView::role( int control ) const +{ + if ( !control ) + return TQAccessibleScrollView::role( control ); + return OutlineItem; +} + +/*! \reimp */ +TQAccessible::State TQAccessibleIconView::state( int control ) const +{ + int state = TQAccessibleScrollView::state( control ); + TQIconViewItem *item; + if ( !control || !( item = tqfindIVItem( iconView(), control ) ) ) + return (State)state; + + if ( item->isSelectable() ) { + if ( iconView()->selectionMode() == TQIconView::Multi ) + state |= MultiSelectable; + else if ( iconView()->selectionMode() == TQIconView::Extended ) + state |= ExtSelectable; + else if ( iconView()->selectionMode() == TQIconView::Single ) + state |= Selectable; + if ( item->isSelected() ) + state |= Selected; + } + if ( iconView()->itemsMovable() ) + state |= Moveable; + if ( iconView()->focusPolicy() != TQWidget::NoFocus ) { + state |= Focusable; + if ( item == iconView()->currentItem() ) + state |= Focused; + } + + return (State)state; +} + +/*! \reimp +TQAccessibleInterface *TQAccessibleIconView::focusChild( int *control ) const +{ + TQIconViewItem *item = iconView()->currentItem(); + if ( !item ) + return 0; + + *control = iconView()->index( item ); + return (TQAccessibleInterface*)this; +} +*/ +/*! \reimp */ +bool TQAccessibleIconView::setFocus( int control ) +{ + bool res = TQAccessibleScrollView::setFocus( 0 ); + if ( !control || !res ) + return res; + + TQIconViewItem *item = tqfindIVItem( iconView(), control ); + if ( !item ) + return FALSE; + iconView()->setCurrentItem( item ); + return TRUE; +} + +/*! \reimp */ +bool TQAccessibleIconView::setSelected( int control, bool on, bool extend ) +{ + if ( !control || ( extend && + iconView()->selectionMode() != TQIconView::Extended && + iconView()->selectionMode() != TQIconView::Multi ) ) + return FALSE; + + TQIconViewItem *item = tqfindIVItem( iconView(), control ); + if ( !item ) + return FALSE; + if ( !extend ) { + iconView()->setSelected( item, on, TRUE ); + } else { + TQIconViewItem *current = iconView()->currentItem(); + if ( !current ) + return FALSE; + bool down = FALSE; + TQIconViewItem *temp = current; + while ( ( temp = temp->nextItem() ) ) { + if ( temp == item ) { + down = TRUE; + break; + } + } + temp = current; + if ( down ) { + while ( ( temp = temp->nextItem() ) ) { + iconView()->setSelected( temp, on, TRUE ); + if ( temp == item ) + break; + } + } else { + while ( ( temp = temp->prevItem() ) ) { + iconView()->setSelected( temp, on, TRUE ); + if ( temp == item ) + break; + } + } + } + return TRUE; +} + +/*! \reimp */ +void TQAccessibleIconView::clearSelection() +{ + iconView()->clearSelection(); +} + +/*! \reimp */ +TQMemArray<int> TQAccessibleIconView::selection() const +{ + TQMemArray<int> array; + uint size = 0; + int id = 1; + array.resize( iconView()->count() ); + TQIconViewItem *item = iconView()->firstItem(); + while ( item ) { + if ( item->isSelected() ) { + ++size; + array[ (int)size-1 ] = id; + } + item = item->nextItem(); + ++id; + } + array.resize( size ); + return array; +} +#endif + + +/*! + \class TQAccessibleTextEdit qaccessiblewidget.h + \brief The TQAccessibleTextEdit class implements the TQAccessibleInterface for richtext editors. +*/ + +/*! + Constructs a TQAccessibleTextEdit object for \a o. +*/ +TQAccessibleTextEdit::TQAccessibleTextEdit( TQObject *o ) +: TQAccessibleScrollView( o, Pane ) +{ + TQ_ASSERT(widget()->inherits("TQTextEdit")); +} + +/*! Returns the text edit. */ +TQTextEdit *TQAccessibleTextEdit::textEdit() const +{ + + return (TQTextEdit*)widget(); +} + +/*! \reimp */ +int TQAccessibleTextEdit::itemAt( int x, int y ) const +{ + int p; + TQPoint cp = textEdit()->viewportToContents( TQPoint( x,y ) ); + textEdit()->charAt( cp , &p ); + return p + 1; +} + +/*! \reimp */ +TQRect TQAccessibleTextEdit::tqitemRect( int item ) const +{ + TQRect rect = textEdit()->paragraphRect( item - 1 ); + if ( !rect.isValid() ) + return TQRect(); + TQPoint ntl = textEdit()->contentsToViewport( TQPoint( rect.x(), rect.y() ) ); + return TQRect( ntl.x(), ntl.y(), rect.width(), rect.height() ); +} + +/*! \reimp */ +int TQAccessibleTextEdit::itemCount() const +{ + return textEdit()->paragraphs(); +} + +/*! \reimp */ +TQString TQAccessibleTextEdit::text( Text t, int control ) const +{ + if (t == Name) { + if (control) + return textEdit()->text(control - 1); + else + return stripAmp(buddyString(widget())); + } else if (t == Value) { + if (control) + return textEdit()->text(control - 1); + else + return textEdit()->text(); + } + + return TQAccessibleScrollView::text( t, control ); +} + +/*! \reimp */ +void TQAccessibleTextEdit::setText(Text t, int control, const TQString &text) +{ + if (control || t != Value) { + TQAccessibleScrollView::setText(t, control, text); + return; + } + textEdit()->setText(text); +} + +/*! \reimp */ +TQAccessible::Role TQAccessibleTextEdit::role( int control ) const +{ + if ( control ) + return EditableText; + return TQAccessibleScrollView::role( control ); +} diff --git a/tqtinterface/qt4/plugins/src/accessible/widgets/qaccessiblewidget.h b/tqtinterface/qt4/plugins/src/accessible/widgets/qaccessiblewidget.h new file mode 100644 index 0000000..2effd69 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/accessible/widgets/qaccessiblewidget.h @@ -0,0 +1,412 @@ +#ifndef TQACCESSIBLEWIDGET_H +#define TQACCESSIBLEWIDGET_H + +#include <tqaccessible.h> + +class TQButton; +class TQScrollView; +class TQHeader; +class TQSpinWidget; +class TQScrollBar; +class TQSlider; +class TQListBox; +class TQListView; +class TQTextEdit; +class TQTabBar; +class TQComboBox; +class TQTitleBar; +class TQWidgetStack; + +#ifndef TQT_NO_ICONVIEW +class TQIconView; +#endif + + +TQString buddyString( TQWidget * ); +TQString stripAmp( const TQString& ); +TQString hotKey( const TQString& ); + +class TQAccessibleWidget : public TQAccessibleObject +{ +public: + TQAccessibleWidget( TQObject *o, Role r = Client, TQString name = TQString::null, + TQString description = TQString::null, TQString value = TQString::null, + TQString help = TQString::null, TQString defAction = TQString::null, + TQString accelerator = TQString::null, State s = Normal ); + + ~TQAccessibleWidget(); + + int controlAt( int x, int y ) const; + TQRect rect( int control ) const; + int navigate( NavDirection direction, int startControl ) const; + int childCount() const; + TQRESULT queryChild( int control, TQAccessibleInterface ** ) const; + TQRESULT queryParent( TQAccessibleInterface ** ) const; + + TQString text( Text t, int control ) const; + void setText( Text t, int control, const TQString &text ); + Role role( int control ) const; + State state( int control ) const; + + bool doDefaultAction( int control ); + bool setFocus( int control ); + bool setSelected( int control, bool on, bool extend ); + void clearSelection(); + TQMemArray<int> selection() const; + + static ulong objects; + +protected: + TQWidget *widget() const; + +private: + Role role_; + State state_; + TQString name_; + TQString description_; + TQString value_; + TQString help_; + TQString defAction_; + TQString accelerator_; +}; + +class TQAccessibleWidgetStack : public TQAccessibleWidget +{ +public: + TQAccessibleWidgetStack( TQObject *o ); + + int controlAt( int x, int y ) const; + TQRESULT queryChild( int control, TQAccessibleInterface ** ) const; + +protected: + TQWidgetStack *widgetStack() const; +}; + +class TQAccessibleButton : public TQAccessibleWidget +{ +public: + TQAccessibleButton( TQObject *o, Role r, TQString description = TQString::null, + TQString help = TQString::null ); + + TQString text( Text t, int control ) const; + State state( int control ) const; + + bool doDefaultAction( int control ); + +protected: + TQButton *button() const; +}; + +class TQAccessibleRangeControl : public TQAccessibleWidget +{ +public: + TQAccessibleRangeControl( TQObject *o, Role role, TQString name = TQString::null, + TQString description = TQString::null, TQString help = TQString::null, + TQString defAction = TQString::null, TQString accelerator = TQString::null ); + + TQString text( Text t, int control ) const; +}; + +class TQAccessibleSpinWidget : public TQAccessibleRangeControl +{ +public: + TQAccessibleSpinWidget( TQObject *o ); + + int controlAt( int x, int y ) const; + TQRect rect( int control ) const; + int navigate( NavDirection direction, int startControl ) const; + int childCount() const; + TQRESULT queryChild( int control, TQAccessibleInterface ** ) const; + + TQString text( Text t, int control ) const; + Role role( int control ) const; + State state( int control ) const; + + bool doDefaultAction( int control ); +}; + +class TQAccessibleScrollBar : public TQAccessibleRangeControl +{ +public: + TQAccessibleScrollBar( TQObject *o, TQString name = TQString::null, + TQString description = TQString::null, TQString help = TQString::null, + TQString defAction = TQString::null, TQString accelerator = TQString::null ); + + int controlAt( int x, int y ) const; + TQRect rect( int control ) const; + int navigate( NavDirection direction, int startControl ) const; + int childCount() const; + TQRESULT queryChild( int control, TQAccessibleInterface ** ) const; + + TQString text( Text t, int control ) const; + Role role( int control ) const; + + bool doDefaultAction( int control ); + +protected: + TQScrollBar *scrollBar() const; +}; + +class TQAccessibleSlider : public TQAccessibleRangeControl +{ +public: + TQAccessibleSlider( TQObject *o, TQString name = TQString::null, + TQString description = TQString::null, TQString help = TQString::null, + TQString defAction = TQString::null, TQString accelerator = TQString::null ); + + int controlAt( int x, int y ) const; + TQRect rect( int control ) const; + int navigate( NavDirection direction, int startControl ) const; + int childCount() const; + TQRESULT queryChild( int control, TQAccessibleInterface ** ) const; + + TQString text( Text t, int control ) const; + Role role( int control ) const; + + bool doDefaultAction( int control ); + +protected: + TQSlider *slider() const; +}; + +class TQAccessibleText : public TQAccessibleWidget +{ +public: + TQAccessibleText( TQObject *o, Role role, TQString name = TQString::null, + TQString description = TQString::null, TQString help = TQString::null, + TQString defAction = TQString::null, TQString accelerator = TQString::null ); + + TQString text( Text t, int control ) const; + State state( int control ) const; + void setText(Text t, int control, const TQString &text); +}; + +class TQAccessibleDisplay : public TQAccessibleWidget +{ +public: + TQAccessibleDisplay( TQObject *o, Role role, TQString description = TQString::null, + TQString value = TQString::null, TQString help = TQString::null, + TQString defAction = TQString::null, TQString accelerator = TQString::null ); + + TQString text( Text t, int control ) const; + Role role( int control ) const; +}; + +class TQAccessibleHeader : public TQAccessibleWidget +{ +public: + TQAccessibleHeader( TQObject *o, TQString description = TQString::null, + TQString value = TQString::null, TQString help = TQString::null, + TQString defAction = TQString::null, TQString accelerator = TQString::null ); + + int controlAt( int x, int y ) const; + TQRect rect( int control ) const; + int navigate( NavDirection direction, int startControl ) const; + int childCount() const; + TQRESULT queryChild( int control, TQAccessibleInterface ** ) const; + + TQString text( Text t, int control ) const; + + Role role( int control ) const; + State state( int control ) const; + +protected: + TQHeader *header() const; +}; + +class TQAccessibleTabBar : public TQAccessibleWidget +{ +public: + TQAccessibleTabBar( TQObject *o, TQString description = TQString::null, + TQString value = TQString::null, TQString help = TQString::null, + TQString defAction = TQString::null, TQString accelerator = TQString::null ); + + int controlAt( int x, int y ) const; + TQRect rect( int control ) const; + int navigate( NavDirection direction, int startControl ) const; + int childCount() const; + TQRESULT queryChild( int control, TQAccessibleInterface ** ) const; + + TQString text( Text t, int control ) const; + + Role role( int control ) const; + State state( int control ) const; + + bool doDefaultAction( int control ); + bool setSelected( int control, bool on, bool extend ); + void clearSelection(); + TQMemArray<int> selection() const; + +protected: + TQTabBar *tabBar() const; +}; + +class TQAccessibleComboBox : public TQAccessibleWidget +{ +public: + TQAccessibleComboBox( TQObject *o ); + + int controlAt( int x, int y ) const; + TQRect rect( int control ) const; + int navigate( NavDirection direction, int startControl ) const; + int childCount() const; + TQRESULT queryChild( int control, TQAccessibleInterface ** ) const; + + TQString text( Text t, int control ) const; + + Role role( int control ) const; + State state( int control ) const; + + bool doDefaultAction( int control ); + +protected: + TQComboBox *comboBox() const; +}; + +class TQAccessibleTitleBar : public TQAccessibleWidget +{ +public: + TQAccessibleTitleBar( TQObject *o ); + + int controlAt( int x, int y ) const; + TQRect rect( int control ) const; + int navigate( NavDirection direction, int startControl ) const; + int childCount() const; + TQRESULT queryChild( int control, TQAccessibleInterface ** ) const; + + TQString text( Text t, int control ) const; + Role role( int control ) const; + State state( int control ) const; + + bool doDefaultAction( int control ); + +protected: + TQTitleBar *titleBar() const; +}; + +class TQAccessibleScrollView : public TQAccessibleWidget +{ +public: + TQAccessibleScrollView( TQObject *o, Role role, TQString name = TQString::null, + TQString description = TQString::null, TQString value = TQString::null, + TQString help = TQString::null, TQString defAction = TQString::null, + TQString accelerator = TQString::null ); + + TQString text( Text t, int control ) const; + + virtual int itemAt( int x, int y ) const; + virtual TQRect tqitemRect( int item ) const; + virtual int itemCount() const; +}; + +class TQAccessibleViewport : public TQAccessibleWidget +{ +public: + TQAccessibleViewport( TQObject *o, TQObject *sv ); + + int controlAt( int x, int y ) const; + TQRect rect( int control ) const; + int navigate( NavDirection direction, int startControl ) const; + int childCount() const; + + TQString text( Text t, int control ) const; + Role role( int control ) const; + State state( int control ) const; + + bool doDefaultAction( int control ); + bool setFocus( int control ); + bool setSelected( int control, bool on, bool extend ); + void clearSelection(); + TQMemArray<int> selection() const; + +protected: + TQAccessibleScrollView *scrollView() const; + TQScrollView *scrollview; +}; + +class TQAccessibleListBox : public TQAccessibleScrollView +{ +public: + TQAccessibleListBox( TQObject *o ); + + int itemAt( int x, int y ) const; + TQRect tqitemRect( int item ) const; + int itemCount() const; + + TQString text( Text t, int control ) const; + Role role( int control ) const; + State state( int control ) const; + + bool setFocus( int control ); + bool setSelected( int control, bool on, bool extend ); + void clearSelection(); + TQMemArray<int> selection() const; + +protected: + TQListBox *listBox() const; +}; + +class TQAccessibleListView : public TQAccessibleScrollView +{ +public: + TQAccessibleListView( TQObject *o ); + + int itemAt( int x, int y ) const; + TQRect tqitemRect( int item ) const; + int itemCount() const; + + TQString text( Text t, int control ) const; + Role role( int control ) const; + State state( int control ) const; + + bool setFocus( int control ); + bool setSelected( int control, bool on, bool extend ); + void clearSelection(); + TQMemArray<int> selection() const; + +protected: + TQListView *listView() const; +}; + +#ifndef TQT_NO_ICONVIEW +class TQAccessibleIconView : public TQAccessibleScrollView +{ +public: + TQAccessibleIconView( TQObject *o ); + + int itemAt( int x, int y ) const; + TQRect tqitemRect( int item ) const; + int itemCount() const; + + TQString text( Text t, int control ) const; + Role role( int control ) const; + State state( int control ) const; + + bool setFocus( int control ); + bool setSelected( int control, bool on, bool extend ); + void clearSelection(); + TQMemArray<int> selection() const; + +protected: + TQIconView *iconView() const; +}; +#endif + +class TQAccessibleTextEdit : public TQAccessibleScrollView +{ +public: + TQAccessibleTextEdit( TQObject *o ); + + int itemAt( int x, int y ) const; + TQRect tqitemRect( int item ) const; + int itemCount() const; + + TQString text( Text t, int control ) const; + void setText(Text t, int control, const TQString &text); + Role role( int control ) const; + +protected: + TQTextEdit *textEdit() const; +}; + +#endif // TQ_ACESSIBLEWIDGET_H diff --git a/tqtinterface/qt4/plugins/src/accessible/widgets/widgets.pro b/tqtinterface/qt4/plugins/src/accessible/widgets/widgets.pro new file mode 100644 index 0000000..4103ac3 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/accessible/widgets/widgets.pro @@ -0,0 +1,15 @@ +TEMPLATE = lib +TARGET += qtwidgets + +CONFIG += qt dll plugin +DESTDIR = ../../../accessible +VERSION = 1.0.0 + +REQUIRES += accessibility + +SOURCES += main.cpp \ + qaccessiblewidget.cpp \ + qaccessiblemenu.cpp + +HEADERS += qaccessiblewidget.h \ + qaccessiblemenu.h diff --git a/tqtinterface/qt4/plugins/src/codecs/cn/cn.pro b/tqtinterface/qt4/plugins/src/codecs/cn/cn.pro new file mode 100644 index 0000000..340df17 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/codecs/cn/cn.pro @@ -0,0 +1,18 @@ +TEMPLATE = lib +TARGET = qcncodecs + +CONFIG += qt warn_on plugin +DESTDIR = ../../../codecs + +REQUIRES = !bigcodecs + +HEADERS = ../../../../include/tqgb18030codec.h \ + ../../../../include/private/tqfontcodecs_p.h + +SOURCES = ../../../../src/codecs/tqgb18030codec.cpp \ + ../../../../src/codecs/tqfontcncodec.cpp \ + main.cpp + + +target.path += $$plugins.path/codecs +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/codecs/cn/main.cpp b/tqtinterface/qt4/plugins/src/codecs/cn/main.cpp new file mode 100644 index 0000000..3c9064c --- /dev/null +++ b/tqtinterface/qt4/plugins/src/codecs/cn/main.cpp @@ -0,0 +1,52 @@ +#include <tqtextcodecplugin.h> +#include <tqtextcodec.h> +#include <tqptrlist.h> +#include <tqapplication.h> + +#include <tqgb18030codec.h> +#include <private/tqfontcodecs_p.h> + + +class CNTextCodecs : public TQTextCodecPlugin +{ +public: + CNTextCodecs() {} + + TQStringList names() const { return TQStringList() << "GB18030" << "GBK" << "gb2312.1980-0" << "gbk-0"; } + TQValueList<int> mibEnums() const { return TQValueList<int>() << -2025 << 57 << 2025; } + + TQTextCodec *createForMib( int ); + TQTextCodec *createForName( const TQString & ); +}; + +TQTextCodec *CNTextCodecs::createForMib( int mib ) +{ + switch (mib) { + case 57: + return new TQGb2312Codec; + case 2025: + return new TQGbkCodec; + case -2025: + return new TQGb18030Codec; + default: + ; + } + + return 0; +} + + +TQTextCodec *CNTextCodecs::createForName( const TQString &name ) +{ + if (name == "GB18030") + return new TQGb18030Codec; + if (name == "GBK" || name == "gbk-0") + return new TQGbkCodec; + if (name == "gb2312.1980-0") + return new TQGb2312Codec; + + return 0; +} + + +TQ_EXPORT_PLUGIN( CNTextCodecs ); diff --git a/tqtinterface/qt4/plugins/src/codecs/codecs.pro b/tqtinterface/qt4/plugins/src/codecs/codecs.pro new file mode 100644 index 0000000..41775f7 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/codecs/codecs.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs + +!bigcodecs { + SUBDIRS += cn jp kr tw +} diff --git a/tqtinterface/qt4/plugins/src/codecs/jp/jp.pro b/tqtinterface/qt4/plugins/src/codecs/jp/jp.pro new file mode 100644 index 0000000..98ddbaa --- /dev/null +++ b/tqtinterface/qt4/plugins/src/codecs/jp/jp.pro @@ -0,0 +1,25 @@ +TEMPLATE = lib +TARGET = qjpcodecs + +CONFIG += qt warn_on plugin +DESTDIR = ../../../codecs + +REQUIRES = !bigcodecs + +HEADERS = ../../../../include/tqeucjpcodec.h \ + ../../../../include/tqjiscodec.h \ + ../../../../include/tqsjiscodec.h \ + ../../../../include/tqjpunicode.h \ + ../../../../include/private/tqfontcodecs_p.h + +SOURCES = ../../../../src/codecs/tqeucjpcodec.cpp \ + ../../../../src/codecs/tqjiscodec.cpp \ + ../../../../src/codecs/tqsjiscodec.cpp \ + ../../../../src/codecs/tqjpunicode.cpp \ + ../../../../src/codecs/tqfontjpcodec.cpp \ + main.cpp + + +target.path += $$plugins.path/codecs +INSTALLS += target + diff --git a/tqtinterface/qt4/plugins/src/codecs/jp/main.cpp b/tqtinterface/qt4/plugins/src/codecs/jp/main.cpp new file mode 100644 index 0000000..8b0f8f9 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/codecs/jp/main.cpp @@ -0,0 +1,56 @@ +#include <tqtextcodecplugin.h> +#include <tqtextcodec.h> +#include <tqptrlist.h> + +#include <tqeucjpcodec.h> +#include <tqjiscodec.h> +#include <tqsjiscodec.h> +#include <private/tqfontcodecs_p.h> + + +class JPTextCodecs : public TQTextCodecPlugin +{ +public: + JPTextCodecs() {} + + TQStringList names() const { return TQStringList() << "eucJP" << "JIS7" << "SJIS" << "jisx0208.1983-0"; } + TQValueList<int> mibEnums() const { return TQValueList<int>() << 16 << 17 << 18 << 63; } + TQTextCodec *createForMib( int ); + TQTextCodec *createForName( const TQString & ); +}; + +TQTextCodec *JPTextCodecs::createForMib( int mib ) +{ + switch (mib) { + case 16: + return new TQJisCodec; + case 17: + return new TQSjisCodec; + case 18: + return new TQEucJpCodec; + case 63: + return new TQFontJis0208Codec; + default: + ; + } + + return 0; +} + + +TQTextCodec *JPTextCodecs::createForName( const TQString &name ) +{ + if (name == "JIS7") + return new TQJisCodec; + if (name == "SJIS") + return new TQSjisCodec; + if (name == "eucJP") + return new TQEucJpCodec; + if (name == "jisx0208.1983-0") + return new TQFontJis0208Codec; + + return 0; +} + + +TQ_EXPORT_PLUGIN( JPTextCodecs ); diff --git a/tqtinterface/qt4/plugins/src/codecs/kr/kr.pro b/tqtinterface/qt4/plugins/src/codecs/kr/kr.pro new file mode 100644 index 0000000..44c9109 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/codecs/kr/kr.pro @@ -0,0 +1,19 @@ +TEMPLATE = lib +TARGET = qkrcodecs + +CONFIG += qt warn_on plugin +DESTDIR = ../../../codecs + +REQUIRES = !bigcodecs + +HEADERS = ../../../../include/tqeuckrcodec.h \ + ../../../../include/private/tqfontcodecs_p.h + +SOURCES = ../../../../src/codecs/tqeuckrcodec.cpp \ + ../../../../src/codecs/tqfontkrcodec.cpp \ + main.cpp + + +target.path += $$plugins.path/codecs +INSTALLS += target + diff --git a/tqtinterface/qt4/plugins/src/codecs/kr/main.cpp b/tqtinterface/qt4/plugins/src/codecs/kr/main.cpp new file mode 100644 index 0000000..fa76ad5 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/codecs/kr/main.cpp @@ -0,0 +1,47 @@ +#include <tqtextcodecplugin.h> +#include <tqtextcodec.h> +#include <tqptrlist.h> + +#include <tqeuckrcodec.h> +#include <private/tqfontcodecs_p.h> + + +class KRTextCodecs : public TQTextCodecPlugin +{ +public: + KRTextCodecs() {} + + TQStringList names() const { return TQStringList() << "eucKR" << "ksc5601.1987-0"; } + TQValueList<int> mibEnums() const { return TQValueList<int>() << 38 << 36; } + TQTextCodec *createForMib( int ); + TQTextCodec *createForName( const TQString & ); +}; + + +TQTextCodec *KRTextCodecs::createForMib( int mib ) +{ + switch (mib) { + case 36: + return new TQFontKsc5601Codec; + case 38: + return new TQEucKrCodec; + default: + ; + } + + return 0; +} + + +TQTextCodec *KRTextCodecs::createForName( const TQString &name ) +{ + if (name == "eucKR") + return new TQEucKrCodec; + if (name == "ksc5601.1987-0") + return new TQFontKsc5601Codec; + + return 0; +} + + +TQ_EXPORT_PLUGIN( KRTextCodecs ); diff --git a/tqtinterface/qt4/plugins/src/codecs/tw/main.cpp b/tqtinterface/qt4/plugins/src/codecs/tw/main.cpp new file mode 100644 index 0000000..6991b33 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/codecs/tw/main.cpp @@ -0,0 +1,47 @@ +#include <tqtextcodecplugin.h> +#include <tqtextcodec.h> +#include <tqptrlist.h> + +#include <tqbig5codec.h> +#include <private/tqfontcodecs_p.h> + + +class TWTextCodecs : public TQTextCodecPlugin +{ +public: + TWTextCodecs() {} + + TQStringList names() const { return TQStringList() << "Big5" << "big5*-0"; } + TQValueList<int> mibEnums() const { return TQValueList<int>() << 2026 << -2026; } + TQTextCodec *createForMib( int ); + TQTextCodec *createForName( const TQString & ); +}; + +TQTextCodec *TWTextCodecs::createForMib( int mib ) +{ + switch (mib) { + case -2026: + return new TQFontBig5Codec; + case 2026: + return new TQBig5Codec; + default: + ; + } + + return 0; +} + + +TQTextCodec *TWTextCodecs::createForName( const TQString &name ) +{ + if (name == "Big5") + return new TQBig5Codec; + if (name == "big5*-0") + return new TQFontBig5Codec; + + return 0; +} + + +TQ_EXPORT_PLUGIN( TWTextCodecs ); + diff --git a/tqtinterface/qt4/plugins/src/codecs/tw/tw.pro b/tqtinterface/qt4/plugins/src/codecs/tw/tw.pro new file mode 100644 index 0000000..da264b7 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/codecs/tw/tw.pro @@ -0,0 +1,18 @@ +TEMPLATE = lib +TARGET = qtwcodecs + +CONFIG += qt warn_on plugin +DESTDIR = ../../../codecs + +REQUIRES = !bigcodecs + +HEADERS = ../../../../include/tqbig5codec.h \ + ../../../../include/private/tqfontcodecs_p.h +SOURCES = ../../../../src/codecs/tqbig5codec.cpp \ + ../../../../src/codecs/tqfonttwcodec.cpp \ + main.cpp + + +target.path += $$plugins.path/codecs +INSTALLS += target + diff --git a/tqtinterface/qt4/plugins/src/imageformats/imageformats.pro b/tqtinterface/qt4/plugins/src/imageformats/imageformats.pro new file mode 100644 index 0000000..424da48 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/imageformats/imageformats.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs + +!no-png:!png:SUBDIRS += png +!no-jpeg:!jpeg:SUBDIRS += jpeg +!no-mng:!mng:SUBDIRS += mng diff --git a/tqtinterface/qt4/plugins/src/imageformats/jpeg/jpeg.pro b/tqtinterface/qt4/plugins/src/imageformats/jpeg/jpeg.pro new file mode 100644 index 0000000..3bff1e0 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/imageformats/jpeg/jpeg.pro @@ -0,0 +1,68 @@ +TEMPLATE = lib +TARGET += qjpeg + +CONFIG += qt plugin +DESTDIR = ../../../imageformats + +VERSION = 1.0.0 +REQUIRES = !no-jpeg !jpeg + +SOURCES += main.cpp +system-jpeg { + unix:LIBS += -ljpeg + win32:LIBS += libjpeg.lib +} +!system-jpeg { + INCLUDEPATH += ../../../../src/3rdparty/libjpeg + SOURCES += \ + ../../../../src/3rdparty/libjpeg/jcapimin.c \ + ../../../../src/3rdparty/libjpeg/jcapistd.c \ + ../../../../src/3rdparty/libjpeg/jccoefct.c \ + ../../../../src/3rdparty/libjpeg/jccolor.c \ + ../../../../src/3rdparty/libjpeg/jcdctmgr.c \ + ../../../../src/3rdparty/libjpeg/jchuff.c \ + ../../../../src/3rdparty/libjpeg/jcinit.c \ + ../../../../src/3rdparty/libjpeg/jcmainct.c \ + ../../../../src/3rdparty/libjpeg/jcmarker.c \ + ../../../../src/3rdparty/libjpeg/jcmaster.c \ + ../../../../src/3rdparty/libjpeg/jcomapi.c \ + ../../../../src/3rdparty/libjpeg/jcparam.c \ + ../../../../src/3rdparty/libjpeg/jcphuff.c \ + ../../../../src/3rdparty/libjpeg/jcprepct.c \ + ../../../../src/3rdparty/libjpeg/jcsample.c \ + ../../../../src/3rdparty/libjpeg/jctrans.c \ + ../../../../src/3rdparty/libjpeg/jdapimin.c \ + ../../../../src/3rdparty/libjpeg/jdapistd.c \ + ../../../../src/3rdparty/libjpeg/jdatadst.c \ + ../../../../src/3rdparty/libjpeg/jdatasrc.c \ + ../../../../src/3rdparty/libjpeg/jdcoefct.c \ + ../../../../src/3rdparty/libjpeg/jdcolor.c \ + ../../../../src/3rdparty/libjpeg/jddctmgr.c \ + ../../../../src/3rdparty/libjpeg/jdhuff.c \ + ../../../../src/3rdparty/libjpeg/jdinput.c \ + ../../../../src/3rdparty/libjpeg/jdmainct.c \ + ../../../../src/3rdparty/libjpeg/jdmarker.c \ + ../../../../src/3rdparty/libjpeg/jdmaster.c \ + ../../../../src/3rdparty/libjpeg/jdmerge.c \ + ../../../../src/3rdparty/libjpeg/jdphuff.c \ + ../../../../src/3rdparty/libjpeg/jdpostct.c \ + ../../../../src/3rdparty/libjpeg/jdsample.c \ + ../../../../src/3rdparty/libjpeg/jdtrans.c \ + ../../../../src/3rdparty/libjpeg/jerror.c \ + ../../../../src/3rdparty/libjpeg/jfdctflt.c \ + ../../../../src/3rdparty/libjpeg/jfdctfst.c \ + ../../../../src/3rdparty/libjpeg/jfdctint.c \ + ../../../../src/3rdparty/libjpeg/jidctflt.c \ + ../../../../src/3rdparty/libjpeg/jidctfst.c \ + ../../../../src/3rdparty/libjpeg/jidctint.c \ + ../../../../src/3rdparty/libjpeg/jidctred.c \ + ../../../../src/3rdparty/libjpeg/jmemmgr.c \ + ../../../../src/3rdparty/libjpeg/jquant1.c \ + ../../../../src/3rdparty/libjpeg/jquant2.c \ + ../../../../src/3rdparty/libjpeg/jutils.c \ + ../../../../src/3rdparty/libjpeg/jmemnobs.c +} + + +target.path += $$plugins.path/imageformats +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/imageformats/jpeg/main.cpp b/tqtinterface/qt4/plugins/src/imageformats/jpeg/main.cpp new file mode 100644 index 0000000..6d4a429 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/imageformats/jpeg/main.cpp @@ -0,0 +1,76 @@ +#ifndef TQT_CLEAN_NAMESPACE +#define TQT_CLEAN_NAMESPACE +#endif +#include <tqimageformatplugin.h> + +#ifndef TQT_NO_IMAGEFORMATPLUGIN + +#ifdef TQT_NO_IMAGEIO_JPEG +#undef TQT_NO_IMAGEIO_JPEG +#endif +#include "../../../../src/kernel/qjpegio.cpp" + +class JPEGFormat : public TQImageFormatPlugin +{ +public: + JPEGFormat(); + + TQStringList keys() const; + bool loadImage( const TQString &format, const TQString &filename, TQImage * ); + bool saveImage( const TQString &format, const TQString &filename, const TQImage & ); + bool installIOHandler( const TQString & ); +}; + +JPEGFormat::JPEGFormat() +{ +} + + +TQStringList JPEGFormat::keys() const +{ + TQStringList list; + list << "JPEG"; + + return list; +} + +bool JPEGFormat::loadImage( const TQString &format, const TQString &filename, TQImage *image ) +{ + if ( format != "JPEG" ) + return FALSE; + + TQImageIO io; + io.setFileName( filename ); + io.setImage( *image ); + + read_jpeg_image( &io ); + + return TRUE; +} + +bool JPEGFormat::saveImage( const TQString &format, const TQString &filename, const TQImage &image ) +{ + if ( format != "JPEG" ) + return FALSE; + + TQImageIO io; + io.setFileName( filename ); + io.setImage( image ); + + write_jpeg_image( &io ); + + return TRUE; +} + +bool JPEGFormat::installIOHandler( const TQString &name ) +{ + if ( name.upper() != "JPEG" ) + return FALSE; + + qInitJpegIO(); + return TRUE; +} + +TQ_EXPORT_PLUGIN( JPEGFormat ) + +#endif // TQT_NO_IMAGEFORMATPLUGIN diff --git a/tqtinterface/qt4/plugins/src/imageformats/mng/main.cpp b/tqtinterface/qt4/plugins/src/imageformats/mng/main.cpp new file mode 100644 index 0000000..ad57414 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/imageformats/mng/main.cpp @@ -0,0 +1,59 @@ +#ifndef TQT_CLEAN_NAMESPACE +#define TQT_CLEAN_NAMESPACE +#endif + +#include <tqimageformatplugin.h> + +#ifndef TQT_NO_IMAGEFORMATPLUGIN + +#ifdef TQT_NO_IMAGEIO_MNG +#undef TQT_NO_IMAGEIO_MNG +#endif +#include "../../../../src/kernel/qmngio.cpp" + +class MNGFormat : public TQImageFormatPlugin +{ +public: + MNGFormat(); + + TQStringList keys() const; + bool loadImage( const TQString &format, const TQString &filename, TQImage *image ); + bool saveImage( const TQString &format, const TQString &filename, const TQImage &image ); + bool installIOHandler( const TQString & ); +}; + +MNGFormat::MNGFormat() +{ +} + + +TQStringList MNGFormat::keys() const +{ + TQStringList list; + list << "MNG"; + + return list; +} + +bool MNGFormat::loadImage( const TQString &, const TQString &, TQImage * ) +{ + return FALSE; +} + +bool MNGFormat::saveImage( const TQString &, const TQString &, const TQImage& ) +{ + return FALSE; +} + +bool MNGFormat::installIOHandler( const TQString &name ) +{ + if ( name != "MNG" ) + return FALSE; + + qInitMngIO(); + return TRUE; +} + +TQ_EXPORT_PLUGIN( MNGFormat ) + +#endif // TQT_NO_IMAGEFORMATPLUGIN diff --git a/tqtinterface/qt4/plugins/src/imageformats/mng/mng.pro b/tqtinterface/qt4/plugins/src/imageformats/mng/mng.pro new file mode 100644 index 0000000..2c39f94 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/imageformats/mng/mng.pro @@ -0,0 +1,142 @@ +TEMPLATE = lib +TARGET += qmng + +CONFIG += qt plugin +DESTDIR = ../../../imageformats + +VERSION = 1.0.0 +REQUIRES = !no-mng !mng + +SOURCES += main.cpp + +win32-borland { + QMAKE_CFLAGS_WARN_ON += -w-par + QMAKE_CXXFLAGS_WARN_ON += -w-par +} +win32: CONFIG-=zlib system-zlib jpeg system-jpeg + +system-mng { + win32:LIBS += libmng.lib + unix:LIBS += -lmng +} +!system-mng { + INCLUDEPATH += ../../../../src/3rdparty/libmng + SOURCES += \ + ../../../../src/3rdparty/libmng/libmng_callback_xs.c \ + ../../../../src/3rdparty/libmng/libmng_chunk_io.c \ + ../../../../src/3rdparty/libmng/libmng_chunk_prc.c \ + ../../../../src/3rdparty/libmng/libmng_chunk_xs.c \ + ../../../../src/3rdparty/libmng/libmng_cms.c \ + ../../../../src/3rdparty/libmng/libmng_display.c \ + ../../../../src/3rdparty/libmng/libmng_dither.c \ + ../../../../src/3rdparty/libmng/libmng_error.c \ + ../../../../src/3rdparty/libmng/libmng_filter.c \ + ../../../../src/3rdparty/libmng/libmng_hlapi.c \ + ../../../../src/3rdparty/libmng/libmng_jpeg.c \ + ../../../../src/3rdparty/libmng/libmng_object_prc.c \ + ../../../../src/3rdparty/libmng/libmng_pixels.c \ + ../../../../src/3rdparty/libmng/libmng_prop_xs.c \ + ../../../../src/3rdparty/libmng/libmng_read.c \ + ../../../../src/3rdparty/libmng/libmng_trace.c \ + ../../../../src/3rdparty/libmng/libmng_write.c \ + ../../../../src/3rdparty/libmng/libmng_zlib.c + + HEADERS += ../../../../src/3rdparty/libmng/libmng.h \ + ../../../../src/3rdparty/libmng/libmng_chunks.h \ + ../../../../src/3rdparty/libmng/libmng_chunk_io.h \ + ../../../../src/3rdparty/libmng/libmng_chunk_prc.h \ + ../../../../src/3rdparty/libmng/libmng_cms.h \ + ../../../../src/3rdparty/libmng/libmng_conf.h \ + ../../../../src/3rdparty/libmng/libmng_data.h \ + ../../../../src/3rdparty/libmng/libmng_display.h \ + ../../../../src/3rdparty/libmng/libmng_dither.h \ + ../../../../src/3rdparty/libmng/libmng_error.h \ + ../../../../src/3rdparty/libmng/libmng_filter.h \ + ../../../../src/3rdparty/libmng/libmng_jpeg.h \ + ../../../../src/3rdparty/libmng/libmng_memory.h \ + ../../../../src/3rdparty/libmng/libmng_objects.h \ + ../../../../src/3rdparty/libmng/libmng_object_prc.h \ + ../../../../src/3rdparty/libmng/libmng_pixels.h \ + ../../../../src/3rdparty/libmng/libmng_read.h \ + ../../../../src/3rdparty/libmng/libmng_trace.h \ + ../../../../src/3rdparty/libmng/libmng_types.h \ + ../../../../src/3rdparty/libmng/libmng_write.h \ + ../../../../src/3rdparty/libmng/libmng_zlib.h +} + +!system-zlib { + INCLUDEPATH += ../../../../src/3rdparty/zlib + SOURCES+= \ + ../../../../src/3rdparty/zlib/adler32.c \ + ../../../../src/3rdparty/zlib/compress.c \ + ../../../../src/3rdparty/zlib/crc32.c \ + ../../../../src/3rdparty/zlib/deflate.c \ + ../../../../src/3rdparty/zlib/gzio.c \ + ../../../../src/3rdparty/zlib/inffast.c \ + ../../../../src/3rdparty/zlib/inflate.c \ + ../../../../src/3rdparty/zlib/inftrees.c \ + ../../../../src/3rdparty/zlib/trees.c \ + ../../../../src/3rdparty/zlib/uncompr.c \ + ../../../../src/3rdparty/zlib/zutil.c +} +!no-zlib:!zlib:unix:LIBS += -lz +!no-zlib:!zlib:mac:LIBS += -lz + +system-jpeg { + unix:LIBS += -ljpeg + win32:LIBS += libjpeg.lib +} +!system-jpeg { + INCLUDEPATH += ../../../../src/3rdparty/libjpeg + SOURCES += \ + ../../../../src/3rdparty/libjpeg/jcapimin.c \ + ../../../../src/3rdparty/libjpeg/jcapistd.c \ + ../../../../src/3rdparty/libjpeg/jccoefct.c \ + ../../../../src/3rdparty/libjpeg/jccolor.c \ + ../../../../src/3rdparty/libjpeg/jcdctmgr.c \ + ../../../../src/3rdparty/libjpeg/jchuff.c \ + ../../../../src/3rdparty/libjpeg/jcinit.c \ + ../../../../src/3rdparty/libjpeg/jcmainct.c \ + ../../../../src/3rdparty/libjpeg/jcmarker.c \ + ../../../../src/3rdparty/libjpeg/jcmaster.c \ + ../../../../src/3rdparty/libjpeg/jcomapi.c \ + ../../../../src/3rdparty/libjpeg/jcparam.c \ + ../../../../src/3rdparty/libjpeg/jcphuff.c \ + ../../../../src/3rdparty/libjpeg/jcprepct.c \ + ../../../../src/3rdparty/libjpeg/jcsample.c \ + ../../../../src/3rdparty/libjpeg/jctrans.c \ + ../../../../src/3rdparty/libjpeg/jdapimin.c \ + ../../../../src/3rdparty/libjpeg/jdapistd.c \ + ../../../../src/3rdparty/libjpeg/jdatadst.c \ + ../../../../src/3rdparty/libjpeg/jdatasrc.c \ + ../../../../src/3rdparty/libjpeg/jdcoefct.c \ + ../../../../src/3rdparty/libjpeg/jdcolor.c \ + ../../../../src/3rdparty/libjpeg/jddctmgr.c \ + ../../../../src/3rdparty/libjpeg/jdhuff.c \ + ../../../../src/3rdparty/libjpeg/jdinput.c \ + ../../../../src/3rdparty/libjpeg/jdmainct.c \ + ../../../../src/3rdparty/libjpeg/jdmarker.c \ + ../../../../src/3rdparty/libjpeg/jdmaster.c \ + ../../../../src/3rdparty/libjpeg/jdmerge.c \ + ../../../../src/3rdparty/libjpeg/jdphuff.c \ + ../../../../src/3rdparty/libjpeg/jdpostct.c \ + ../../../../src/3rdparty/libjpeg/jdsample.c \ + ../../../../src/3rdparty/libjpeg/jdtrans.c \ + ../../../../src/3rdparty/libjpeg/jerror.c \ + ../../../../src/3rdparty/libjpeg/jfdctflt.c \ + ../../../../src/3rdparty/libjpeg/jfdctfst.c \ + ../../../../src/3rdparty/libjpeg/jfdctint.c \ + ../../../../src/3rdparty/libjpeg/jidctflt.c \ + ../../../../src/3rdparty/libjpeg/jidctfst.c \ + ../../../../src/3rdparty/libjpeg/jidctint.c \ + ../../../../src/3rdparty/libjpeg/jidctred.c \ + ../../../../src/3rdparty/libjpeg/jmemmgr.c \ + ../../../../src/3rdparty/libjpeg/jquant1.c \ + ../../../../src/3rdparty/libjpeg/jquant2.c \ + ../../../../src/3rdparty/libjpeg/jutils.c \ + ../../../../src/3rdparty/libjpeg/jmemnobs.c +} + + +target.path += $$plugins.path/imageformats +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/imageformats/png/main.cpp b/tqtinterface/qt4/plugins/src/imageformats/png/main.cpp new file mode 100644 index 0000000..39354b6 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/imageformats/png/main.cpp @@ -0,0 +1,76 @@ +#ifndef TQT_CLEAN_NAMESPACE +#define TQT_CLEAN_NAMESPACE +#endif +#include <tqimageformatplugin.h> + +#ifndef TQT_NO_IMAGEFORMATPLUGIN + +#ifdef TQT_NO_IMAGEIO_PNG +#undef TQT_NO_IMAGEIO_PNG +#endif +#include "../../../../src/kernel/qpngio.cpp" + +class PNGFormat : public TQImageFormatPlugin +{ +public: + PNGFormat(); + + TQStringList keys() const; + bool loadImage( const TQString &format, const TQString &filename, TQImage * ); + bool saveImage( const TQString &format, const TQString &filename, const TQImage& ); + bool installIOHandler( const TQString & ); +}; + +PNGFormat::PNGFormat() +{ +} + + +TQStringList PNGFormat::keys() const +{ + TQStringList list; + list << "PNG"; + + return list; +} + +bool PNGFormat::loadImage( const TQString &format, const TQString &filename, TQImage *image ) +{ + if ( format != "PNG" ) + return FALSE; + + TQImageIO io; + io.setFileName( filename ); + io.setImage( *image ); + + read_png_image( &io ); + + return TRUE; +} + +bool PNGFormat::saveImage( const TQString &format, const TQString &filename, const TQImage &image ) +{ + if ( format != "PNG" ) + return FALSE; + + TQImageIO io; + io.setFileName( filename ); + io.setImage( image ); + + write_png_image( &io ); + + return TRUE; +} + +bool PNGFormat::installIOHandler( const TQString &name ) +{ + if ( name != "PNG" ) + return FALSE; + + qInitPngIO(); + return TRUE; +} + +TQ_EXPORT_PLUGIN( PNGFormat ) + +#endif // TQT_NO_IMAGEFORMATPLUGIN diff --git a/tqtinterface/qt4/plugins/src/imageformats/png/png.pro b/tqtinterface/qt4/plugins/src/imageformats/png/png.pro new file mode 100644 index 0000000..65e550e --- /dev/null +++ b/tqtinterface/qt4/plugins/src/imageformats/png/png.pro @@ -0,0 +1,55 @@ +TEMPLATE = lib +TARGET += qpng + +CONFIG += qt plugin +DESTDIR = ../../../imageformats + +VERSION = 1.0.0 +REQUIRES = !no-png !png + +SOURCES += main.cpp + +system-png { + unix:LIBS += -lpng + win32:LIBS += libpng.lib +} +!system-png { + INCLUDEPATH += $$TQT_SOURCE_TREE/src/3rdparty/libpng + INCLUDEPATH += $$TQT_SOURCE_TREE/src/3rdparty/zlib + SOURCES += \ + ../../../../src/3rdparty/libpng/png.c \ + ../../../../src/3rdparty/libpng/pngerror.c \ + ../../../../src/3rdparty/libpng/pngget.c \ + ../../../../src/3rdparty/libpng/pngmem.c \ + ../../../../src/3rdparty/libpng/pngpread.c \ + ../../../../src/3rdparty/libpng/pngread.c \ + ../../../../src/3rdparty/libpng/pngrio.c \ + ../../../../src/3rdparty/libpng/pngrtran.c \ + ../../../../src/3rdparty/libpng/pngrutil.c \ + ../../../../src/3rdparty/libpng/pngset.c \ + ../../../../src/3rdparty/libpng/pngtrans.c \ + ../../../../src/3rdparty/libpng/pngwio.c \ + ../../../../src/3rdparty/libpng/pngwrite.c \ + ../../../../src/3rdparty/libpng/pngwtran.c \ + ../../../../src/3rdparty/libpng/pngwutil.c +} + +!system-zlib:SOURCES += \ + ../../../../src/3rdparty/zlib/adler32.c \ + ../../../../src/3rdparty/zlib/compress.c \ + ../../../../src/3rdparty/zlib/crc32.c \ + ../../../../src/3rdparty/zlib/deflate.c \ + ../../../../src/3rdparty/zlib/gzio.c \ + ../../../../src/3rdparty/zlib/inffast.c \ + ../../../../src/3rdparty/zlib/inflate.c \ + ../../../../src/3rdparty/zlib/inftrees.c \ + ../../../../src/3rdparty/zlib/trees.c \ + ../../../../src/3rdparty/zlib/uncompr.c \ + ../../../../src/3rdparty/zlib/zutil.c + +system-zlib:unix:LIBS += -lz +system-zlib:mac:LIBS += -lz + + +target.path += $$plugins.path/imageformats +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/README b/tqtinterface/qt4/plugins/src/sqldrivers/README new file mode 100644 index 0000000..7ccbdbe --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/README @@ -0,0 +1,5 @@ +Please note that the DB2, Oracle and TDS client drivers are not distributed +with the free version of Qt. + +This is because the client libraries are distributed under a license which +is not compatible with the GPL license. diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/ibase/ibase.pro b/tqtinterface/qt4/plugins/src/sqldrivers/ibase/ibase.pro new file mode 100644 index 0000000..30ae63e --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/ibase/ibase.pro @@ -0,0 +1,27 @@ +TEMPLATE = lib +TARGET = qsqlibase + +CONFIG += qt plugin +DESTDIR = ../../../sqldrivers + +HEADERS = ../../../../src/sql/drivers/ibase/tqsql_ibase.h +SOURCES = main.cpp \ + ../../../../src/sql/drivers/ibase/tqsql_ibase.cpp + +unix { + OBJECTS_DIR = .obj + + !tqcontains( LIBS, .*gds.* ):!tqcontains( LIBS, .*libfb.* ) { + LIBS *= -lgds + } +} +win32 { + OBJECTS_DIR = obj + !win32-borland:LIBS *= gds32_ms.lib + win32-borland:LIBS += gds32.lib +} + +REQUIRES = sql + +target.path += $$plugins.path/sqldrivers +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/ibase/main.cpp b/tqtinterface/qt4/plugins/src/sqldrivers/ibase/main.cpp new file mode 100644 index 0000000..45df95e --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/ibase/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Implementation of Interbase driver plugin +** +** Created : 001103 +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of the sql module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include <tqsqldriverplugin.h> +#include "../../../../src/sql/drivers/ibase/tqsql_ibase.h" + +class TQIBaseDriverPlugin : public TQSqlDriverPlugin +{ +public: + TQIBaseDriverPlugin(); + + TQSqlDriver* create( const TQString & ); + TQStringList keys() const; +}; + +TQIBaseDriverPlugin::TQIBaseDriverPlugin() + : TQSqlDriverPlugin() +{ +} + +TQSqlDriver* TQIBaseDriverPlugin::create( const TQString &name ) +{ + if ( name == "TQIBASE" ) { + TQIBaseDriver* driver = new TQIBaseDriver(); + return driver; + } + return 0; +} + +TQStringList TQIBaseDriverPlugin::keys() const +{ + TQStringList l; + l << "TQIBASE"; + return l; +} + +TQ_EXPORT_PLUGIN( TQIBaseDriverPlugin ) diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/mysql/README b/tqtinterface/qt4/plugins/src/sqldrivers/mysql/README new file mode 100644 index 0000000..d1b3722 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/mysql/README @@ -0,0 +1,6 @@ +You will need the MySQL development headers and libraries installed +before compiling this plugin. + +See the Qt SQL documentation for more information on compiling Qt SQL +driver plugins (sql-driver.html). + diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/mysql/main.cpp b/tqtinterface/qt4/plugins/src/sqldrivers/mysql/main.cpp new file mode 100644 index 0000000..31cc388 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/mysql/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Implementation of MySQL driver plugin +** +** Created : 001103 +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of the sql module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include <tqsqldriverplugin.h> +#include "../../../../src/sql/drivers/mysql/tqsql_mysql.h" + +class TQMYSTQLDriverPlugin : public TQSqlDriverPlugin +{ +public: + TQMYSTQLDriverPlugin(); + + TQSqlDriver* create( const TQString & ); + TQStringList keys() const; +}; + +TQMYSTQLDriverPlugin::TQMYSTQLDriverPlugin() + : TQSqlDriverPlugin() +{ +} + +TQSqlDriver* TQMYSTQLDriverPlugin::create( const TQString &name ) +{ + if ( name == "TQMYSQL3" ) { + TQMYSTQLDriver* driver = new TQMYSTQLDriver(); + return driver; + } + return 0; +} + +TQStringList TQMYSTQLDriverPlugin::keys() const +{ + TQStringList l; + l << "TQMYSQL3"; + return l; +} + +TQ_EXPORT_PLUGIN( TQMYSTQLDriverPlugin ) diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/mysql/mysql.pro b/tqtinterface/qt4/plugins/src/sqldrivers/mysql/mysql.pro new file mode 100644 index 0000000..0d2cc7c --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/mysql/mysql.pro @@ -0,0 +1,33 @@ +TEMPLATE = lib +TARGET = qsqlmysql + +CONFIG += qt plugin +DESTDIR = ../../../sqldrivers + +HEADERS = ../../../../src/sql/drivers/mysql/tqsql_mysql.h +SOURCES = main.cpp \ + ../../../../src/sql/drivers/mysql/tqsql_mysql.cpp + +unix { + OBJECTS_DIR = .obj + + !tqcontains( LIBS, .*mysql.* ) { + LIBS *= -lmysqlclient + } +} +win32 { + OBJECTS_DIR = obj + LIBS *= libmysql.lib +# win32-msvc: { +# LIBS *= delayimp.lib +# QMAKE_LFLAGS += /DELAYLOAD:libmysql.dll +# } +# win32-borland: { +# QMAKE_LFLAGS += /dlibmysql.dll +# } +} + +REQUIRES = sql + +target.path += $$plugins.path/sqldrivers +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/odbc/README b/tqtinterface/qt4/plugins/src/sqldrivers/odbc/README new file mode 100644 index 0000000..279aa7f --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/odbc/README @@ -0,0 +1,6 @@ +You will need ODBC development headers and libraries installed before +compiling this plugin. + +See the Qt SQL documentation for more information on compiling Qt SQL +driver plugins (sql-driver.html). + diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/odbc/main.cpp b/tqtinterface/qt4/plugins/src/sqldrivers/odbc/main.cpp new file mode 100644 index 0000000..e4fc437 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/odbc/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Implementation of ODBC driver plugin +** +** Created : 001103 +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of the sql module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include <tqsqldriverplugin.h> +#include "../../../../src/sql/drivers/odbc/tqsql_odbc.h" + +class TQODBCDriverPlugin : public TQSqlDriverPlugin +{ +public: + TQODBCDriverPlugin(); + + TQSqlDriver* create( const TQString & ); + TQStringList keys() const; +}; + +TQODBCDriverPlugin::TQODBCDriverPlugin() + : TQSqlDriverPlugin() +{ +} + +TQSqlDriver* TQODBCDriverPlugin::create( const TQString &name ) +{ + if ( name == "TQODBC3" ) { + TQODBCDriver* driver = new TQODBCDriver(); + return driver; + } + return 0; +} + +TQStringList TQODBCDriverPlugin::keys() const +{ + TQStringList l; + l.append("TQODBC3"); + return l; +} + +TQ_EXPORT_PLUGIN( TQODBCDriverPlugin ) diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/odbc/odbc.pro b/tqtinterface/qt4/plugins/src/sqldrivers/odbc/odbc.pro new file mode 100644 index 0000000..ba9058e --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/odbc/odbc.pro @@ -0,0 +1,33 @@ +TEMPLATE = lib +TARGET = qsqlodbc + +CONFIG += qt plugin +DESTDIR = ../../../sqldrivers + +HEADERS = ../../../../src/sql/drivers/odbc/tqsql_odbc.h +SOURCES = main.cpp \ + ../../../../src/sql/drivers/odbc/tqsql_odbc.cpp + +mac { + !tqcontains( LIBS, .*odbc.* ) { + LIBS *= -liodbc + } +} + +unix { + OBJECTS_DIR = .obj + !tqcontains( LIBS, .*odbc.* ) { + LIBS *= -lodbc + } +} + +win32 { + OBJECTS_DIR = obj + !win32-borland:LIBS *= -lodbc32 + win32-borland:LIBS *= $(BCB)/lib/PSDK/odbc32.lib +} + +REQUIRES = sql + +target.path += $$plugins.path/sqldrivers +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/psql/README b/tqtinterface/qt4/plugins/src/sqldrivers/psql/README new file mode 100644 index 0000000..86bf16d --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/psql/README @@ -0,0 +1,6 @@ +You will need the PostgreSQL development headers and libraries installed +before compiling this plugin. + +See the Qt SQL documentation for more information on compiling Qt SQL +driver plugins (sql-driver.html). + diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/psql/main.cpp b/tqtinterface/qt4/plugins/src/sqldrivers/psql/main.cpp new file mode 100644 index 0000000..b055f49 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/psql/main.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Implementation of PostgreSQL driver plugin +** +** Created : 001103 +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of the sql module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include <tqsqldriverplugin.h> +#include "../../../../src/sql/drivers/psql/tqsql_psql.h" + +class TQPSTQLDriverPlugin : public TQSqlDriverPlugin +{ +public: + TQPSTQLDriverPlugin(); + + TQSqlDriver* create( const TQString & ); + TQStringList keys() const; +}; + +TQPSTQLDriverPlugin::TQPSTQLDriverPlugin() + : TQSqlDriverPlugin() +{ +} + +TQSqlDriver* TQPSTQLDriverPlugin::create( const TQString &name ) +{ + if ( name == "TQPSQL7" ) { + TQPSTQLDriver* driver = new TQPSTQLDriver(); + return driver; + } + return 0; +} + +TQStringList TQPSTQLDriverPlugin::keys() const +{ + TQStringList l; + l.append("TQPSQL7"); + return l; +} + +TQ_EXPORT_PLUGIN( TQPSTQLDriverPlugin ) diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/psql/psql.pro b/tqtinterface/qt4/plugins/src/sqldrivers/psql/psql.pro new file mode 100644 index 0000000..1ab6808 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/psql/psql.pro @@ -0,0 +1,32 @@ +TEMPLATE = lib +TARGET = qsqlpsql + +CONFIG += qt plugin +DESTDIR = ../../../sqldrivers + +HEADERS = ../../../../src/sql/drivers/psql/tqsql_psql.h +SOURCES = main.cpp \ + ../../../../src/sql/drivers/psql/tqsql_psql.cpp +unix { + OBJECTS_DIR = .obj + !tqcontains( LIBS, .*pq.* ) { + LIBS *= -lpq + } +} + +win32 { + OBJECTS_DIR = obj + LIBS *= libpqdll.lib +# win32-msvc: { +# LIBS *= delayimp.lib +# QMAKE_LFLAGS += /DELAYLOAD:libpq.dll +# } +# win32-borland: { +# QMAKE_LFLAGS += /dlibpq.dll +# } +} + +REQUIRES = sql + +target.path += $$plugins.path/sqldrivers +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/sqldrivers.pro b/tqtinterface/qt4/plugins/src/sqldrivers/sqldrivers.pro new file mode 100644 index 0000000..a7e1652 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/sqldrivers.pro @@ -0,0 +1,10 @@ +TEMPLATE = subdirs + +tqcontains(sql-plugins, psql) : SUBDIRS += psql +tqcontains(sql-plugins, mysql) : SUBDIRS += mysql +tqcontains(sql-plugins, odbc) : SUBDIRS += odbc +tqcontains(sql-plugins, tds) : SUBDIRS += tds +tqcontains(sql-plugins, oci) : SUBDIRS += oci +tqcontains(sql-plugins, db2) : SUBDIRS += db2 +tqcontains(sql-plugins, sqlite) : SUBDIRS += sqlite +tqcontains(sql-plugins, ibase) : SUBDIRS += ibase diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/sqlite/README b/tqtinterface/qt4/plugins/src/sqldrivers/sqlite/README new file mode 100644 index 0000000..899361a --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/sqlite/README @@ -0,0 +1,6 @@ +You will need the SQLite development headers and libraries installed +before compiling this plugin. + +See the Qt SQL documentation for more information on compiling Qt SQL +driver plugins (sql-driver.html). + diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/sqlite/smain.cpp b/tqtinterface/qt4/plugins/src/sqldrivers/sqlite/smain.cpp new file mode 100644 index 0000000..89014d5 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/sqlite/smain.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Implementation of STQLite driver plugin +** +** Created : 031106 +** +** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA. +** +** This file is part of the sql module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include <tqsqldriverplugin.h> +#include "../../../../src/sql/drivers/sqlite/tqsql_sqlite.h" + +class TQSTQLiteDriverPlugin : public TQSqlDriverPlugin +{ +public: + TQSTQLiteDriverPlugin(); + + TQSqlDriver* create( const TQString & ); + TQStringList keys() const; +}; + +TQSTQLiteDriverPlugin::TQSTQLiteDriverPlugin() + : TQSqlDriverPlugin() +{ +} + +TQSqlDriver* TQSTQLiteDriverPlugin::create( const TQString &name ) +{ + if ( name == "TQSQLITE" ) { + TQSTQLiteDriver* driver = new TQSTQLiteDriver(); + return driver; + } + return 0; +} + +TQStringList TQSTQLiteDriverPlugin::keys() const +{ + TQStringList l; + l << "TQSQLITE"; + return l; +} + +TQ_EXPORT_PLUGIN( TQSTQLiteDriverPlugin ) diff --git a/tqtinterface/qt4/plugins/src/sqldrivers/sqlite/sqlite.pro b/tqtinterface/qt4/plugins/src/sqldrivers/sqlite/sqlite.pro new file mode 100644 index 0000000..51d696e --- /dev/null +++ b/tqtinterface/qt4/plugins/src/sqldrivers/sqlite/sqlite.pro @@ -0,0 +1,77 @@ +TEMPLATE = lib +TARGET = qsqlite + +CONFIG += qt plugin +DESTDIR = ../../../sqldrivers + +HEADERS = ../../../../src/sql/drivers/sqlite/tqsql_sqlite.h +SOURCES = smain.cpp \ + ../../../../src/sql/drivers/sqlite/tqsql_sqlite.cpp + +unix { + OBJECTS_DIR = .obj +} + +win32 { + OBJECTS_DIR = obj +# win32-msvc: { +# LIBS *= delayimp.lib +# QMAKE_LFLAGS += /DELAYLOAD:libsqlite.dll +# } +# win32-borland: { +# QMAKE_LFLAGS += /dlibsqlite.dll +# } +} + +!tqcontains( LIBS, .*sqlite.* ) { + INCLUDEPATH += ../../../../src/3rdparty/sqlite + + HEADERS += ../../../../src/3rdparty/sqlite/btree.h \ + ../../../../src/3rdparty/sqlite/config.h \ + ../../../../src/3rdparty/sqlite/hash.h \ + ../../../../src/3rdparty/sqlite/opcodes.h \ + ../../../../src/3rdparty/sqlite/os.h \ + ../../../../src/3rdparty/sqlite/pager.h \ + ../../../../src/3rdparty/sqlite/parse.h \ + ../../../../src/3rdparty/sqlite/sqlite.h \ + ../../../../src/3rdparty/sqlite/sqliteInt.h \ + ../../../../src/3rdparty/sqlite/vdbe.h \ + ../../../../src/3rdparty/sqlite/vdbeInt.h + + SOURCES += ../../../../src/3rdparty/sqlite/attach.c \ + ../../../../src/3rdparty/sqlite/auth.c \ + ../../../../src/3rdparty/sqlite/btree.c \ + ../../../../src/3rdparty/sqlite/btree_rb.c \ + ../../../../src/3rdparty/sqlite/build.c \ + ../../../../src/3rdparty/sqlite/copy.c \ + ../../../../src/3rdparty/sqlite/date.c \ + ../../../../src/3rdparty/sqlite/delete.c \ + ../../../../src/3rdparty/sqlite/expr.c \ + ../../../../src/3rdparty/sqlite/func.c \ + ../../../../src/3rdparty/sqlite/hash.c \ + ../../../../src/3rdparty/sqlite/insert.c \ + ../../../../src/3rdparty/sqlite/main.c \ + ../../../../src/3rdparty/sqlite/opcodes.c \ + ../../../../src/3rdparty/sqlite/os.c \ + ../../../../src/3rdparty/sqlite/pager.c \ + ../../../../src/3rdparty/sqlite/parse.c \ + ../../../../src/3rdparty/sqlite/pragma.c \ + ../../../../src/3rdparty/sqlite/printf.c \ + ../../../../src/3rdparty/sqlite/random.c \ + ../../../../src/3rdparty/sqlite/select.c \ + ../../../../src/3rdparty/sqlite/shell.c \ + ../../../../src/3rdparty/sqlite/table.c \ + ../../../../src/3rdparty/sqlite/tokenize.c \ + ../../../../src/3rdparty/sqlite/trigger.c \ + ../../../../src/3rdparty/sqlite/update.c \ + ../../../../src/3rdparty/sqlite/util.c \ + ../../../../src/3rdparty/sqlite/vacuum.c \ + ../../../../src/3rdparty/sqlite/vdbe.c \ + ../../../../src/3rdparty/sqlite/vdbeaux.c \ + ../../../../src/3rdparty/sqlite/where.c +} + +REQUIRES = sql + +target.path += $$plugins.path/sqldrivers +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/src.pro b/tqtinterface/qt4/plugins/src/src.pro new file mode 100644 index 0000000..4c41b44 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/src.pro @@ -0,0 +1,10 @@ +TEMPLATE = subdirs + +shared { + SUBDIRS *= accessible codecs imageformats sqldrivers styles + embedded:SUBDIRS *= gfxdrivers +} +dll { + SUBDIRS *= accessible codecs imageformats sqldrivers styles + embedded:SUBDIRS *= gfxdrivers +} diff --git a/tqtinterface/qt4/plugins/src/styles/cde/cde.pro b/tqtinterface/qt4/plugins/src/styles/cde/cde.pro new file mode 100644 index 0000000..6aa8abc --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/cde/cde.pro @@ -0,0 +1,20 @@ +TEMPLATE = lib +TARGET = qcdestyle + +CONFIG += qt warn_off release plugin +DESTDIR = ../../../styles + +HEADERS = ../../../../include/tqcdestyle.h +SOURCES = main.cpp \ + ../../../../src/styles/tqcdestyle.cpp + +!tqcontains(styles, motif) { + HEADERS += ../../../../include/tqmotifstyle.h + SOURCES += ../../../../src/styles/tqmotifstyle.cpp +} + +unix:OBJECTS_DIR = .obj +win32:OBJECTS_DIR = obj + +target.path += $$plugins.path/styles +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/styles/cde/main.cpp b/tqtinterface/qt4/plugins/src/styles/cde/main.cpp new file mode 100644 index 0000000..a079a82 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/cde/main.cpp @@ -0,0 +1,33 @@ +#include <tqstyleplugin.h> +#include <tqcdestyle.h> + +class CDEStyle : public TQStylePlugin +{ +public: + CDEStyle(); + + TQStringList keys() const; + TQStyle *create( const TQString& ); +}; + +CDEStyle::CDEStyle() +: TQStylePlugin() +{ +} + +TQStringList CDEStyle::keys() const +{ + TQStringList list; + list << "CDE"; + return list; +} + +TQStyle* CDEStyle::create( const TQString& s ) +{ + if ( s.lower() == "cde" ) + return new TQCDEStyle(); + + return 0; +} + +TQ_EXPORT_PLUGIN( CDEStyle ) diff --git a/tqtinterface/qt4/plugins/src/styles/compact/compact.pro b/tqtinterface/qt4/plugins/src/styles/compact/compact.pro new file mode 100644 index 0000000..ce5af7a --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/compact/compact.pro @@ -0,0 +1,21 @@ +TEMPLATE = lib +TARGET = qcompactstyle + +CONFIG += qt warn_off release plugin +DESTDIR = ../../../styles + +HEADERS = ../../../../include/tqcompactstyle.h + +SOURCES = main.cpp \ + ../../../../src/styles/tqcompactstyle.cpp + +!tqcontains(styles, windows) { + HEADERS += ../../../../include/tqwindowsstyle.h + SOURCES += ../../../../src/styles/tqwindowsstyle.cpp +} + +unix:OBJECTS_DIR = .obj +win32:OBJECTS_DIR = obj + +target.path += $$plugins.path/styles +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/styles/compact/main.cpp b/tqtinterface/qt4/plugins/src/styles/compact/main.cpp new file mode 100644 index 0000000..8d63589 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/compact/main.cpp @@ -0,0 +1,35 @@ +#include <tqstyleplugin.h> +#include <tqcompactstyle.h> + +class CompactStyle : public TQStylePlugin +{ +public: + CompactStyle(); + + TQStringList keys() const; + TQStyle *create( const TQString& ); +}; + +CompactStyle::CompactStyle() +: TQStylePlugin() +{ +} + +TQStringList CompactStyle::keys() const +{ + TQStringList list; + list << "Compact"; + return list; +} + +TQStyle* CompactStyle::create( const TQString& s ) +{ + if ( s.lower() == "compact" ) + return new TQCompactStyle(); + + return 0; +} + + +TQ_EXPORT_PLUGIN( CompactStyle ) + diff --git a/tqtinterface/qt4/plugins/src/styles/motif/main.cpp b/tqtinterface/qt4/plugins/src/styles/motif/main.cpp new file mode 100644 index 0000000..73e25e6 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/motif/main.cpp @@ -0,0 +1,34 @@ +#include <tqstyleplugin.h> +#include <tqmotifstyle.h> + +class MotifStyle : public TQStylePlugin +{ +public: + MotifStyle(); + + TQStringList keys() const; + TQStyle *create( const TQString& ); +}; + +MotifStyle::MotifStyle() +: TQStylePlugin() +{ +} + +TQStringList MotifStyle::keys() const +{ + TQStringList list; + list << "Motif"; + return list; +} + +TQStyle* MotifStyle::create( const TQString& s ) +{ + if ( s.lower() == "motif" ) + return new TQMotifStyle(); + + return 0; +} + +TQ_EXPORT_PLUGIN( MotifStyle ) + diff --git a/tqtinterface/qt4/plugins/src/styles/motif/motif.pro b/tqtinterface/qt4/plugins/src/styles/motif/motif.pro new file mode 100644 index 0000000..95b8372 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/motif/motif.pro @@ -0,0 +1,15 @@ +TEMPLATE = lib +TARGET = qmotifstyle + +CONFIG += qt warn_off release plugin +DESTDIR = ../../../styles + +HEADERS = ../../../../include/tqmotifstyle.h +SOURCES = main.cpp \ + ../../../../src/styles/tqmotifstyle.cpp + +unix:OBJECTS_DIR = .obj +win32:OBJECTS_DIR = obj + +target.path += $$plugins.path/styles +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/styles/motifplus/main.cpp b/tqtinterface/qt4/plugins/src/styles/motifplus/main.cpp new file mode 100644 index 0000000..60b1e53 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/motifplus/main.cpp @@ -0,0 +1,35 @@ +#include <tqstyleplugin.h> +#include <tqmotifplusstyle.h> + +class MotifPlusStyle : public TQStylePlugin +{ +public: + MotifPlusStyle(); + + TQStringList keys() const; + TQStyle *create( const TQString& ); + +}; + +MotifPlusStyle::MotifPlusStyle() +: TQStylePlugin() +{ +} + +TQStringList MotifPlusStyle::keys() const +{ + TQStringList list; + list << "MotifPlus"; + return list; +} + +TQStyle* MotifPlusStyle::create( const TQString& s ) +{ + if ( s.lower() == "motifplus" ) + return new TQMotifPlusStyle(); + + return 0; +} + +TQ_EXPORT_PLUGIN( MotifPlusStyle ) + diff --git a/tqtinterface/qt4/plugins/src/styles/motifplus/motifplus.pro b/tqtinterface/qt4/plugins/src/styles/motifplus/motifplus.pro new file mode 100644 index 0000000..f97bdcc --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/motifplus/motifplus.pro @@ -0,0 +1,20 @@ +TEMPLATE = lib +TARGET = qmotifplusstyle + +CONFIG += qt warn_off release plugin +DESTDIR = ../../../styles + +HEADERS = ../../../../include/tqmotifplusstyle.h +SOURCES = main.cpp \ + ../../../../src/styles/tqmotifplusstyle.cpp + +!tqcontains(styles, motif) { + HEADERS += ../../../../include/tqmotifstyle.h + SOURCES += ../../../../src/styles/tqmotifstyle.cpp +} + +unix:OBJECTS_DIR = .obj +win32:OBJECTS_DIR = obj + +target.path += $$plugins.path/styles +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/styles/platinum/main.cpp b/tqtinterface/qt4/plugins/src/styles/platinum/main.cpp new file mode 100644 index 0000000..aaf1689 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/platinum/main.cpp @@ -0,0 +1,34 @@ +#include <tqplatinumstyle.h> +#include <tqstyleplugin.h> + +class PlatinumStyle : public TQStylePlugin +{ +public: + PlatinumStyle(); + + TQStringList keys() const; + TQStyle *create( const TQString& ); +}; + +PlatinumStyle::PlatinumStyle() +: TQStylePlugin() +{ +} + +TQStringList PlatinumStyle::keys() const +{ + TQStringList list; + list << "Platinum"; + return list; +} + +TQStyle* PlatinumStyle::create( const TQString& s ) +{ + if ( s.lower() == "platinum" ) + return new TQPlatinumStyle(); + + return 0; +} + + +TQ_EXPORT_PLUGIN( PlatinumStyle ) diff --git a/tqtinterface/qt4/plugins/src/styles/platinum/platinum.pro b/tqtinterface/qt4/plugins/src/styles/platinum/platinum.pro new file mode 100644 index 0000000..486faeb --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/platinum/platinum.pro @@ -0,0 +1,20 @@ +TEMPLATE = lib +TARGET = qplatinumstyle + +CONFIG += qt warn_off release plugin +DESTDIR = ../../../styles + +HEADERS = ../../../../include/tqplatinumstyle.h +SOURCES = main.cpp \ + ../../../../src/styles/tqplatinumstyle.cpp + +!tqcontains(styles, windows) { + HEADERS += ../../../../include/tqwindowsstyle.h + SOURCES += ../../../../src/styles/tqwindowsstyle.cpp +} + +unix:OBJECTS_DIR = .obj +win32:OBJECTS_DIR = obj + +target.path += $$plugins.path/styles +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/styles/sgi/main.cpp b/tqtinterface/qt4/plugins/src/styles/sgi/main.cpp new file mode 100644 index 0000000..9e4331f --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/sgi/main.cpp @@ -0,0 +1,33 @@ +#include <tqstyleplugin.h> +#include <tqsgistyle.h> + +class SGIStyle : public TQStylePlugin +{ +public: + SGIStyle(); + + TQStringList keys() const; + TQStyle *create( const TQString& ); +}; + +SGIStyle::SGIStyle() +: TQStylePlugin() +{ +} + +TQStringList SGIStyle::keys() const +{ + TQStringList list; + list << "SGI"; + return list; +} + +TQStyle* SGIStyle::create( const TQString& s ) +{ + if ( s.lower() == "sgi" ) + return new TQSGIStyle(); + + return 0; +} + +TQ_EXPORT_PLUGIN( SGIStyle ) diff --git a/tqtinterface/qt4/plugins/src/styles/sgi/sgi.pro b/tqtinterface/qt4/plugins/src/styles/sgi/sgi.pro new file mode 100644 index 0000000..11f32db --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/sgi/sgi.pro @@ -0,0 +1,20 @@ +TEMPLATE = lib +TARGET = qsgistyle + +CONFIG += qt warn_off release plugin +DESTDIR = ../../../styles + +HEADERS = ../../../../include/tqsgistyle.h +SOURCES = main.cpp \ + ../../../../src/styles/tqsgistyle.cpp + +!tqcontains(styles, motif) { + HEADERS += ../../../../include/tqmotifstyle.h + SOURCES += ../../../../src/styles/tqmotifstyle.cpp +} + +unix:OBJECTS_DIR = .obj +win32:OBJECTS_DIR = obj + +target.path += $$plugins.path/styles +INSTALLS += target diff --git a/tqtinterface/qt4/plugins/src/styles/styles.pro b/tqtinterface/qt4/plugins/src/styles/styles.pro new file mode 100644 index 0000000..8268056 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/styles.pro @@ -0,0 +1,11 @@ +TEMPLATE = subdirs +tqcontains(style-plugins, windows) :SUBDIRS += windows +tqcontains(style-plugins, motif) :SUBDIRS += motif +tqcontains(style-plugins, platinum) :SUBDIRS += platinum +tqcontains(style-plugins, motifplus) :SUBDIRS += motifplus +tqcontains(style-plugins, cde) :SUBDIRS += cde +tqcontains(style-plugins, sgi) :SUBDIRS += sgi +tqcontains(style-plugins, compact) :SUBDIRS += compact +tqcontains(style-plugins, aqua) :SUBDIRS += aqua +tqcontains(style-plugins, mac) :SUBDIRS += mac +tqcontains(style-plugins, windowsxp) :SUBDIRS += windowsxp diff --git a/tqtinterface/qt4/plugins/src/styles/windows/main.cpp b/tqtinterface/qt4/plugins/src/styles/windows/main.cpp new file mode 100644 index 0000000..efb82e4 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/windows/main.cpp @@ -0,0 +1,34 @@ +#include <tqstyleplugin.h> +#include <tqwindowsstyle.h> + +class WindowsStyle : public TQStylePlugin +{ +public: + WindowsStyle(); + + TQStringList keys() const; + TQStyle *create( const TQString& ); +}; + +WindowsStyle::WindowsStyle() +: TQStylePlugin() +{ +} + +TQStringList WindowsStyle::keys() const +{ + TQStringList list; + list << "Windows"; + return list; +} + +TQStyle* WindowsStyle::create( const TQString& s ) +{ + if ( s.lower() == "windows" ) + return new TQWindowsStyle(); + + return 0; +} + +TQ_EXPORT_PLUGIN( WindowsStyle ) + diff --git a/tqtinterface/qt4/plugins/src/styles/windows/windows.pro b/tqtinterface/qt4/plugins/src/styles/windows/windows.pro new file mode 100644 index 0000000..c086321 --- /dev/null +++ b/tqtinterface/qt4/plugins/src/styles/windows/windows.pro @@ -0,0 +1,15 @@ +TEMPLATE = lib +TARGET = qwindowsstyle + +CONFIG += qt warn_off release plugin +DESTDIR = ../../../styles + +HEADERS = ../../../../include/tqwindowsstyle.h +SOURCES = main.cpp \ + ../../../../src/styles/tqwindowsstyle.cpp + +unix:OBJECTS_DIR = .obj +win32:OBJECTS_DIR = obj + +target.path += $$plugins.path/styles +INSTALLS += target |