mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Controls4U: ActiveX controls now can be enabled and disabled with SetStatus
git-svn-id: svn://ultimatepp.org/upp/trunk@2475 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
0c6f651021
commit
22fe7328bf
7 changed files with 128 additions and 51 deletions
|
|
@ -42,26 +42,42 @@ bool CBSTR::Set(const String str) {
|
|||
return BSTRSet(str, bstr);
|
||||
}
|
||||
|
||||
DHCtrlActiveX::DHCtrlActiveX(CLSID clsid, const String name) : oleObj(0), pClientSite(0), clsid(clsid), name(name) {}
|
||||
DHCtrlActiveX::DHCtrlActiveX(CLSID clsid, const String name, bool status) :
|
||||
oleObj(0), pClientSite(0), clsid(clsid), name(name), status(status) {}
|
||||
|
||||
DHCtrlActiveX::~DHCtrlActiveX(void) {
|
||||
Detach();
|
||||
}
|
||||
|
||||
|
||||
DHCtrlActiveX &DHCtrlActiveX::SetStatus(bool _status) {
|
||||
status = _status;
|
||||
if (status) {
|
||||
Attach(GetHWND());
|
||||
EnableWindow(GetHWND(), true);
|
||||
BackPaint(NOBACKPAINT);
|
||||
} else {
|
||||
Detach();
|
||||
BackPaint(FULLBACKPAINT);
|
||||
}
|
||||
return *this;
|
||||
};
|
||||
|
||||
LRESULT DHCtrlActiveX::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
switch (message) {
|
||||
case WM_SIZE: DoResize();
|
||||
break;
|
||||
case WM_CREATE: Attach(GetHWND());
|
||||
EnableWindow(GetHWND(), true);
|
||||
break;
|
||||
if (status) {
|
||||
switch (message) {
|
||||
case WM_SIZE: DoResize();
|
||||
break;
|
||||
case WM_CREATE: Attach(GetHWND());
|
||||
EnableWindow(GetHWND(), true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return DHCtrl::WindowProc(message, wParam, lParam);
|
||||
}
|
||||
|
||||
void *DHCtrlActiveX::QueryInterface(const IID iid) {
|
||||
void *ret;
|
||||
if (!oleObj)
|
||||
if (!oleObj || !status)
|
||||
return NULL;
|
||||
if (S_OK != oleObj->QueryInterface(iid, &ret))
|
||||
return NULL;
|
||||
|
|
@ -76,12 +92,13 @@ void DHCtrlActiveX::Detach() {
|
|||
|
||||
oleObj->Close(OLECLOSE_NOSAVE);
|
||||
oleObj->Release();
|
||||
oleObj = 0;
|
||||
}
|
||||
|
||||
void DHCtrlActiveX::DoResize() {
|
||||
if(!pClientSite.hwnd)
|
||||
return;
|
||||
if (!oleObj)
|
||||
if (!oleObj || !status)
|
||||
return;
|
||||
|
||||
RECT rect;
|
||||
|
|
@ -95,7 +112,7 @@ void DHCtrlActiveX::DoResize() {
|
|||
}
|
||||
|
||||
bool DHCtrlActiveX::Attach(HWND hwnd) {
|
||||
if (hwnd == (HWND)-1 || hwnd == 0)
|
||||
if (hwnd == (HWND)-1 || hwnd == 0 || !status)
|
||||
return false;
|
||||
if(pClientSite.hwnd && pClientSite.hwnd != hwnd)
|
||||
Detach();
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ static const CLSID CLSID_MozillaBrowser = {0x1339B54C, 0x3453, 0x11D2, {0x93, 0x
|
|||
|
||||
class FirefoxBrowser : public DHCtrlActiveX {
|
||||
public:
|
||||
FirefoxBrowser() : DHCtrlActiveX(CLSID_MozillaBrowser, "Firefox") {};
|
||||
FirefoxBrowser(bool status = true) : DHCtrlActiveX(CLSID_MozillaBrowser, "Firefox", status) {};
|
||||
|
||||
bool Browse(const String &url);
|
||||
bool ShowHTML(const String &html);
|
||||
|
|
@ -38,10 +38,14 @@ private:
|
|||
class IIWebBrowser {
|
||||
public:
|
||||
IIWebBrowser(FirefoxBrowser *obj) {
|
||||
web = (IWebBrowser2 *)obj->QueryInterface(IID_IWebBrowser2);
|
||||
if (obj->GetStatus())
|
||||
web = (IWebBrowser2 *)obj->QueryInterface(IID_IWebBrowser2);
|
||||
else
|
||||
web = 0;
|
||||
}
|
||||
~IIWebBrowser() {
|
||||
web->Release();
|
||||
if (web)
|
||||
web->Release();
|
||||
}
|
||||
operator IWebBrowser2 *() {return web;}
|
||||
IWebBrowser2 * operator ->() {return web;}
|
||||
|
|
@ -52,7 +56,7 @@ private:
|
|||
|
||||
class IExplorerBrowser : public DHCtrlActiveX {
|
||||
public:
|
||||
IExplorerBrowser() : DHCtrlActiveX(CLSID_WebBrowser, "IExplorer") {};
|
||||
IExplorerBrowser(bool status = true) : DHCtrlActiveX(CLSID_WebBrowser, "IExplorer", status) {};
|
||||
|
||||
bool Browse(const String &url);
|
||||
bool ShowHTML(const String &html);
|
||||
|
|
@ -70,10 +74,14 @@ private:
|
|||
class IIWebBrowser {
|
||||
public:
|
||||
IIWebBrowser(IExplorerBrowser *obj) {
|
||||
web = (IWebBrowser2 *)obj->QueryInterface(IID_IWebBrowser2);
|
||||
if (obj->GetStatus())
|
||||
web = (IWebBrowser2 *)obj->QueryInterface(IID_IWebBrowser2);
|
||||
else
|
||||
web = 0;
|
||||
}
|
||||
~IIWebBrowser() {
|
||||
web->Release();
|
||||
if (web)
|
||||
web->Release();
|
||||
}
|
||||
operator IWebBrowser2 *() {return web;}
|
||||
IWebBrowser2 * operator ->() {return web;}
|
||||
|
|
@ -87,7 +95,7 @@ static const CLSID CLSID_VLCPLayer = {0x9BE31822, 0xFDAD, 0x461B, {0xAD, 0x51, 0
|
|||
|
||||
class VLCPlayer : public DHCtrlActiveX {
|
||||
public:
|
||||
VLCPlayer() : DHCtrlActiveX(CLSID_VLCPLayer, "VLCPlayer") {};
|
||||
VLCPlayer(bool status = true) : DHCtrlActiveX(CLSID_VLCPLayer, "VLCPlayer", status) {};
|
||||
|
||||
bool AddTarget(const String movie);
|
||||
bool Play();
|
||||
|
|
@ -109,10 +117,14 @@ private:
|
|||
class IIVLC {
|
||||
public:
|
||||
IIVLC(VLCPlayer *obj) {
|
||||
vlc = (IVLCControl *)obj->QueryInterface(IID_IVLCControl);
|
||||
if (obj->GetStatus())
|
||||
vlc = (IVLCControl *)obj->QueryInterface(IID_IVLCControl);
|
||||
else
|
||||
vlc = 0;
|
||||
}
|
||||
~IIVLC() {
|
||||
vlc->Release();
|
||||
if (vlc)
|
||||
vlc->Release();
|
||||
}
|
||||
operator IVLCControl *() {return vlc;}
|
||||
IVLCControl * operator ->() {return vlc;}
|
||||
|
|
@ -122,4 +134,4 @@ private:
|
|||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -92,12 +92,14 @@ public:
|
|||
|
||||
class DHCtrlActiveX : public DHCtrl {
|
||||
public:
|
||||
DHCtrlActiveX(CLSID, const String);
|
||||
DHCtrlActiveX(CLSID, const String, bool status = true);
|
||||
~DHCtrlActiveX(void);
|
||||
|
||||
bool Attach(HWND hwnd);
|
||||
void *QueryInterface(const IID iid);
|
||||
bool IsLoaded() {return oleObj != NULL;}
|
||||
DHCtrlActiveX &SetStatus(bool _status);
|
||||
bool GetStatus() {return status;};
|
||||
|
||||
protected:
|
||||
void Detach();
|
||||
|
|
@ -111,6 +113,7 @@ private:
|
|||
CLSID clsid;
|
||||
String name;
|
||||
IOleObject *oleObj;
|
||||
bool status;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1129,13 +1129,17 @@ FileBrowser::FileBrowser() {
|
|||
files.AddColumn(t_("Name")).Add(3).Margin(2).Edit(textFileName)./*SetDisplay(Single<DisplayNameIcon>()).*/HeaderTab().Min(50).WhenAction = THISBACK1(SortByColumn, 0);
|
||||
files.AddColumn(t_("Size")).HeaderTab().Min(50).WhenAction = THISBACK1(SortByColumn, 1);
|
||||
files.AddColumn(t_("Date")).HeaderTab().Min(50).WhenAction = THISBACK1(SortByColumn, 2);
|
||||
files.AddColumn("IsFolder");
|
||||
files.AddColumn("RealSize");
|
||||
files.HeaderObject().ShowTab(3, false);
|
||||
//files.HeaderObject().ShowTab(4, false);
|
||||
files.MultiSelect().HeaderObject().Absolute().Clipboard();
|
||||
files.BackPaintHint();
|
||||
files.AddIndex();
|
||||
files.VertGrid(false).HorzGrid(false);
|
||||
files.SetLineCy((int)(0.85*EditString::GetStdHeight()));
|
||||
files.HeaderTab(0).SetRatio(10);
|
||||
files.ColumnWidths("200 50 110");
|
||||
files.ColumnWidths("200 60 120");
|
||||
files.EvenRowColor(Blend(SColorMark, SColorPaper, 240));
|
||||
// files.SetLabel(&label);
|
||||
|
||||
|
|
@ -1199,7 +1203,7 @@ void FileBrowser::ListFiles(String folderName, bool &thereIsAFolder) {
|
|||
if (fileData.GetCount() == 0) {
|
||||
int cy = files.GetLineCy();
|
||||
Image img = Rescale(CtrlImg::information(), cy, cy);
|
||||
files.Add(t_("No files or access not permitted"), "", "", img);
|
||||
files.Add(t_("No files or access not permitted"), "", "", img, false, 0);
|
||||
files.SetDisplay(0, 0, pd);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1212,9 +1216,12 @@ void FileBrowser::ListFiles(String folderName, bool &thereIsAFolder) {
|
|||
bool isFolder = fileData[i].isFolder;
|
||||
|
||||
if (isFolder)
|
||||
thereIsAFolder = true;
|
||||
files.Add(fullFilename, isFolder ? 0 : fileData[i].length, fileData[i].t,
|
||||
NativePathIconX(fullFilename, DirectoryExistsX(fullFilename, fileFlags), fileFlags));
|
||||
thereIsAFolder = true;
|
||||
files.Add(fullFilename,
|
||||
isFolder ? "" : BytesToString(fileData[i].length),
|
||||
fileData[i].t,
|
||||
NativePathIconX(fullFilename, DirectoryExistsX(fullFilename, fileFlags), fileFlags),
|
||||
isFolder ? fileName : "ZZZZZ" + fileName, fileData[i].length);
|
||||
files.SetDisplay(files.GetCount() - 1, 0, pd);
|
||||
}
|
||||
}
|
||||
|
|
@ -1300,17 +1307,44 @@ void FileBrowser::FolderChanged() {
|
|||
void FileBrowser::FilesEnterRow() {
|
||||
int i = 1;
|
||||
}
|
||||
/*
|
||||
int StdValueCompare(const Value& a, const Value& b, int language)
|
||||
{
|
||||
LTIMING("StdValueCompare");
|
||||
|
||||
bool na = IsNull(a), nb = IsNull(b);
|
||||
if(na || nb)
|
||||
return !na ? 1 : !nb ? -1 : 0;
|
||||
dword ta = a.GetType(), tb = b.GetType();
|
||||
if((ta == INT_V || ta == BOOL_V) && (tb == INT_V || tb == BOOL_V))
|
||||
return cmp<int>(a, b);
|
||||
if((ta == BOOL_V || ta == INT_V || ta == INT64_V || ta == DOUBLE_V)
|
||||
&& (tb == BOOL_V || tb == INT_V || tb == INT64_V || tb == DOUBLE_V))
|
||||
return cmp<double>(a, b);
|
||||
if(ta == DATE_V && tb == DATE_V)
|
||||
return cmp<Date>(a, b);
|
||||
if((ta == DATE_V || ta == TIME_V) && (tb == DATE_V || tb == TIME_V))
|
||||
return cmp<Time>(a, b);
|
||||
if((ta == STRING_V || ta == WSTRING_V) && (tb == STRING_V || tb == WSTRING_V))
|
||||
return GetLanguageInfo(language).Compare(WString(a), WString(b));
|
||||
return cmp<int>(ta, tb);
|
||||
}
|
||||
*/
|
||||
void FileBrowser::SortByColumn(int col) {
|
||||
static bool order[] = {true, true, true};
|
||||
|
||||
if (col < 0 || col > 2)
|
||||
return;
|
||||
|
||||
|
||||
int ordercol = col;
|
||||
if (col == 0)
|
||||
ordercol = 4;
|
||||
else if (col == 1)
|
||||
ordercol = 5;
|
||||
if (order[col])
|
||||
files.Sort(col, StdValueCompare);
|
||||
files.Sort(ordercol, StdValueCompare);
|
||||
else
|
||||
files.Sort(col, StdValueCompareDesc);
|
||||
files.Sort(ordercol, StdValueCompareDesc);
|
||||
order[col] = !order[col];
|
||||
}
|
||||
|
||||
|
|
@ -1320,4 +1354,4 @@ String FileBrowser::GetFile() {
|
|||
|
||||
String FileBrowser::GetFolder() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -899,7 +899,8 @@ ctrl FirefoxBrowser {
|
|||
GetMinSize() { return Size(0, 0); }
|
||||
GetStdSize() { return Size(140, 140); }
|
||||
|
||||
Frame SetFrame @1;
|
||||
Frame SetFrame @1;
|
||||
bool SetStatus = true;
|
||||
|
||||
Paint(w) {
|
||||
r = GetRect();
|
||||
|
|
@ -922,7 +923,8 @@ ctrl IExplorerBrowser {
|
|||
GetMinSize() { return Size(0, 0); }
|
||||
GetStdSize() { return Size(130, 130); }
|
||||
|
||||
Frame SetFrame @1;
|
||||
Frame SetFrame @1;
|
||||
bool SetStatus = true;
|
||||
|
||||
Paint(w) {
|
||||
r = GetRect();
|
||||
|
|
@ -945,7 +947,8 @@ ctrl VLCPlayer {
|
|||
GetMinSize() { return Size(0, 0); }
|
||||
GetStdSize() { return Size(120, 120); }
|
||||
|
||||
Frame SetFrame @1;
|
||||
Frame SetFrame @1;
|
||||
bool SetStatus = true;
|
||||
|
||||
Paint(w) {
|
||||
r = GetRect();
|
||||
|
|
|
|||
|
|
@ -3,19 +3,26 @@ topic "News and changes log";
|
|||
[a83;*R6 $$1,0#31310162474203024125188417583966:caption]
|
||||
[{_}%EN-US
|
||||
[s0; [*R+184 Controls4U. News and changes log]&]
|
||||
[s0;2 &]
|
||||
[s0;2 &]
|
||||
[s0; [2 2010/05/31-|New mode single threaded in addition to multi threaded
|
||||
(MT).]&]
|
||||
[s0;l576; [2 In this case Meter handle has not sensitivity and StaticClock
|
||||
SetAuto mode is not activated.]&]
|
||||
[s0; [2 2010/05/24-|Added ActiveX classes]&]
|
||||
[s0; [2 2009/12/29-|StaticImage default background color is transparent]&]
|
||||
[s0; [2 -|-|StaticImage: Added UseAsBackground() and removed ImageFit`::Background.]&]
|
||||
[s0; [2 2009/12/25-|StaticClock SetAuto mode uses less resources]&]
|
||||
[s0; [2 2009/12/23-|StaticClock as new SetAuto mode: the clock does not
|
||||
need to be refreshed as it runs by -|-|itself]&]
|
||||
[s0; [2 2009/12/15-|Added SetOrientation() and SetEnds() using enum
|
||||
as suggested by andrei`_natanael]&]
|
||||
[s0; [2 2009/12/02-|Created Controls4U]&]
|
||||
[s0;%- &]
|
||||
[ {{1441:8559f0;g0;^t/25b/25 [s0;# [2 2010/06/11]]
|
||||
:: [s0; [2 Added SetStatus to ActiveX controls.]]
|
||||
:: [s0;# [2 2010/05/31]]
|
||||
:: [s0; [2 New mode single threaded in addition to multi threaded (MT).]&]
|
||||
[s0;# [2 In this case Meter handle has not sensitivity and StaticClock
|
||||
SetAuto mode is not activated.]]
|
||||
:: [s0;# [2 2010/05/24]]
|
||||
:: [s0;# [2 Added ActiveX classes.]]
|
||||
:: [s0;# [2 2009/12/29]]
|
||||
:: [s0; [2 StaticImage default background color is transparent.]&]
|
||||
[s0;# [2 StaticImage: Added UseAsBackground() and removed ImageFit`::Background.]]
|
||||
:: [s0;# [2 2009/12/25]]
|
||||
:: [s0;# [2 StaticClock SetAuto mode uses less resources.]]
|
||||
:: [s0;# [2 2009/12/23]]
|
||||
:: [s0;# [2 StaticClock as new SetAuto mode: the clock does not need to
|
||||
be refreshed as it runs by itself.]]
|
||||
:: [s0;# [2 2009/12/15]]
|
||||
:: [s0;# [2 Added SetOrientation() and SetEnds() using enum as suggested
|
||||
by andrei`_natanael.]]
|
||||
:: [s0;# [2 2009/12/02]]
|
||||
:: [s0;# [2 Created Controls4U.]]}}&]
|
||||
[s0; ]
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
TITLE("News and changes log")
|
||||
COMPRESSED
|
||||
120,156,133,82,93,107,27,49,16,252,43,11,77,75,146,246,108,233,62,252,113,121,114,221,20,242,144,20,226,26,10,135,73,228,211,250,44,114,150,194,173,46,33,212,253,239,93,217,113,109,131,161,247,114,72,154,157,153,157,221,2,206,206,196,23,241,65,252,231,203,191,225,66,181,181,159,21,106,144,92,93,222,247,184,78,114,93,34,19,41,100,47,78,251,105,44,18,17,167,50,206,228,96,144,202,126,54,72,134,189,94,94,170,103,111,156,157,21,191,31,254,124,188,190,139,166,19,40,72,92,65,113,121,255,89,14,82,24,59,235,27,87,83,58,237,192,29,190,18,40,171,161,92,42,91,33,65,237,170,217,167,89,192,199,112,252,135,34,134,88,72,209,21,89,55,145,209,154,75,97,229,52,2,25,91,213,8,126,217,160,210,168,193,88,80,90,155,224,1,188,131,21,247,96,246,175,231,183,63,47,58,239,18,117,214,239,109,120,111,24,185,52,4,165,34,132,91,244,216,0,251,209,204,186,84,4,214,121,32,180,196,148,47,198,191,109,252,78,188,242,166,28,215,174,124,130,
|
||||
9,250,81,27,148,130,27,179,197,171,146,193,202,163,222,105,29,218,143,211,104,61,210,193,205,40,192,240,23,148,181,34,66,58,194,138,97,87,198,221,120,24,173,183,98,55,43,85,33,232,237,84,96,174,202,167,170,113,109,200,206,213,174,9,194,190,81,150,158,85,131,214,31,48,69,235,35,134,28,182,210,83,194,17,125,253,199,114,126,177,233,171,193,149,123,225,215,13,244,187,241,143,121,190,199,116,78,249,203,118,236,39,194,104,41,140,20,137,152,151,92,219,148,167,91,76,142,41,66,228,60,220,67,166,156,231,131,156,82,120,214,14,183,25,91,100,163,12,152,35,211,47,88,97,201,103,46,54,30,154,214,18,204,223,54,189,27,79,88,47,78,232,202,108,55,6,150,250,209,24,142,77,133,173,121,143,130,47,175,173,38,62,181,97,197,0,109,187,10,244,212,86,188,169,60,218,32,192,192,6,205,227,131,85,94,89,133,245,9,25,17,71,235,49,111,95,168,216,239,254,14,56,251,11,208,47,34,11,
|
||||
120,156,133,83,109,107,219,48,16,254,43,7,109,71,219,173,177,228,151,212,113,62,101,93,7,253,208,14,154,5,6,198,107,21,251,226,136,58,82,177,228,148,18,242,223,119,138,67,26,179,153,5,2,182,116,247,188,221,57,133,211,83,246,133,157,176,255,252,146,111,184,16,77,101,179,84,196,193,248,242,113,72,125,156,250,2,30,112,198,135,126,120,29,250,44,96,126,200,253,136,199,113,200,175,163,56,24,13,135,73,46,94,173,212,42,75,55,79,219,179,219,135,171,217,20,82,195,198,144,94,62,126,230,113,8,55,90,217,90,87,38,156,13,224,1,223,12,8,85,64,190,20,170,68,3,149,46,179,79,153,171,63,187,2,122,128,205,134,135,33,79,226,40,26,45,216,184,100,227,223,214,243,163,57,253,119,168,39,144,250,224,51,206,60,54,244,56,207,178,36,217,179,249,48,41,10,44,96,138,118,106,133,109,12,88,13,147,220,202,53,254,130,124,175,97,112,104,56,2,138,188,160,11,68,42,97,165,11,4,35,85,89,33,216,101,141,194,97,75,5,162,40,164,179,235,208,
|
||||
87,20,151,252,184,61,191,255,121,49,216,187,217,193,223,81,213,82,26,200,133,65,184,71,139,53,144,237,130,16,151,194,128,210,22,12,42,67,112,107,105,223,119,177,56,229,50,191,169,116,254,226,140,76,26,199,226,148,200,182,94,56,63,194,98,209,99,196,15,187,231,109,36,135,20,42,97,12,254,29,2,27,121,220,247,252,81,39,132,86,202,221,74,148,8,69,187,26,48,23,249,75,89,235,198,13,80,87,186,118,178,108,45,148,121,21,53,42,219,49,127,212,159,236,117,204,12,78,204,215,3,198,249,197,206,115,141,43,189,166,219,93,233,119,105,159,147,228,163,166,79,107,212,61,239,205,173,49,110,201,208,24,162,49,186,169,243,126,251,65,63,164,155,22,237,196,49,114,66,163,69,74,212,93,23,26,219,241,40,36,31,84,48,71,162,91,16,227,146,222,169,89,90,168,27,101,96,254,78,143,6,171,69,143,6,30,253,107,124,68,251,163,150,148,175,112,139,183,79,141,14,111,85,97,232,173,113,91,10,168,154,149,163,50,77,73,223,21,109,136,35,163,194,26,229,243,
|
||||
147,18,86,40,129,85,15,45,243,187,231,55,180,208,14,225,232,203,205,178,237,182,29,46,100,127,0,117,158,83,40,
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue