Newer
Older
scim-wnn / scim-wnn / src / scim_wnn_imengine.h
@tamra tamra on 20 Nov 2004 3 KB 変換の仮実装。
/***************************************************************************
 *   Copyright (C) 2004 by TAM(Teppei Tamra)                               *
 *   tam-t@par.odn.ne.jp                                                   *
 *                                                                         *
 *   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.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef SCIM_WNN_IMENGINE_H
#define SCIM_WNN_IMENGINE_H

#include <cstdio>
#include <cstdlib>
#include <romkan.h>
#include <wnnconversion.h>
#define Uses_SCIM_ICONV
#include <scim.h>
#include <scim_iconv.h>

using namespace scim;
using namespace std;

class WnnFactory : public IMEngineFactoryBase
{
protected:
    friend class WnnInstance;
    WideString m_name;
public:
    WnnFactory ();
    WnnFactory (const WideString & name, const String & languages);
    virtual ~WnnFactory ();
    virtual WideString get_name () const;
    virtual WideString get_authors () const;
    virtual WideString get_credits () const;
    virtual WideString get_help () const;
    virtual String get_uuid () const;
    virtual String get_icon_file () const;
    virtual IMEngineInstancePointer create_instance (const String& encoding, int id = -1);
protected:

};


class WnnInstance : public IMEngineInstanceBase
{
public:
    WnnInstance (WnnFactory *factory, const String  &encoding, int id = -1);
    virtual ~WnnInstance ();
    virtual bool process_key_event (const KeyEvent& key);
    virtual void move_preedit_caret (unsigned int pos);
    virtual void select_candidate (unsigned int item);
    virtual void update_lookup_table_page_size (unsigned int page_size);
    virtual void lookup_table_page_up ();
    virtual void lookup_table_page_down ();
    virtual void reset ();
    virtual void focus_in ();
    virtual void focus_out ();
    virtual void trigger_property (const String &property);

protected:
    CommonLookupTable m_lookup_table;
    Romkan m_rk;
    WnnConversion wnn;
    bool m_conversion;
protected:
    bool process_preedit_key_event(const KeyEvent &key);
    bool process_conversion_key_event(const KeyEvent &key);
    void startConversion(WideString s);
};


#endif