Back to Classes Page
Parent Class: CFormView
Resource ID: IDD_MESSENGERCLIENT_FORM
An object of this class represents the main view for Chatter-jee Client.
Method Summary |
protected: void |
AdjustFormControls() |
void |
CallOnFileChangeUser() |
void |
CreateASpeakWindow(CString& strFriend, char *strMessage, CString& strFontFace, LOGFONT *pFont, int iFontColor, int iFontSize) |
void |
InitFriendsList() |
protected: void |
OnAddFriend() |
protected: void |
OnChangepassword() |
protected: void |
OnDblclkOnline(NMHDR* pNMHDR, LRESULT* pResult) |
protected: void |
OnDeleteFriend() |
protected: void |
OnFileChangeUser() |
protected: void |
OnFileDisconnect() |
protected: void |
OnFilePreferences() |
protected: void |
OnInitialUpdate() |
protected: void |
OnMessage() |
protected: void |
OnOfflineMessages() |
protected: void |
OnSelchangedOnline(NMHDR* pNMHDR, LRESULT* pResult) |
protected: void |
OnSize(UINT nType, int cx, int cy) |
protected: void |
OnToolsBlockeduserslist() |
protected: void |
OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) |
protected: void |
OnUpdateAddFriend(CCmdUI* pCmdUI) |
protected: void |
OnUpdateDeleteFriend(CCmdUI* pCmdUI) |
protected: void |
OnUpdateFileChangeUser(CCmdUI* pCmdUI) |
protected: void |
OnUpdateFileDisconnect(CCmdUI* pCmdUI) |
protected: void |
OnUpdateDeleteFriend(CCmdUI* pCmdUI) |
protected: void |
OnUpdateMessage(CCmdUI* pCmdUI) |
protected: void |
OnUpdateMessages(CCmdUI* pCmdUI) |
protected: void |
OnUpdateSearchFriend(CCmdUI* pCmdUI) |
protected: void |
OnUpdateToolsBlockeduserslist(CCmdUI* pCmdUI) |
protected: void |
OnUpdateToolsChangepassword(CCmdUI* pCmdUI) |
protected: void |
SetBackgroundColor(COLORREF &color) |
protected: void |
UpdateMenuItem(CCmdUI *pCmdUI) |
m_bFirstTime
This var is used to determine whether the Chatter-jee View window is resized atleast once. Once the window is
resized the first time, this var becomes false.
m_FriendsList
This Tree Control var contains the names of all online and offline friends of this user.
m_pDoc
The document object pointer. The MFC implementation of this class provides a method GetDocument(), but insted
of calling this method repeatatively, we simply store the document pointer here. This results in more efficiency.
m_strSelFriend
This var stores the user id of the friend whose name has been selected in the
Friends List tree control (by single clicking on the name).
CMessengerClientSocket()
Sets the m_bFirstTime var to true, and m_strSelFriend
to blank.
~CMessengerClientView()
Default Destructor.
AdjustFormControls()
- Resizes and positions the main view window, and also adjust the positions and sizes of various controls within it.
- Sets the m_bFirstTime var to false, indicating that resizing is done at least once.
- Parameters: None
- Returns: void
CallOnFileChangeUser()
This method is just a public interface for OnFileChangeUser(). Does nothing more
than calling OnFileChangeUser().
- Parameters: None
- Returns: void
CreateASpeakWindow(CString& strFriend, char *strMessage, CString& strFontFace, LOGFONT *pFont, int iFontColor, int iFontSize)
- Finds out a Speak window for a friend.
- If a Speak Window for a friend does not exist, creates one.
- Sizes the Speak Window and sets its title to the recepient friend's name.
- Fills the User name as From field and recepient friend's name as
To field in the Speak Window.
- Adjusts the Font properties and the background color as the one specified in the inputs to this method.
- If a messages is specified in the input, appends it to the text in the Speak Window's
Total Text.
- Adds the pointer to newly created Speak Window to Document objects's
Speak Windows List.
- Sets the Speak Window as the active window.
- Parameters:
- strFriend - ID of the friend for whom the Speak Window is being created.
- strMessage - Message to be put into the Speak Window.
- strFontFace - Font name for displaying strMessage.
- pFont - Other Font characteristics.
- iFontColor - Font color.
- iFontSize - Font size.
- Returns: void
InitFriendsList()
- Creates the root for Friends List tree view.
- Creates the root for Online Friends list & Offline Friends list under Friends List tree view.
- Sets the number of online and offline users to 0.
- Parameters: None
- Returns: void
OnAddFriend()
- Parameters: None
- Returns: void
OnChangepassword()
- Parameters: None
- Returns: void
OnDblclkOnline(NMHDR* pNMHDR, LRESULT* pResult)
- Called when user double clicks on any item in the Friends List tree view.
- Determines whether a Friend's name is clicked.
- If yes, extracts the friend's name from the tree view.
- Makes a call to CreateASpeakWindow()
to enable sending messages.
- Parameters: System generated.
- Returns: void
OnDeleteFriend()
- Parameters: None
- Returns: void
OnFileChangeUser()
- Parameters: None
- Returns: void
OnFileDisconnect()
- Called when user clicks the menu option File-Disconnect.
- Checks whether the client is connected to Chatter-jee Server.
- If yes, does the memory cleanup by calling DoCleanup()
method of Document object.
- Then it disconnects
and reconnects to the Chatter-jee Server.
- Parameters: None
- Returns: void
OnFilePreferences()
- Parameters: None
- Returns: void
OnInitialUpdate()
- Parameters: None
- Returns: void
OnMessage()
- Called when user clicks Tools-Send Message menu item or clicks the Send Message toolbar button
.
-
Creates a Speak Window with no name specified in the To field.
- Parameters: None
- Returns: void
OnOfflineMessages()
- Parameters: None
- Returns: void
OnSelchangedOnline(NMHDR* pNMHDR, LRESULT* pResult)
- Called when user clicks on an item in the Friends List tree control.
- Finds out which tree item is clicked.
- If it's a Friend's name, sets the var m_strSelFriend as the ID of the
friend whose name is clicked.
-
- Parameters: System generated.
- Returns: void
OnSize(UINT nType, int cx, int cy)
- Finds out whether the window is shown previously by referring to m_bFirstTime.
- If not being shown for the first time, call AdjustFormControls() to adjust the
form controls.
- Parameters: None
- Returns: void
OnToolsBlockeduserslist()
- Called when Tools-Blocked Users List menu item is clicked.
- Checks if Blocked Users List is already obtained, by referring to
m_bIsBlockedUsersListObtained var of Document object.
- If the Blocked Users List is not obtained, sends a request to the Chatter-jee Server, asking for the same.
- If the list is present, creates a Blocked Users List Dialog, and shows it in
modal fashion.
- Parameters: None
- Returns: void
OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
- Overridden from CView class. Auto called when the view is to be updated.
- If lHint is non-zero, sets the background color to that mentioned in the
Global Preferences.
- Parameters: System generated.
- Returns: void
OnUpdateAddFriend(CCmdUI* pCmdUI)
- ON_UPDATE_COMMAND_UI handler for menu item Tools-Friends List-Add a Friend.
- Enables/Disables the menu item depending on whether the user has logged in or not respectively.
- Calls UpdateMenuItem() method for this functionality.
- Parameters: System generated.
- Returns: void
OnUpdateDeleteFriend(CCmdUI* pCmdUI)
- ON_UPDATE_COMMAND_UI handler for menu item Tools-Friends List-Delete Friend(s).
- Enables/Disables the menu item depending on whether the user has logged in or not respectively.
- Calls UpdateMenuItem() method for this functionality.
- Parameters: System generated.
- Returns: void
OnUpdateFileChangeUser(CCmdUI* pCmdUI)
- ON_UPDATE_COMMAND_UI handler for menu item File-Change User.
- Changes the menu item text to "Change User" or "Login", depending on whether the user has logged in or not respectively.
- Calls UpdateMenuItem() method for this functionality.
- Parameters: System generated.
- Returns: void
OnUpdateFileDisconnect(CCmdUI* pCmdUI)
- ON_UPDATE_COMMAND_UI handler for menu item File-Disconnect.
- Enables/Disables the menu item depending on whether the user has logged in or not respectively.
- Calls UpdateMenuItem() method for this functionality.
- Parameters: System generated.
- Returns: void
OnUpdateMessage(CCmdUI* pCmdUI)
- ON_UPDATE_COMMAND_UI handler for menu item Tools-Send Message.
- Enables/Disables the menu item depending on whether the user has logged in or not respectively.
- Calls UpdateMenuItem() method for this functionality.
- Parameters: System generated.
- Returns: void
OnUpdateMessages(CCmdUI* pCmdUI)
- ON_UPDATE_COMMAND_UI handler for menu item Tools-Offline Messages.
- Enables/Disables the menu item depending on whether the user has logged in or not respectively.
- Calls UpdateMenuItem() method for this functionality.
- Parameters: System generated.
- Returns: void
OnUpdateSearchFriend(CCmdUI* pCmdUI)
This item is removed from menu, and is now redundent.
OnUpdateToolsBlockeduserslist(CCmdUI* pCmdUI)
- ON_UPDATE_COMMAND_UI handler for menu item Tools-Blocked Users List.
- Enables/Disables the menu item depending on whether the user has logged in or not respectively.
- Calls UpdateMenuItem() method for this functionality.
- Parameters: System generated.
- Returns: void
OnUpdateToolsChangepassword(CCmdUI* pCmdUI)
- ON_UPDATE_COMMAND_UI handler for menu item Tools-Change Password.
- Enables/Disables the menu item depending on whether the user has logged in or not respectively.
- Calls UpdateMenuItem() method for this functionality.
- Parameters: System generated.
- Returns: void
SetBackgroundColor(COLORREF &color)
- Sets the background color of the Friends List tree control.
- Parameters:
- color - New background color.
- Returns: void
UpdateMenuItem(CCmdUI *pCmdUI)
- If user is logged in, enables the given menu item, otherwise disables it.
- Uses m_bLoggedInFlag variable of Document object
to determine whether the user has logged in or not.
- All menu items which should be enabled only when user is logged in call this method in their ON_UPDATE_COMMAND_UI
event handler.
- Parameters: System generated.
- Returns: void
Back to Classes Page