Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
no6no6 committed Jun 20, 2017
2 parents e88b51b + 822f994 commit af7273e
Show file tree
Hide file tree
Showing 12 changed files with 152 additions and 136 deletions.
2 changes: 2 additions & 0 deletions Demos/duidemo/MainWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ void CMainWnd::InitWindow()
pListItem->SetChildVAlign(DT_VCENTER);
pListItem->SetFixedHeight(30);
pListItem->SetManager(&m_pm, NULL, false);
pListItem->SetFixedWidth(100);
pList->Add(pListItem);
CButtonUI* pBtn1 = new CButtonUI();
pBtn1->SetManager(&m_pm, NULL, false);
Expand All @@ -142,6 +143,7 @@ void CMainWnd::InitWindow()

CDialogBuilder builder1;
CListContainerElementUI* pListItem1 = (CListContainerElementUI*)builder1.Create(_T("listitem.xml"), NULL, this, &m_pm, NULL);

pList->Add(pListItem1);
for(int i = 0; i < 20; i++)
{
Expand Down
4 changes: 2 additions & 2 deletions DuiLib/Control/UIActiveX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ namespace DuiLib {
void CActiveXUI::ReleaseControl()
{
// ÒƳýÏûÏ¢Á´
m_pManager->RemoveMessageFilter(this);
if(m_pManager != NULL) m_pManager->RemoveMessageFilter(this);

if( m_pUnk != NULL ) {
IObjectWithSite* pSite = NULL;
Expand Down Expand Up @@ -1208,7 +1208,7 @@ namespace DuiLib {
if( (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME) == 0 ) {
try
{
Hr = m_pUnk->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, pOleClientSite, 0, m_pManager->GetPaintWindow(), &m_rcItem);
if(m_pManager != NULL) Hr = m_pUnk->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, pOleClientSite, 0, m_pManager->GetPaintWindow(), &m_rcItem);
}
catch (...)
{
Expand Down
1 change: 1 addition & 0 deletions DuiLib/Control/UIButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ namespace DuiLib
int iTop = rcSrc.top;
int iBottom = iTop + szStatus.cy;
m_sHotImage.Format(_T("res='%s' restype='%s' dest='%d,%d,%d,%d' source='%d,%d,%d,%d'"), info.sImageName.GetData(), info.sResType.GetData(), info.rcDest.left, info.rcDest.top, info.rcDest.right, info.rcDest.bottom, iLeft, iTop, iRight, iBottom);
m_sPushedImage.Format(_T("res='%s' restype='%s' dest='%d,%d,%d,%d' source='%d,%d,%d,%d'"), info.sImageName.GetData(), info.sResType.GetData(), info.rcDest.left, info.rcDest.top, info.rcDest.right, info.rcDest.bottom, iLeft, iTop, iRight, iBottom);
}
if(m_nStateCount > 2) {
int iLeft = rcSrc.left + 2 * szStatus.cx;
Expand Down
3 changes: 2 additions & 1 deletion DuiLib/Control/UIList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ namespace DuiLib {
if( pListItem != NULL ) {
pListItem->SetOwner(this);
pListItem->SetIndex(GetCount());
return m_pList->Add(pControl);
}
return m_pList->Add(pControl);
return CVerticalLayoutUI::Add(pControl);
}

bool CListUI::AddAt(CControlUI* pControl, int iIndex)
Expand Down
1 change: 0 additions & 1 deletion DuiLib/Control/UIList.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ namespace DuiLib {

virtual BOOL CheckColumEditable(int nColum) { return FALSE; };
virtual CEditUI* GetEditUI() { return NULL; };

virtual BOOL CheckColumComboBoxable(int nColum) { return FALSE; };
virtual CComboBoxUI* GetComboBoxUI() { return NULL; };

Expand Down
2 changes: 1 addition & 1 deletion DuiLib/Control/UIMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ namespace DuiLib {
if( pDefaultAttributes ) {
m_pLayout->ApplyAttributeList(pDefaultAttributes);
}
m_pLayout->SetAutoDestroy(false);
m_pLayout->GetList()->SetAutoDestroy(false);

for( int i = 0; i < m_pOwner->GetCount(); i++ ) {
if(m_pOwner->GetItemAt(i)->GetInterface(_T("MenuElement")) != NULL ){
Expand Down
1 change: 1 addition & 0 deletions DuiLib/Control/UIOption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ namespace DuiLib
int iTop = rcSrc.top;
int iBottom = iTop + szStatus.cy;
m_sSelectedHotImage.Format(_T("res='%s' restype='%s' dest='%d,%d,%d,%d' source='%d,%d,%d,%d'"), info.sImageName.GetData(), info.sResType.GetData(), info.rcDest.left, info.rcDest.top, info.rcDest.right, info.rcDest.bottom, iLeft, iTop, iRight, iBottom);
m_sSelectedPushedImage.Format(_T("res='%s' restype='%s' dest='%d,%d,%d,%d' source='%d,%d,%d,%d'"), info.sImageName.GetData(), info.sResType.GetData(), info.rcDest.left, info.rcDest.top, info.rcDest.right, info.rcDest.bottom, iLeft, iTop, iRight, iBottom);
}
if(m_nSelectedStateCount > 2) {
int iLeft = rcSrc.left + 2 * szStatus.cx;
Expand Down
178 changes: 89 additions & 89 deletions DuiLib/Control/UIOption.h
Original file line number Diff line number Diff line change
@@ -1,96 +1,96 @@
#ifndef __UIOPTION_H__
#define __UIOPTION_H__

#pragma once

namespace DuiLib
{
class UILIB_API COptionUI : public CButtonUI
{
#ifndef __UIOPTION_H__
#define __UIOPTION_H__

#pragma once

namespace DuiLib
{
class UILIB_API COptionUI : public CButtonUI
{
DECLARE_DUICONTROL(COptionUI)
public:
COptionUI();
~COptionUI();

LPCTSTR GetClass() const;
LPVOID GetInterface(LPCTSTR pstrName);

void SetManager(CPaintManagerUI* pManager, CControlUI* pParent, bool bInit = true);

bool Activate();
void SetEnabled(bool bEnable = true);

LPCTSTR GetSelectedImage();
void SetSelectedImage(LPCTSTR pStrImage);

LPCTSTR GetSelectedHotImage();
void SetSelectedHotImage(LPCTSTR pStrImage);

LPCTSTR GetSelectedPushedImage();
void SetSelectedPushedImage(LPCTSTR pStrImage);

void SetSelectedTextColor(DWORD dwTextColor);
DWORD GetSelectedTextColor();

void SetSelectedBkColor(DWORD dwBkColor);
DWORD GetSelectBkColor();

LPCTSTR GetSelectedForedImage();
void SetSelectedForedImage(LPCTSTR pStrImage);

public:
COptionUI();
~COptionUI();

LPCTSTR GetClass() const;
LPVOID GetInterface(LPCTSTR pstrName);

void SetManager(CPaintManagerUI* pManager, CControlUI* pParent, bool bInit = true);

bool Activate();
void SetEnabled(bool bEnable = true);

LPCTSTR GetSelectedImage();
void SetSelectedImage(LPCTSTR pStrImage);

LPCTSTR GetSelectedHotImage();
void SetSelectedHotImage(LPCTSTR pStrImage);

LPCTSTR GetSelectedPushedImage();
void SetSelectedPushedImage(LPCTSTR pStrImage);

void SetSelectedTextColor(DWORD dwTextColor);
DWORD GetSelectedTextColor();

void SetSelectedBkColor(DWORD dwBkColor);
DWORD GetSelectBkColor();

LPCTSTR GetSelectedForedImage();
void SetSelectedForedImage(LPCTSTR pStrImage);

void SetSelectedStateCount(int nCount);
int GetSelectedStateCount() const;
virtual LPCTSTR GetSelectedStateImage();
virtual void SetSelectedStateImage(LPCTSTR pStrImage);

LPCTSTR GetGroup() const;
void SetGroup(LPCTSTR pStrGroupName = NULL);
bool IsSelected() const;
virtual void Selected(bool bSelected);

void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);

void PaintBkColor(HDC hDC);
void PaintStatusImage(HDC hDC);
void PaintForeImage(HDC hDC);
void PaintText(HDC hDC);

protected:
bool m_bSelected;
CDuiString m_sGroupName;

DWORD m_dwSelectedBkColor;
DWORD m_dwSelectedTextColor;

CDuiString m_sSelectedImage;
CDuiString m_sSelectedHotImage;
CDuiString m_sSelectedPushedImage;
CDuiString m_sSelectedForeImage;

virtual void SetSelectedStateImage(LPCTSTR pStrImage);

LPCTSTR GetGroup() const;
void SetGroup(LPCTSTR pStrGroupName = NULL);
bool IsSelected() const;
virtual void Selected(bool bSelected);

void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);

void PaintBkColor(HDC hDC);
void PaintStatusImage(HDC hDC);
void PaintForeImage(HDC hDC);
void PaintText(HDC hDC);

protected:
bool m_bSelected;
CDuiString m_sGroupName;

DWORD m_dwSelectedBkColor;
DWORD m_dwSelectedTextColor;

CDuiString m_sSelectedImage;
CDuiString m_sSelectedHotImage;
CDuiString m_sSelectedPushedImage;
CDuiString m_sSelectedForeImage;

int m_nSelectedStateCount;
CDuiString m_sSelectedStateImage;
};

class UILIB_API CCheckBoxUI : public COptionUI
{
CDuiString m_sSelectedStateImage;
};

class UILIB_API CCheckBoxUI : public COptionUI
{
DECLARE_DUICONTROL(CCheckBoxUI)

public:
virtual LPCTSTR GetClass() const;
virtual LPVOID GetInterface(LPCTSTR pstrName);

void SetCheck(bool bCheck);
bool GetCheck() const;
protected:
bool m_bAutoCheck;

public:
CCheckBoxUI();
virtual void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
void SetAutoCheck(bool bEnable);
virtual void DoEvent(TEventUI& event);
virtual void Selected(bool bSelected);
};
} // namespace DuiLib


public:
virtual LPCTSTR GetClass() const;
virtual LPVOID GetInterface(LPCTSTR pstrName);

void SetCheck(bool bCheck);
bool GetCheck() const;
protected:
bool m_bAutoCheck;

public:
CCheckBoxUI();
virtual void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
void SetAutoCheck(bool bEnable);
virtual void DoEvent(TEventUI& event);
virtual void Selected(bool bSelected);
};
} // namespace DuiLib

#endif // __UIOPTION_H__
40 changes: 20 additions & 20 deletions DuiLib/Core/UIManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,22 +272,22 @@ namespace DuiLib {

static HINSTANCE GetInstance();
static CDuiString GetInstancePath();
static CDuiString GetCurrentPath();
static HINSTANCE GetResourceDll();
static const CDuiString& GetResourcePath();
static CDuiString GetCurrentPath();
static HINSTANCE GetResourceDll();
static const CDuiString& GetResourcePath();
static const CDuiString& GetResourceZip();
static const CDuiString& GetResourceZipPwd();
static bool IsCachedResourceZip();
static HANDLE GetResourceZipHandle();
static void SetInstance(HINSTANCE hInst);
static void SetCurrentPath(LPCTSTR pStrPath);
static void SetResourceDll(HINSTANCE hInst);
static const CDuiString& GetResourceZipPwd();
static bool IsCachedResourceZip();
static HANDLE GetResourceZipHandle();
static void SetInstance(HINSTANCE hInst);
static void SetCurrentPath(LPCTSTR pStrPath);
static void SetResourceDll(HINSTANCE hInst);
static void SetResourcePath(LPCTSTR pStrPath);
static void SetResourceZip(LPVOID pVoid, unsigned int len, LPCTSTR password = NULL);
static void SetResourceZip(LPCTSTR pstrZip, bool bCachedResourceZip = false, LPCTSTR password = NULL);
static void SetResourceType(int nType);
static int GetResourceType();
static bool GetHSL(short* H, short* S, short* L);
static void SetResourceZip(LPCTSTR pstrZip, bool bCachedResourceZip = false, LPCTSTR password = NULL);
static void SetResourceType(int nType);
static int GetResourceType();
static bool GetHSL(short* H, short* S, short* L);
static void SetHSL(bool bUseHSL, short H, short S, short L); // H:0~360, S:0~200, L:0~200
static void ReloadSkin();
static CPaintManagerUI* GetPaintManager(LPCTSTR pstrName);
Expand Down Expand Up @@ -541,14 +541,14 @@ namespace DuiLib {
HBITMAP m_hDragBitmap;

//
static HINSTANCE m_hInstance;
static HINSTANCE m_hResourceInstance;
static CDuiString m_pStrResourcePath;
static HINSTANCE m_hInstance;
static HINSTANCE m_hResourceInstance;
static CDuiString m_pStrResourcePath;
static CDuiString m_pStrResourceZip;
static CDuiString m_pStrResourceZipPwd;
static HANDLE m_hResourceZip;
static bool m_bCachedResourceZip;
static int m_nResType;
static CDuiString m_pStrResourceZipPwd;
static HANDLE m_hResourceZip;
static bool m_bCachedResourceZip;
static int m_nResType;
static TResInfo m_SharedResInfo;
static bool m_bUseHSL;
static short m_H;
Expand Down
28 changes: 14 additions & 14 deletions DuiLib/Core/UIRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,13 @@ namespace DuiLib {
delete[] pData;
pData = NULL;
break;
}
}
else {
}
}
else {
sFile += CPaintManagerUI::GetResourceZip();
CDuiString sFilePwd = CPaintManagerUI::GetResourceZipPwd(); //Garfield 20160325 带密码zip包解密
HZIP hz = NULL;
if( CPaintManagerUI::IsCachedResourceZip() ) hz = (HZIP)CPaintManagerUI::GetResourceZipHandle();
CDuiString sFilePwd = CPaintManagerUI::GetResourceZipPwd(); //Garfield 20160325 带密码zip包解密
HZIP hz = NULL;
if( CPaintManagerUI::IsCachedResourceZip() ) hz = (HZIP)CPaintManagerUI::GetResourceZipHandle();
else
{
#ifdef UNICODE
Expand All @@ -325,12 +325,12 @@ namespace DuiLib {
#else
hz = OpenZip(sFile.GetData(), sFilePwd.GetData());
#endif
}
if( hz == NULL ) break;
ZIPENTRY ze;
int i = 0;
CDuiString key = bitmap.m_lpstr;
key.Replace(_T("\\"), _T("/"));
}
if( hz == NULL ) break;
ZIPENTRY ze;
int i = 0;
CDuiString key = bitmap.m_lpstr;
key.Replace(_T("\\"), _T("/"));
if( FindZipItem(hz, key, true, &i, &ze) != 0 ) break;
dwSize = ze.unc_size;
if( dwSize == 0 ) break;
Expand Down Expand Up @@ -512,8 +512,8 @@ namespace DuiLib {
#endif
}
if( hz == NULL ) break;
ZIPENTRY ze;
int i = 0;
ZIPENTRY ze;
int i = 0;
CDuiString key = bitmap.m_lpstr;
key.Replace(_T("\\"), _T("/"));
if( FindZipItem(hz, key, true, &i, &ze) != 0 ) break;
Expand Down
6 changes: 3 additions & 3 deletions DuiLib/Layout/UIHorizontalLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ namespace DuiLib

// Determine the minimum size
SIZE szAvailable = { rc.right - rc.left, rc.bottom - rc.top };
if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() )
szAvailable.cx += m_pHorizontalScrollBar->GetScrollRange();
//if( m_pHorizontalScrollBar && m_pHorizontalScrollBar->IsVisible() )
// szAvailable.cx += m_pHorizontalScrollBar->GetScrollRange();
if( m_pVerticalScrollBar && m_pVerticalScrollBar->IsVisible() )
szAvailable.cy += m_pVerticalScrollBar->GetScrollRange();

Expand Down Expand Up @@ -125,7 +125,7 @@ namespace DuiLib
if (iControlMaxHeight <= 0) iControlMaxHeight = pControl->GetMaxHeight();
if (szControlAvailable.cx > iControlMaxWidth) szControlAvailable.cx = iControlMaxWidth;
if (szControlAvailable.cy > iControlMaxHeight) szControlAvailable.cy = iControlMaxHeight;
cxFixedRemaining = cxFixedRemaining - (rcPadding.left + rcPadding.right);
cxFixedRemaining = cxFixedRemaining - (rcPadding.left + rcPadding.right);
if (iEstimate > 1) cxFixedRemaining = cxFixedRemaining - m_iChildPadding;
SIZE sz = pControl->EstimateSize(szControlAvailable);
if( sz.cx == 0 ) {
Expand Down
Loading

0 comments on commit af7273e

Please sign in to comment.