f4342d9310
The base for roster management (RosterEditWindow) has been made, and adding new contacts works. Up next is contact removal and editing. This leverages a new template (as defined in a protocol's CayaProtocol::SettingsTemplate()), "roster," which should contain all slots pertinent to editing/adding a contact member. Two new API messages were added for this― IM_CONTACT_LIST_CONTACT_ADDED and IM_CONTACT_LIST_CONTACT_REMOVED. The former will functionally just be IM_CONTACT_INFO, but with some semantical meaning. A new CayaMessage (CAYA_EDIT_ROSTER) was also added. TemplateWindow was also edited to this end: Now, like RosterWindow/View, it can be given a specific accounts' instance id, and it will prevent the selection of another account. A new constructor was also added, to allow a ProtocolTemplate to be explicitly passed to it― probably from the program itself.
80 lines
1.7 KiB
C++
80 lines
1.7 KiB
C++
/*
|
|
* Copyright 2021, Jaidyn Levesque. All rights reserved.
|
|
* Copyright 2009-2011, Andrea Anzani. All rights reserved.
|
|
* Copyright 2009-2011, Pier Luigi Fiorini. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _MAIN_WINDOW_H
|
|
#define _MAIN_WINDOW_H
|
|
|
|
#include <Window.h>
|
|
|
|
#include "Observer.h"
|
|
|
|
//class BMenubar;
|
|
class BSplitView;
|
|
class BTextView;
|
|
|
|
class Conversation;
|
|
class ConversationItem;
|
|
class ConversationListView;
|
|
class ConversationView;
|
|
class RosterItem;
|
|
class RosterEditWindow;
|
|
class RosterWindow;
|
|
class Server;
|
|
class StatusView;
|
|
|
|
|
|
class MainWindow: public BWindow, public Observer {
|
|
public:
|
|
MainWindow();
|
|
|
|
void Start();
|
|
virtual bool QuitRequested();
|
|
|
|
virtual void MessageReceived(BMessage* message);
|
|
void ImMessage(BMessage* msg);
|
|
void ImError(BMessage* msg);
|
|
|
|
// Observer inheritance
|
|
void ObserveInteger(int32 what, int32 val);
|
|
|
|
virtual void WorkspaceActivated(int32 workspace,
|
|
bool active);
|
|
|
|
void SetConversation(Conversation* chat);
|
|
void RemoveConversation(Conversation* chat);
|
|
|
|
Server* GetServer() const { return fServer; }
|
|
|
|
private:
|
|
void _InitInterface();
|
|
BMenuBar* _CreateMenuBar();
|
|
void _ToggleMenuItems();
|
|
|
|
ConversationItem*
|
|
_EnsureConversationItem(BMessage* msg);
|
|
|
|
Server* fServer;
|
|
RosterWindow* fRosterWindow;
|
|
RosterEditWindow* fRosterEditWindow;
|
|
bool fWorkspaceChanged;
|
|
BMenuBar* fMenuBar;
|
|
|
|
// Left panel, chat list
|
|
ConversationListView* fListView;
|
|
StatusView* fStatusView;
|
|
|
|
// Right panel, chat
|
|
BSplitView* fRightView;
|
|
BScrollView* fSendScroll;
|
|
BTextView* fSendView;
|
|
ConversationView* fChatView;
|
|
Conversation* fConversation;
|
|
};
|
|
|
|
|
|
#endif // _MAIN_WINDOW_H
|
|
|