/***************************************************************************
QObject.h - description
-------------------
begin : Fri Mar 3 2000
copyright : (C) 2000 by Richard Dale
email : Richard_Dale@tipitina.demon.co.uk
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QOBJECT_H
#define QOBJECT_H
#include <Foundation/NSObject.h>
#include <Foundation/NSString.h>
#include <qtobjc/QtSupport.h>
#include <qtobjc/QEvent.h>
extern void ObjcSlotCallback(void * userData, void * value);
@class QObject;
/**
*@author Richard Dale
*/
/**
* An interface declaring most of the methods that were in the C++
* 'qobject.h' header. Since the Qt library uses multiple inheritance
* these methods are defined as an Objective-C protocol. Then classes, such
* as QWidget, can inherit from both QObject and QPainterDevice. They
* inherit the interface 'QObjectInterface' as a protocol from QObject, and
* behaviour from the 'QPainterDevice' implementation.
* From the point of view of Objective-C, the methods in QObject with
* the same names in QWidget are reimplementations of the same 'QObjectInterface'
* interface.
* In fact, the two implementations call the same QtC function calls, and
* invoke the same C++ member functions.
*
* See the interfaces @ref QObject and @ref QtSupport for the remainder
* of the public methods for QObject.
*
* This interface is implemented by the two categories QObject(QObjectImplementation)
* and QWidget(QObjectImplementation). Both implementations call the same
* C++ member functions of QObject.
*
* @short An interface for a signal/slot handling base class.
*/
@protocol QObjectInterface
/** Create a new QObject with the given parent and name */
- initWithParent: (<QObjectInterface>) parent name: (NSString *) name;
- (BOOL) event: (QEvent *) event;
- (BOOL) eventFilter: (<QObjectInterface>) filter event: (QEvent *) event;
- (NSString *) tr: (NSString *) string;
- (NSString *) className;
- (BOOL) isA: (NSString *) name;
- (BOOL) inherits: (NSString *) name;
- setName: (NSString *) name;
- blockSignals: (BOOL) yn;
- (int) startTimer: (int) interval;
- killTimer: (int) id;
- killTimers;
- (NSArray *) queryList: (NSString *) inheritsClass name: (NSString *) objname regexMatch: (BOOL) regex recursiveSearch: (BOOL) recursive;
- insertChild: (<QObjectInterface>) child;
- removeChild: (<QObjectInterface>) child;
- installEventFilter: (<QObjectInterface>) filter;
- removeEventFilter: (<QObjectInterface>) filter;
- (BOOL) connect: (<QObjectInterface>) sender signal: (NSString *) signal slot: (NSString *) member;
- (BOOL) disconnect: (NSString *) signal receiver: (<QObjectInterface>) receiver slot: (NSString *) member;
- (BOOL) disconnect: (<QObjectInterface>) receiver slot: (NSString *) member;
- dumpObjectTree;
- dumpObjectInfo;
- connectNotify: (NSString *) signal;
- disconnectNotify: (NSString *) signal;
- (BOOL) checkConnectArgs: (NSString *) signal receiver: (<QObjectInterface>) receiver slot: (NSString *) member;
/** Emit a signal with no parameter */
- emit: (NSString *) signal;
/** Emit a signal with an int parameter */
- emit: (NSString *) signal intValue: (int) value;
/** Emit a signal with a void * parameter corresponding to an Objective-C instance */
- emit: (NSString *) signal value: value;
@end
/**
* A base class for Qt objects which can be connected together via
* the signal/slot mechanism. See @ref QObjectInterface for most of
* the methods originally in the C++ 'qobject.h' header.
*
* @short A signal/slot handling base class.
*/
@interface QObject : NSObject
{
@private
void * _qt;
}
/**
* Connect a sender/signal to a receiver/slot. If the signal ends with ")", it is considered to
* originate from a C++ member function, and a slot ending with ")" is considered to have
* a member function as target. Otherwise, the signal or slot should be an Objective-C style method name.
* @param sender The sender Objective-C instance
* @param signal A string such as "activated(int)" for C++ signals or "activated:" for Objective-C signals
* @param receiver The receiver Objective-C instance
* @param slot A string such as "slotShowHelp()" for C++ slots or "slotShowHelp" for Objective-C slots
*/
+ (BOOL) connect: (<QObjectInterface,QtSupport>) sender signal: (NSString *) signal receiver: (<QObjectInterface,QtSupport>) receiver slot: (NSString *) slot;
+ (BOOL) disconnect: (<QObjectInterface,QtSupport>) sender signal: (NSString *) signal receiver: (<QObjectInterface,QtSupport>) receiver slot: (NSString *) slot;
/** Emit a signal with no parameter */
+ sender: (<QObjectInterface,QtSupport>) sender emit: (NSString *) signal;
/** Emit a signal with an int parameter */
+ sender: (<QObjectInterface,QtSupport>) sender emit: (NSString *) signal intValue: (int) value;
/** Emit a signal with a void * parameter corresponding to an Objective-C instance */
+ sender: (<QObjectInterface,QtSupport>) sender emit: (NSString *) signal value: value;
/** Creates a QtC Signal for an Objective-C sender/signal combination, and adds it to the qtSignalDictionary */
+ (void *) signalIdForSender: (<QObjectInterface,QtSupport>) sender signal: (NSString *) signal;
/** Creates a QtC Slot for an Objective-C receiver/slot combination as target */
+ (int) slotIdForReceiver: (<QObjectInterface,QtSupport>) receiver slot: (NSString *) member;
@end
@interface QObject (QtSupport) <QtSupport>
+ setObject: anId forQtKey: (void *) qt;
+ removeQtKey: (void *) qt;
+ objectForQtKey: (void *) qt;
+ objectForQtKey: (void *) qt withClass: (Class) objcClass;
@end
@interface QObject (QObjectImplementation) <QObjectInterface>
@end
#endif
Documentation generated by duke@tipitina on Sat May 6 11:42:52 EDT 2000