Initial commit
This commit is contained in:
@@ -0,0 +1,175 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef NotificationExUnitH
|
||||
#define NotificationExUnitH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <Data.DBXJSON.hpp>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
#include <System.IOUtils.hpp>
|
||||
#include <Urlmon.h>
|
||||
#include <wininet.h>
|
||||
#pragma comment(lib, "urlmon.lib")
|
||||
#pragma comment(lib, "wininet.lib")
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#define JSON_PIC_DERICTORY L"temp\\JSON\\"
|
||||
#define JSON_PIC_DERICTORY_AD L"AD\\"
|
||||
#define JSON_PIC_DERICTORY_CONTENT L"CONTENT\\"
|
||||
#define JSON_PIC_DERICTORY_TEXT L"TEXT\\"
|
||||
|
||||
typedef struct tagJson{
|
||||
String strName;
|
||||
String strNamePic;
|
||||
String strFileUrl;
|
||||
String strUrl;
|
||||
String strAuthor;
|
||||
}TJSON, *PTJSON;
|
||||
typedef vector<TJSON> VCTJSON;
|
||||
typedef vector<PTJSON> VCPTJSON;
|
||||
//extern VCTJSON::iterator vc_pFindAD;
|
||||
//extern VCTJSON::iterator vc_pFindNoti;
|
||||
|
||||
typedef struct tagJsonDB{ //ͬÀàÐ͵Ä
|
||||
String strDbName;
|
||||
VCTJSON vcContent;
|
||||
}TJSONDB, *PTJSONDB;
|
||||
typedef vector<TJSONDB> VCTJSONDB;
|
||||
typedef vector<PTJSONDB> VCPTJSONDB;
|
||||
|
||||
//extern VCTJSONDB::iterator vc_pFindContent;
|
||||
//extern VCTJSON::iterator vc_pFindContentPIC;
|
||||
|
||||
TJSONObject* __fastcall GetJsonContext(String strContextNoti);
|
||||
TJSONObject* __fastcall GetJsonValue(TJSONObject *json, int index);
|
||||
//---------------------------------------------------------------------------
|
||||
static const COLORREF
|
||||
CLR_TEXT_NORMAL = RGB( 156, 170, 189 ),
|
||||
CLR_TEXT_ENTER = RGB( 100, 180, 236 ),
|
||||
CLR_TEXT_LEAVE = RGB( 67, 117, 233 );
|
||||
//---------------------------------------------------------------------------
|
||||
#define UrlDown_Notification 0
|
||||
#define UrlDown_ImageCover 1
|
||||
|
||||
void __fastcall StopURLDownload(int iWhereIs=UrlDown_Notification);
|
||||
|
||||
class CBindCBHttpCallback : public IBindStatusCallback
|
||||
{
|
||||
public:
|
||||
CBindCBHttpCallback(){};
|
||||
~CBindCBHttpCallback(){};
|
||||
|
||||
STDMETHOD(OnStartBinding)(DWORD dwReserved, IBinding __RPC_FAR *pib);
|
||||
STDMETHOD(OnStopBinding)(HRESULT hresult, LPCWSTR szError);
|
||||
|
||||
STDMETHOD(OnProgress)(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode,
|
||||
LPCWSTR wszStatusText)
|
||||
{ return E_NOTIMPL; }
|
||||
STDMETHOD(GetPriority)(LONG __RPC_FAR *pnPriority)
|
||||
{ return E_NOTIMPL; }
|
||||
STDMETHOD(OnLowResource)(DWORD reserved)
|
||||
{ return E_NOTIMPL; }
|
||||
STDMETHOD(GetBindInfo)(DWORD __RPC_FAR *grfBINDF, BINDINFO __RPC_FAR *pbindinfo)
|
||||
{ return E_NOTIMPL; }
|
||||
STDMETHOD(OnDataAvailable)(DWORD grfBSCF, DWORD dwSize, FORMATETC __RPC_FAR *pformatetc,
|
||||
STGMEDIUM __RPC_FAR *pstgmed)
|
||||
{ return E_NOTIMPL; }
|
||||
STDMETHOD(OnObjectAvailable)(REFIID riid, IUnknown __RPC_FAR *punk)
|
||||
{ return E_NOTIMPL; }
|
||||
STDMETHOD_(ULONG,AddRef)()
|
||||
{ return 0; }
|
||||
STDMETHOD_(ULONG,Release)()
|
||||
{ return 0; }
|
||||
STDMETHOD(QueryInterface)(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject)
|
||||
{ return E_NOTIMPL; }
|
||||
|
||||
int iWhereIs;
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class TUrlLabel : public Vcl::Stdctrls::TLabel{
|
||||
|
||||
private:
|
||||
TColor FColorNor;
|
||||
TColor FColorEnt;
|
||||
TColor FColorLea;
|
||||
|
||||
bool FCloseForm;
|
||||
String FStrUrl;
|
||||
void __fastcall SetStrUrl(String url);
|
||||
|
||||
TNotifyEvent FOnMouseEnter;//on mouse enter notify event
|
||||
TNotifyEvent FOnMouseLeave;//on mouse leave notify event
|
||||
|
||||
DYNAMIC void __fastcall Click(void);
|
||||
MESSAGE void __fastcall CMMouseEnter(Winapi::Messages::TMessage &Msg); // to know when mouse is entered
|
||||
MESSAGE void __fastcall CMMouseLeave(Winapi::Messages::TMessage &Msg); // to know when mouse is leaved
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(CM_MOUSEENTER, TMessage, CMMouseEnter)
|
||||
MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave)
|
||||
END_MESSAGE_MAP(TLabel)
|
||||
public:
|
||||
__fastcall TUrlLabel( TComponent* Owner);
|
||||
__fastcall ~TUrlLabel();
|
||||
|
||||
__published:
|
||||
__property bool CloseForm = {read=FCloseForm, write=FCloseForm, default=false};
|
||||
__property String StrUrl = {read=FStrUrl, write=SetStrUrl};
|
||||
__property System::Classes::TNotifyEvent OnMouseEnter = {read=FOnMouseEnter, write=FOnMouseEnter};
|
||||
__property System::Classes::TNotifyEvent OnMouseLeave = {read=FOnMouseLeave, write=FOnMouseLeave};
|
||||
__property TColor ColorNor = {read=FColorNor, write=FColorNor, default=CLR_TEXT_NORMAL};
|
||||
__property TColor ColorEnt = {read=FColorEnt, write=FColorEnt, default=CLR_TEXT_NORMAL};
|
||||
__property TColor ColorLea = {read=FColorLea, write=FColorLea, default=CLR_TEXT_NORMAL};
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TUrlPaintBox : public Vcl::Extctrls::TPaintBox{
|
||||
|
||||
private:
|
||||
String FStrUrl;
|
||||
TPicture *FGraphicImg;
|
||||
bool FCloseForm;
|
||||
int FState;
|
||||
int FStateCount;
|
||||
int FIndex;
|
||||
void __fastcall SetStrGraphicName(String strGraphicName);
|
||||
void __fastcall SetGraphicImg(TPicture *GraphicImg);
|
||||
void __fastcall SetStrUrl(String strUrl);
|
||||
void __fastcall SetStateCount(int stateCount);
|
||||
|
||||
TNotifyEvent FOnMouseEnter;//on mouse enter notify event
|
||||
TNotifyEvent FOnMouseLeave;//on mouse leave notify event
|
||||
|
||||
DYNAMIC void __fastcall Click(void);
|
||||
MESSAGE void __fastcall CMMouseEnter(Winapi::Messages::TMessage &Msg); // to know when mouse is entered
|
||||
MESSAGE void __fastcall CMMouseLeave(Winapi::Messages::TMessage &Msg); // to know when mouse is leaved
|
||||
|
||||
virtual void __fastcall Paint(void);
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(CM_MOUSEENTER, TMessage, CMMouseEnter)
|
||||
MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave)
|
||||
END_MESSAGE_MAP(TPaintBox)
|
||||
|
||||
public:
|
||||
__fastcall TUrlPaintBox( TComponent* Owner, TPicture * graphicImg=NULL);
|
||||
__fastcall ~TUrlPaintBox();
|
||||
|
||||
__published:
|
||||
__property bool CloseForm = {read=FCloseForm, write=FCloseForm, default=false};
|
||||
__property int State = {read=FState, write=FState, default=0};
|
||||
__property int StateCount = {read=FStateCount, write=SetStateCount, default=1};
|
||||
__property int Index = {read=FIndex, write=FIndex, default=0};
|
||||
__property TPicture *GraphicImg = {read=FGraphicImg, write=SetGraphicImg};
|
||||
__property String StrUrl = {read=FStrUrl, write=SetStrUrl};
|
||||
__property System::Classes::TNotifyEvent OnMouseEnter = {read=FOnMouseEnter, write=FOnMouseEnter};
|
||||
__property System::Classes::TNotifyEvent OnMouseLeave = {read=FOnMouseLeave, write=FOnMouseLeave};
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool __fastcall GetPic(String &name, bool bCopy=false);
|
||||
HRESULT GetUrlData(String url, String fileDirect, String &fileName, TStringStream *fileToSteam=NULL, bool bfileToStream=false, int iWhereIs=UrlDown_Notification);
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
Reference in New Issue
Block a user