Click here to Skip to main content
15,881,709 members
Articles / Desktop Programming / WTL

RSS Reader Plug-in for Internet Explorer

Rate me:
Please Sign up or sign in to vote.
5.00/5 (12 votes)
16 Jul 2007CPOL4 min read 317.2K   1.3K   32  
This is a toolbar for the Internet Explorer which shows information from RSS taken from the Internet.
/*
	Project		: RSS Reader plugin for Internet Explorer
	File name	: RRPNewsButton.h
	Date		: 
	Pupose		: It encapsulated News Button which has the responsibility of showing
				  News in cool owner-drawn drop down menu.
	Note		: It handle some Window Messaged chainded to it by RRPToolbar class
				  This messages are of course related with Button
	Send comments 
	or Bugs to	: prafulla_t@users.sourceforge.net
*/

#pragma once

#include <atlctrls.h>
#include "RRPRssParser.h"
#include "RRPRssItemIterator.h"
#include "RRPMenuTooltip.h"
#include "RRPRssFetcher.h"


typedef struct MenuItem {
		int commandID;
		char *name;
}MenuItem;

class RRPNewsButton
{
public:
	//Constructior/Destructor
	RRPNewsButton(void);
	~RRPNewsButton(void);


	void setToolbar(RRPToolbar *rrpToolbar);
	void setRssFetcher(RRPRssFetcher *fecher);
	void refreshNews();
	BOOL createButton(char* nameOfButton,int commandID = 101 ,CString message = "Yo",BYTE buttonStyle = BTNS_BUTTON | BTNS_AUTOSIZE);
	void changeButtonCaption(char *str,DWORD dwMask = TBIF_TEXT);
	LRESULT OnClick(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnButtonDropDown(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
	LRESULT OnDrawItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnMeasureItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnMenuSelect(WPARAM additionalParam, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnMenuClick(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
	static char* getDate();

	void setBrowser(IWebBrowser2 *p) {
		this->webBrowser = p;
	};

	void setMenuHandle(HWND handle) {
		menuTooltip->setMenuHandle(handle);
	};

	void setMenuTooltip(RRPMenuTooltip *menuTooltip) {
		this->menuTooltip = menuTooltip; 
	};
	
	
	
	void OnNextHotSpotClicked();
	void OnPrevHotSpotClicked();
	
	RECT getButtonRect();
	UINT getCommandID();
	BOOL isButtonClicked();
	void setButtonClicked(BOOL value);
	HWND getMenuHandle();
	void removeRssFile(bool justRemoveRssFile = false);
private:

	UINT commandID;
	CString newsHeader;
	RECT buttonRect;
	CString nameOfButton;
	POINT menuPosition;
	CString dummyNewsItem;
	
	RRPRssParser *rssParser;//("sample-rss-092.xml");
	RRPMenuTooltip *menuTooltip;
	RRPDebugInfoLogger *debug;
	RRPRssFetcher *rssFetcher;
	RRPToolbar *rrpToolbar;
	IWebBrowser2 *webBrowser;
	
	char *rssFileName;
	static int buttonsCount;
	volatile BOOL buttonClicked;
	int startIndex,endIndex;
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
India India
Quote : "Life is all about solving problems and enjoying their solutions !! "

Comments and Discussions