www.pudn.com > xvoice-0.8.1.rar > Target.h


// -*- C++ -*-

/**
 * Target.h
 *
 * Description: declaration of an event Target class
 *
 * Copyright (c) 1999, David Z. Creemer.
 * See the LICENSE file. All rights not granted therein are reserved.
 *
 * @author David Z. Creemer
 * @version 1.0
 *
 * 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

#ifndef _TARGET_H_
#define _TARGET_H_

#include "x.h"

class EventStream;

class Target
{
public:

    /**
     * constructor
     */
    Target( );

    /**
     * destructor
     */
    virtual ~Target();

    /**
     * get the name of the target
     *
     * @return the name of the target window
     */
    const char *name() { return _name; }

    /**
     * send the given C string to the target
     *
     * @param the string to send
     */

    int Target::sendText( const char* text );

    /**
     * send the given event stream to the target
     *
     * @param the stream to send
     */

    int Target::sendEventStream( EventStream* evs );

    /**
     * get the window this target represents
     *
     * @return the target window
     */
    Window window() { return _window; }
    void Target::set(Window window) { _window = window; }

    bool Target::focusedTarget();
    void Target::sendEvent( XEvent *evt );

protected:

    /**
     * the target window
     */
    Window _window;

    /**
     * the name of the target
     */
    char *_name;

    /**
     * true if target is valid
     */
    bool _valid;
};

#endif // _TARGET_H