/***************************************************************************
 *   Copyright (C) 2003-2005 by liuspider                                  *
 *   liuspider@users.sourceforge.net                                       *
 *                                                                         *
 *   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 MAINWINDOW_H
#define MAINWINDOW_H

#include "utils/scimxmlguibuilder.h"
#include "utils/scimdragableframe.h"

// class ScimServerPopupMenu;
class ScimToolBar;
class ScimMoveHandle;
class SkimPluginManager;
class SkimGlobalActions;
class ScimAction;

class QPopupMenu;
class QHBoxLayout;

class MainWindow : public ScimDragableFrame, public ScimXMLGUIClient
{
    Q_OBJECT

public:
    MainWindow( SkimPluginManager*, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
    ~MainWindow();

    ScimMoveHandle* moveHandle;

public slots:
    virtual void show();
    virtual void hide();
    virtual void adjustSize();
    void requestReloadSelf ();
    void changeSetting();
    void updateFrontendProperties ();

private:

    SkimPluginManager* allModules;
    scim::SocketServerThread* InputServer;

    KXMLGUIFactory* guiFactory;

    QTimer* AutoHideTimeoutTimer;

    int AutoHideTimeout;
    bool PanelTurnedOn;
    bool AlwaysShow;
    bool autoSnap;
    
    void createToolbar ();

protected:
    QHBoxLayout* MainWindowLayout;
    QPoint clickPos;
    ScimToolBar* toolbar;
    SkimGlobalActions* defaultActionCollection;
    ScimAction* serverAction;
    QPopupMenu* contextMenu;
    QPtrList<class KAction> insertedActions;
protected slots:
    virtual void languageChange();
    virtual void contextMenuEvent ( QContextMenuEvent * );
};

#include "src/skimplugin.h"

class MainWindowPlugin : public SkimPlugin
{
Q_OBJECT
public:
    MainWindowPlugin( QObject *parent, const char *name, const QStringList &args );

    virtual ~MainWindowPlugin();
private:
    MainWindow* mainwindow;
};

#endif // MAINWINDOW_H
