less Q3 (remove a lot of unused Q3 headers, port small things)
[kdenetwork.git] / kopete / libkopete / ui / kopeteview.h
blob5f13066a13608ef9c5b51fa4e3efd1de73651111
1 /*
2 kopeteview.h - View Manager
4 Copyright (c) 2003 by Jason Keirstead <jason@keirstead.org>
5 Copyright (c) 2004 by Matt Rogers <matt.rogers@kdemail.net>
6 Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
8 *************************************************************************
9 * *
10 * This library is free software; you can redistribute it and/or *
11 * modify it under the terms of the GNU Lesser General Public *
12 * License as published by the Free Software Foundation; either *
13 * version 2 of the License, or (at your option) any later version. *
14 * *
15 *************************************************************************
19 #ifndef KOPETEVIEW_H
20 #define KOPETEVIEW_H
22 #include "kopetemessage.h"
23 #include "kopete_export.h"
25 namespace Kopete
27 class ViewPlugin;
30 /**
31 * @author Jason Keirstead
33 * Abstract parent class for all types of views used for messaging.These view objects
34 * are provided by a @ref Kopete::ViewPlugin
36 * @see Kopete::ViewPlugin
38 class KOPETE_EXPORT KopeteView
40 public:
41 virtual ~KopeteView(){}
42 /**
43 * constructor
45 KopeteView( Kopete::ChatSession *manager, Kopete::ViewPlugin *parent );
47 /**
48 * @brief Returns the message currently in the edit area
49 * @return The Kopete::Message object containing the message
51 virtual Kopete::Message currentMessage() = 0;
52 /**
53 * Set the message that the view is currently editing.
54 * @param newMessage The Kopete::Message object containing the message to be edited.
56 virtual void setCurrentMessage( const Kopete::Message &newMessage ) = 0;
58 /**
59 * @brief Get the message manager
60 * @return The Kopete::ChatSession that the view is in communication with.
62 Kopete::ChatSession *msgManager() const;
64 /**
65 * @brief add a message to the view
67 * The message gets added at the end of the view and is automatically
68 * displayed. Classes that inherit from KopeteView should make this a slot.
70 virtual void appendMessage( Kopete::Message & ) = 0;
72 /**
73 * @brief append multiple messages to the view
75 * This function does the same thing as the above function but
76 * can be reimplemented if it is faster to apend several messages
77 * in the same time.
79 * The default implementation just call @ref appendMessage() X times
81 virtual void appendMessages( Q3ValueList<Kopete::Message> );
83 /**
84 * @brief Raises the view above other windows
85 * @param activate change the focus to the window
87 virtual void raise(bool activate = false) = 0;
89 /**
90 * @brief Clear the buffer
92 virtual void clear();
94 /**
95 * @brief Make the view visible
97 * Makes the view visible if it is currently hidden.
99 virtual void makeVisible() = 0;
102 * @brief Close this view
104 virtual bool closeView( bool force = false ) = 0;
107 * @brief Get the current visibility of the view
108 * @return Whether the view is visible or not.
110 virtual bool isVisible() = 0;
113 * @brief Get the view widget
115 * Can be reimplemented to return this if derived object is a widget
117 virtual QWidget *mainWidget() = 0;
120 * @brief Inform the view the message was sent successfully
122 * This should be reimplemented as a SLOT in any derived objects
124 virtual void messageSentSuccessfully() = 0;
127 * @brief Register a handler for the context menu
129 * Plugins should call this slot at view creation to register
130 * themselves as handlers for the context menu of this view. Plugins
131 * can attach to the viewCreated signal of KopeteMessageManagerFactory
132 * to know when views are created.
134 * A view does not need to implement this method unless they have context
135 * menus that can be extended
137 * @param target A target QObject for the contextMenuEvent signal of the view
138 * @param slot A slot that matches the signature ( QString&, KMenu *)
140 virtual void registerContextMenuHandler( QObject *target, const char*slot ){ Q_UNUSED(target); Q_UNUSED(slot); };
143 * @brief Register a handler for the tooltip
145 * Plugins should call this slot at view creation to register
146 * themselves as handlers for the tooltip of this view. Plugins
147 * can attach to the viewCreated signal of KopeteMessageManagerFactory
148 * to know when views are created.
150 * A view does not need to impliment this method unless it has the ability
151 * to show tooltips
153 * @param target A target QObject for the contextMenuEvent signal of the view
154 * @param slot A slot that matches the signature ( QString&, KMenu *)
156 virtual void registerTooltipHandler( QObject *target, const char*slot ){ Q_UNUSED(target); Q_UNUSED(slot); };
159 * @brief Returns the Kopete::ViewPlugin responsible for this view
161 * KopeteView objects are created by plugins. This returns a pointer to the plugin
162 * that created this view. You can use this to infer other information on this view
163 * and it's capabilities.
165 Kopete::ViewPlugin *plugin();
167 protected:
169 * a pointer to the Kopete::ChatSession given in the constructor
171 Kopete::ChatSession *m_manager;
172 Kopete::ViewPlugin *m_plugin;
175 #endif