port(2V0-a): EterPythonLib 窗口系统的头进镜像
2V0 的入口实测:audit/slices/2V0.json 的 212 个头里 164 个已经在镜像中,缺 48 个 (1 个 EterLib、5 个 EterPythonLib、42 个 UserInterface);10 个单元里已移植 2 个。 本轮补 EterPythonLib 这 5 个,外加必须先有的 EterPythonLib/StdAfx.h —— port_header_gate 按 40250 的做法把每个头放在所属库的 StdAfx.h 后面编译,没有它这五个既看不到 <Python.h> 也看不到 STL 和 CSingleton。 6 个文件全是 port_copy.py 的机械拷贝,0 处手改。 顺带修正清单的一处误报:EterLib/Dimm.h 不是 40250 的源文件,是 Windows SDK <dimm.h> 的 MIDL 产物,port/common/shim/win32/Dimm.h 已经顶掉了;镜像一份反而遮住 shim, EterLib/IME.h 的 #include "Dimm.h" 会去找 rpc.h。拷进来验证后删掉。 只有头,没有 .cpp,所以没有 port-map 条目 —— 只有声明,没有可调用的东西。 port_header_gate 新增 6 个 TU 全绿;ctest 27/27。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
|
||||
#include "../EterLib/GrpTextInstance.h"
|
||||
#include "../EterLib/GrpMarkInstance.h"
|
||||
#include "../EterLib/GrpImageInstance.h"
|
||||
#include "../EterLib/GrpExpandedImageInstance.h"
|
||||
|
||||
#include "../EterGrnLib/ThingInstance.h"
|
||||
|
||||
class CPythonGraphic : public CScreen, public CSingleton<CPythonGraphic>
|
||||
{
|
||||
public:
|
||||
CPythonGraphic();
|
||||
virtual ~CPythonGraphic();
|
||||
|
||||
void Destroy();
|
||||
|
||||
void PushState();
|
||||
void PopState();
|
||||
|
||||
LPDIRECT3D8 GetD3D();
|
||||
|
||||
float GetOrthoDepth();
|
||||
void SetInterfaceRenderState();
|
||||
void SetGameRenderState();
|
||||
|
||||
void SetCursorPosition(int x, int y);
|
||||
|
||||
void SetOmniLight();
|
||||
|
||||
void SetViewport(float fx, float fy, float fWidth, float fHeight);
|
||||
void RestoreViewport();
|
||||
|
||||
long GenerateColor(float r, float g, float b, float a);
|
||||
void RenderDownButton(float sx, float sy, float ex, float ey);
|
||||
void RenderUpButton(float sx, float sy, float ex, float ey);
|
||||
|
||||
void RenderImage(CGraphicImageInstance* pImageInstance, float x, float y);
|
||||
void RenderAlphaImage(CGraphicImageInstance* pImageInstance, float x, float y, float aLeft, float aRight);
|
||||
void RenderCoolTimeBox(float fxCenter, float fyCenter, float fRadius, float fTime);
|
||||
|
||||
bool SaveJPEG(const char * pszFileName, LPBYTE pbyBuffer, UINT uWidth, UINT uHeight);
|
||||
bool SaveScreenShot(const char *szFileName);
|
||||
|
||||
DWORD GetAvailableMemory();
|
||||
void SetGamma(float fGammaFactor = 1.0f);
|
||||
|
||||
protected:
|
||||
typedef struct SState
|
||||
{
|
||||
D3DXMATRIX matView;
|
||||
D3DXMATRIX matProj;
|
||||
} TState;
|
||||
|
||||
DWORD m_lightColor;
|
||||
DWORD m_darkColor;
|
||||
|
||||
protected:
|
||||
std::stack<TState> m_stateStack;
|
||||
|
||||
D3DXMATRIX m_SaveWorldMatrix;
|
||||
|
||||
CCullingManager m_CullingManager;
|
||||
|
||||
D3DVIEWPORT8 m_backupViewport;
|
||||
|
||||
float m_fOrthoDepth;
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include "PythonSlotWindow.h"
|
||||
|
||||
namespace UI
|
||||
{
|
||||
class CGridSlotWindow : public CSlotWindow
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
|
||||
public:
|
||||
CGridSlotWindow(PyObject * ppyObject);
|
||||
virtual ~CGridSlotWindow();
|
||||
|
||||
void Destroy();
|
||||
|
||||
void ArrangeGridSlot(DWORD dwStartIndex, DWORD dwxCount, DWORD dwyCount, int ixSlotSize, int iySlotSize, int ixTemporarySize, int iyTemporarySize);
|
||||
|
||||
protected:
|
||||
void __Initialize();
|
||||
|
||||
BOOL GetPickedSlotPointer(TSlot ** ppSlot);
|
||||
BOOL GetPickedSlotList(int iWidth, int iHeight, std::list<TSlot*> * pSlotPointerList);
|
||||
BOOL GetGridSlotPointer(int ix, int iy, TSlot ** ppSlot);
|
||||
BOOL GetPickedGridSlotPosition(int ixLocal, int iyLocal, int * pix, int * piy);
|
||||
BOOL CheckMoving(DWORD dwSlotNumber, DWORD dwItemIndex, const std::list<TSlot*> & c_rSlotList);
|
||||
|
||||
BOOL OnIsType(DWORD dwType);
|
||||
|
||||
void OnRefreshSlot();
|
||||
void OnRenderPickingSlot();
|
||||
|
||||
protected:
|
||||
DWORD m_dwxCount;
|
||||
DWORD m_dwyCount;
|
||||
|
||||
std::vector<TSlot *> m_SlotVector;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,211 @@
|
||||
#pragma once
|
||||
|
||||
#include "PythonWindow.h"
|
||||
|
||||
namespace UI
|
||||
{
|
||||
enum
|
||||
{
|
||||
ITEM_WIDTH = 32,
|
||||
ITEM_HEIGHT = 32,
|
||||
|
||||
SLOT_NUMBER_NONE = 0xffffffff,
|
||||
};
|
||||
|
||||
enum ESlotStyle
|
||||
{
|
||||
SLOT_STYLE_NONE,
|
||||
SLOT_STYLE_PICK_UP,
|
||||
SLOT_STYLE_SELECT,
|
||||
};
|
||||
|
||||
enum ESlotState
|
||||
{
|
||||
SLOT_STATE_LOCK = (1 << 0),
|
||||
SLOT_STATE_CANT_USE = (1 << 1),
|
||||
SLOT_STATE_DISABLE = (1 << 2),
|
||||
SLOT_STATE_ALWAYS_RENDER_COVER = (1 << 3), // 현재 Cover 버튼은 슬롯에 무언가 들어와 있을 때에만 렌더링 하는데, 이 flag가 있으면 빈 슬롯이어도 커버 렌더링
|
||||
};
|
||||
|
||||
class CSlotWindow : public CWindow
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
|
||||
public:
|
||||
class CSlotButton;
|
||||
class CCoverButton;
|
||||
class CCoolTimeFinishEffect;
|
||||
|
||||
friend class CSlotButton;
|
||||
friend class CCoverButton;
|
||||
|
||||
typedef struct SSlot
|
||||
{
|
||||
DWORD dwState;
|
||||
DWORD dwSlotNumber;
|
||||
DWORD dwCenterSlotNumber; // NOTE : 사이즈가 큰 아이템의 경우 아이템의 실제 위치 번호
|
||||
DWORD dwItemIndex; // NOTE : 여기서 사용되는 Item이라는 단어는 좁은 개념의 것이 아닌,
|
||||
BOOL isItem; // "슬롯의 내용물"이라는 포괄적인 개념어. 더 좋은 것이 있을까? - [levites]
|
||||
|
||||
// CoolTime
|
||||
float fCoolTime;
|
||||
float fStartCoolTime;
|
||||
|
||||
// Toggle
|
||||
BOOL bActive;
|
||||
|
||||
int ixPosition;
|
||||
int iyPosition;
|
||||
|
||||
int ixCellSize;
|
||||
int iyCellSize;
|
||||
|
||||
BYTE byxPlacedItemSize;
|
||||
BYTE byyPlacedItemSize;
|
||||
|
||||
CGraphicImageInstance * pInstance;
|
||||
CNumberLine * pNumberLine;
|
||||
|
||||
bool bRenderBaseSlotImage;
|
||||
CCoverButton * pCoverButton;
|
||||
CSlotButton * pSlotButton;
|
||||
CImageBox * pSignImage;
|
||||
CAniImageBox * pFinishCoolTimeEffect;
|
||||
} TSlot;
|
||||
typedef std::list<TSlot> TSlotList;
|
||||
typedef TSlotList::iterator TSlotListIterator;
|
||||
|
||||
public:
|
||||
CSlotWindow(PyObject * ppyObject);
|
||||
virtual ~CSlotWindow();
|
||||
|
||||
void Destroy();
|
||||
|
||||
// Manage Slot
|
||||
void SetSlotType(DWORD dwType);
|
||||
void SetSlotStyle(DWORD dwStyle);
|
||||
|
||||
void AppendSlot(DWORD dwIndex, int ixPosition, int iyPosition, int ixCellSize, int iyCellSize);
|
||||
void SetCoverButton(DWORD dwIndex, const char * c_szUpImageName, const char * c_szOverImageName, const char * c_szDownImageName, const char * c_szDisableImageName, BOOL bLeftButtonEnable, BOOL bRightButtonEnable);
|
||||
void SetSlotBaseImage(const char * c_szFileName, float fr, float fg, float fb, float fa);
|
||||
void AppendSlotButton(const char * c_szUpImageName, const char * c_szOverImageName, const char * c_szDownImageName);
|
||||
void AppendRequirementSignImage(const char * c_szImageName);
|
||||
|
||||
void EnableCoverButton(DWORD dwIndex);
|
||||
void DisableCoverButton(DWORD dwIndex);
|
||||
void SetAlwaysRenderCoverButton(DWORD dwIndex, bool bAlwaysRender = false);
|
||||
|
||||
void ShowSlotBaseImage(DWORD dwIndex);
|
||||
void HideSlotBaseImage(DWORD dwIndex);
|
||||
BOOL IsDisableCoverButton(DWORD dwIndex);
|
||||
BOOL HasSlot(DWORD dwIndex);
|
||||
|
||||
void ClearAllSlot();
|
||||
void ClearSlot(DWORD dwIndex);
|
||||
void SetSlot(DWORD dwIndex, DWORD dwVirtualNumber, BYTE byWidth, BYTE byHeight, CGraphicImage * pImage, D3DXCOLOR& diffuseColor);
|
||||
void SetSlotCount(DWORD dwIndex, DWORD dwCount);
|
||||
void SetSlotCountNew(DWORD dwIndex, DWORD dwGrade, DWORD dwCount);
|
||||
void SetSlotCoolTime(DWORD dwIndex, float fCoolTime, float fElapsedTime = 0.0f);
|
||||
void ActivateSlot(DWORD dwIndex);
|
||||
void DeactivateSlot(DWORD dwIndex);
|
||||
void RefreshSlot();
|
||||
|
||||
DWORD GetSlotCount();
|
||||
|
||||
void LockSlot(DWORD dwIndex);
|
||||
void UnlockSlot(DWORD dwIndex);
|
||||
BOOL IsLockSlot(DWORD dwIndex);
|
||||
void SetCantUseSlot(DWORD dwIndex);
|
||||
void SetUseSlot(DWORD dwIndex);
|
||||
BOOL IsCantUseSlot(DWORD dwIndex);
|
||||
void EnableSlot(DWORD dwIndex);
|
||||
void DisableSlot(DWORD dwIndex);
|
||||
BOOL IsEnableSlot(DWORD dwIndex);
|
||||
|
||||
// Select
|
||||
void ClearSelected();
|
||||
void SelectSlot(DWORD dwSelectingIndex);
|
||||
BOOL isSelectedSlot(DWORD dwIndex);
|
||||
DWORD GetSelectedSlotCount();
|
||||
DWORD GetSelectedSlotNumber(DWORD dwIndex);
|
||||
|
||||
// Slot Button
|
||||
void ShowSlotButton(DWORD dwSlotNumber);
|
||||
void HideAllSlotButton();
|
||||
void OnPressedSlotButton(DWORD dwType, DWORD dwSlotNumber, BOOL isLeft = TRUE);
|
||||
|
||||
// Requirement Sign
|
||||
void ShowRequirementSign(DWORD dwSlotNumber);
|
||||
void HideRequirementSign(DWORD dwSlotNumber);
|
||||
|
||||
// ToolTip
|
||||
BOOL OnOverInItem(DWORD dwSlotNumber);
|
||||
void OnOverOutItem();
|
||||
|
||||
// For Usable Item
|
||||
void SetUseMode(BOOL bFlag);
|
||||
void SetUsableItem(BOOL bFlag);
|
||||
|
||||
// CallBack
|
||||
void ReserveDestroyCoolTimeFinishEffect(DWORD dwSlotIndex);
|
||||
|
||||
protected:
|
||||
void __Initialize();
|
||||
void __CreateToggleSlotImage();
|
||||
void __CreateSlotEnableEffect();
|
||||
void __CreateFinishCoolTimeEffect(TSlot * pSlot);
|
||||
void __CreateBaseImage(const char * c_szFileName, float fr, float fg, float fb, float fa);
|
||||
|
||||
void __DestroyToggleSlotImage();
|
||||
void __DestroySlotEnableEffect();
|
||||
void __DestroyFinishCoolTimeEffect(TSlot * pSlot);
|
||||
void __DestroyBaseImage();
|
||||
|
||||
// Event
|
||||
void OnUpdate();
|
||||
void OnRender();
|
||||
BOOL OnMouseLeftButtonDown();
|
||||
BOOL OnMouseLeftButtonUp();
|
||||
BOOL OnMouseRightButtonDown();
|
||||
BOOL OnMouseLeftButtonDoubleClick();
|
||||
void OnMouseOverOut();
|
||||
void OnMouseOver();
|
||||
void RenderSlotBaseImage();
|
||||
void RenderLockedSlot();
|
||||
virtual void OnRenderPickingSlot();
|
||||
virtual void OnRenderSelectedSlot();
|
||||
|
||||
// Select
|
||||
void OnSelectEmptySlot(int iSlotNumber);
|
||||
void OnSelectItemSlot(int iSlotNumber);
|
||||
void OnUnselectEmptySlot(int iSlotNumber);
|
||||
void OnUnselectItemSlot(int iSlotNumber);
|
||||
void OnUseSlot();
|
||||
|
||||
// Manage Slot
|
||||
BOOL GetSlotPointer(DWORD dwIndex, TSlot ** ppSlot);
|
||||
BOOL GetSelectedSlotPointer(TSlot ** ppSlot);
|
||||
virtual BOOL GetPickedSlotPointer(TSlot ** ppSlot);
|
||||
void ClearSlot(TSlot * pSlot);
|
||||
virtual void OnRefreshSlot();
|
||||
|
||||
// ETC
|
||||
BOOL OnIsType(DWORD dwType);
|
||||
|
||||
protected:
|
||||
DWORD m_dwSlotType;
|
||||
DWORD m_dwSlotStyle;
|
||||
std::list<DWORD> m_dwSelectedSlotIndexList;
|
||||
TSlotList m_SlotList;
|
||||
DWORD m_dwToolTipSlotNumber;
|
||||
|
||||
BOOL m_isUseMode;
|
||||
BOOL m_isUsableItem;
|
||||
|
||||
CGraphicImageInstance * m_pBaseImageInstance;
|
||||
CImageBox * m_pToggleSlotImage;
|
||||
CAniImageBox * m_pSlotActiveEffect;
|
||||
std::deque<DWORD> m_ReserveDestroyEffectDeque;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,525 @@
|
||||
#pragma once
|
||||
|
||||
#include "../EterBase/Utils.h"
|
||||
|
||||
namespace UI
|
||||
{
|
||||
class CWindow
|
||||
{
|
||||
public:
|
||||
typedef std::list<CWindow *> TWindowContainer;
|
||||
|
||||
static DWORD Type();
|
||||
BOOL IsType(DWORD dwType);
|
||||
|
||||
enum EHorizontalAlign
|
||||
{
|
||||
HORIZONTAL_ALIGN_LEFT = 0,
|
||||
HORIZONTAL_ALIGN_CENTER = 1,
|
||||
HORIZONTAL_ALIGN_RIGHT = 2,
|
||||
};
|
||||
|
||||
enum EVerticalAlign
|
||||
{
|
||||
VERTICAL_ALIGN_TOP = 0,
|
||||
VERTICAL_ALIGN_CENTER = 1,
|
||||
VERTICAL_ALIGN_BOTTOM = 2,
|
||||
};
|
||||
|
||||
enum EFlags
|
||||
{
|
||||
FLAG_MOVABLE = (1 << 0), // 움직일 수 있는 창
|
||||
FLAG_LIMIT = (1 << 1), // 창이 화면을 벗어나지 않음
|
||||
FLAG_SNAP = (1 << 2), // 스냅 될 수 있는 창
|
||||
FLAG_DRAGABLE = (1 << 3),
|
||||
FLAG_ATTACH = (1 << 4), // 완전히 부모에 붙어 있는 창 (For Drag / ex. ScriptWindow)
|
||||
FLAG_RESTRICT_X = (1 << 5), // 좌우 이동 제한
|
||||
FLAG_RESTRICT_Y = (1 << 6), // 상하 이동 제한
|
||||
FLAG_NOT_CAPTURE = (1 << 7),
|
||||
FLAG_FLOAT = (1 << 8), // 공중에 떠있어서 순서 재배치가 되는 창
|
||||
FLAG_NOT_PICK = (1 << 9), // 마우스에 의해 Pick되지 않는 창
|
||||
FLAG_IGNORE_SIZE = (1 << 10),
|
||||
FLAG_RTL = (1 << 11), // Right-to-left
|
||||
};
|
||||
|
||||
public:
|
||||
CWindow(PyObject * ppyObject);
|
||||
virtual ~CWindow();
|
||||
|
||||
void AddChild(CWindow * pWin);
|
||||
|
||||
void Clear();
|
||||
void DestroyHandle();
|
||||
void Update();
|
||||
void Render();
|
||||
|
||||
void SetName(const char * c_szName);
|
||||
const char * GetName() { return m_strName.c_str(); }
|
||||
void SetSize(long width, long height);
|
||||
long GetWidth() { return m_lWidth; }
|
||||
long GetHeight() { return m_lHeight; }
|
||||
|
||||
void SetHorizontalAlign(DWORD dwAlign);
|
||||
void SetVerticalAlign(DWORD dwAlign);
|
||||
void SetPosition(long x, long y);
|
||||
void GetPosition(long * plx, long * ply);
|
||||
long GetPositionX( void ) const { return m_x; }
|
||||
long GetPositionY( void ) const { return m_y; }
|
||||
RECT & GetRect() { return m_rect; }
|
||||
void GetLocalPosition(long & rlx, long & rly);
|
||||
void GetMouseLocalPosition(long & rlx, long & rly);
|
||||
long UpdateRect();
|
||||
|
||||
RECT & GetLimitBias() { return m_limitBiasRect; }
|
||||
void SetLimitBias(long l, long r, long t, long b) { m_limitBiasRect.left = l, m_limitBiasRect.right = r, m_limitBiasRect.top = t, m_limitBiasRect.bottom = b; }
|
||||
|
||||
void Show();
|
||||
void Hide();
|
||||
bool IsShow() { return m_bShow; }
|
||||
bool IsRendering();
|
||||
|
||||
bool HasParent() { return m_pParent ? true : false; }
|
||||
bool HasChild() { return m_pChildList.empty() ? false : true; }
|
||||
int GetChildCount() { return m_pChildList.size(); }
|
||||
|
||||
CWindow * GetRoot();
|
||||
CWindow * GetParent();
|
||||
bool IsChild(CWindow * pWin);
|
||||
void DeleteChild(CWindow * pWin);
|
||||
void SetTop(CWindow * pWin);
|
||||
|
||||
bool IsIn(long x, long y);
|
||||
bool IsIn();
|
||||
CWindow * PickWindow(long x, long y);
|
||||
CWindow * PickTopWindow(long x, long y); // NOTE : Children으로 내려가지 않고 상위에서만
|
||||
// 체크 하는 특화된 함수
|
||||
|
||||
void __RemoveReserveChildren();
|
||||
|
||||
void AddFlag(DWORD flag) { SET_BIT(m_dwFlag, flag); }
|
||||
void RemoveFlag(DWORD flag) { REMOVE_BIT(m_dwFlag, flag); }
|
||||
bool IsFlag(DWORD flag) { return (m_dwFlag & flag) ? true : false; }
|
||||
/////////////////////////////////////
|
||||
|
||||
virtual void OnRender();
|
||||
virtual void OnUpdate();
|
||||
virtual void OnChangePosition(){}
|
||||
|
||||
virtual void OnSetFocus();
|
||||
virtual void OnKillFocus();
|
||||
|
||||
virtual void OnMouseDrag(long lx, long ly);
|
||||
virtual void OnMouseOverIn();
|
||||
virtual void OnMouseOverOut();
|
||||
virtual void OnMouseOver();
|
||||
virtual void OnDrop();
|
||||
virtual void OnTop();
|
||||
virtual void OnIMEUpdate();
|
||||
|
||||
virtual void OnMoveWindow(long x, long y);
|
||||
|
||||
///////////////////////////////////////
|
||||
|
||||
BOOL RunIMETabEvent();
|
||||
BOOL RunIMEReturnEvent();
|
||||
BOOL RunIMEKeyDownEvent(int ikey);
|
||||
|
||||
CWindow * RunKeyDownEvent(int ikey);
|
||||
BOOL RunKeyUpEvent(int ikey);
|
||||
BOOL RunPressEscapeKeyEvent();
|
||||
BOOL RunPressExitKeyEvent();
|
||||
|
||||
virtual BOOL OnIMETabEvent();
|
||||
virtual BOOL OnIMEReturnEvent();
|
||||
virtual BOOL OnIMEKeyDownEvent(int ikey);
|
||||
|
||||
virtual BOOL OnIMEChangeCodePage();
|
||||
virtual BOOL OnIMEOpenCandidateListEvent();
|
||||
virtual BOOL OnIMECloseCandidateListEvent();
|
||||
virtual BOOL OnIMEOpenReadingWndEvent();
|
||||
virtual BOOL OnIMECloseReadingWndEvent();
|
||||
|
||||
virtual BOOL OnMouseLeftButtonDown();
|
||||
virtual BOOL OnMouseLeftButtonUp();
|
||||
virtual BOOL OnMouseLeftButtonDoubleClick();
|
||||
virtual BOOL OnMouseRightButtonDown();
|
||||
virtual BOOL OnMouseRightButtonUp();
|
||||
virtual BOOL OnMouseRightButtonDoubleClick();
|
||||
virtual BOOL OnMouseMiddleButtonDown();
|
||||
virtual BOOL OnMouseMiddleButtonUp();
|
||||
|
||||
virtual BOOL OnKeyDown(int ikey);
|
||||
virtual BOOL OnKeyUp(int ikey);
|
||||
virtual BOOL OnPressEscapeKey();
|
||||
virtual BOOL OnPressExitKey();
|
||||
///////////////////////////////////////
|
||||
|
||||
virtual void SetColor(DWORD dwColor){}
|
||||
virtual BOOL OnIsType(DWORD dwType);
|
||||
/////////////////////////////////////
|
||||
|
||||
virtual BOOL IsWindow() { return TRUE; }
|
||||
/////////////////////////////////////
|
||||
|
||||
protected:
|
||||
std::string m_strName;
|
||||
|
||||
EHorizontalAlign m_HorizontalAlign;
|
||||
EVerticalAlign m_VerticalAlign;
|
||||
long m_x, m_y; // X,Y 상대좌표
|
||||
long m_lWidth, m_lHeight; // 크기
|
||||
RECT m_rect; // Global 좌표
|
||||
RECT m_limitBiasRect; // limit bias 값
|
||||
|
||||
bool m_bMovable;
|
||||
bool m_bShow;
|
||||
|
||||
DWORD m_dwFlag;
|
||||
|
||||
PyObject * m_poHandler;
|
||||
|
||||
CWindow * m_pParent;
|
||||
TWindowContainer m_pChildList;
|
||||
|
||||
BOOL m_isUpdatingChildren;
|
||||
TWindowContainer m_pReserveChildList;
|
||||
|
||||
#ifdef _DEBUG
|
||||
public:
|
||||
DWORD DEBUG_dwCounter;
|
||||
#endif
|
||||
};
|
||||
|
||||
class CLayer : public CWindow
|
||||
{
|
||||
public:
|
||||
CLayer(PyObject * ppyObject) : CWindow(ppyObject) {}
|
||||
virtual ~CLayer() {}
|
||||
|
||||
BOOL IsWindow() { return FALSE; }
|
||||
};
|
||||
|
||||
class CBox : public CWindow
|
||||
{
|
||||
public:
|
||||
CBox(PyObject * ppyObject);
|
||||
virtual ~CBox();
|
||||
|
||||
void SetColor(DWORD dwColor);
|
||||
|
||||
protected:
|
||||
void OnRender();
|
||||
|
||||
protected:
|
||||
DWORD m_dwColor;
|
||||
};
|
||||
|
||||
class CBar : public CWindow
|
||||
{
|
||||
public:
|
||||
CBar(PyObject * ppyObject);
|
||||
virtual ~CBar();
|
||||
|
||||
void SetColor(DWORD dwColor);
|
||||
|
||||
protected:
|
||||
void OnRender();
|
||||
|
||||
protected:
|
||||
DWORD m_dwColor;
|
||||
};
|
||||
|
||||
class CLine : public CWindow
|
||||
{
|
||||
public:
|
||||
CLine(PyObject * ppyObject);
|
||||
virtual ~CLine();
|
||||
|
||||
void SetColor(DWORD dwColor);
|
||||
|
||||
protected:
|
||||
void OnRender();
|
||||
|
||||
protected:
|
||||
DWORD m_dwColor;
|
||||
};
|
||||
|
||||
class CBar3D : public CWindow
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
|
||||
public:
|
||||
CBar3D(PyObject * ppyObject);
|
||||
virtual ~CBar3D();
|
||||
|
||||
void SetColor(DWORD dwLeft, DWORD dwRight, DWORD dwCenter);
|
||||
|
||||
protected:
|
||||
void OnRender();
|
||||
|
||||
protected:
|
||||
DWORD m_dwLeftColor;
|
||||
DWORD m_dwRightColor;
|
||||
DWORD m_dwCenterColor;
|
||||
};
|
||||
|
||||
// Text
|
||||
class CTextLine : public CWindow
|
||||
{
|
||||
public:
|
||||
CTextLine(PyObject * ppyObject);
|
||||
virtual ~CTextLine();
|
||||
|
||||
void SetMax(int iMax);
|
||||
void SetHorizontalAlign(int iType);
|
||||
void SetVerticalAlign(int iType);
|
||||
void SetSecret(BOOL bFlag);
|
||||
void SetOutline(BOOL bFlag);
|
||||
void SetFeather(BOOL bFlag);
|
||||
void SetMultiLine(BOOL bFlag);
|
||||
void SetFontName(const char * c_szFontName);
|
||||
void SetFontColor(DWORD dwColor);
|
||||
void SetLimitWidth(float fWidth);
|
||||
|
||||
void ShowCursor();
|
||||
void HideCursor();
|
||||
int GetCursorPosition();
|
||||
|
||||
void SetText(const char * c_szText);
|
||||
const char * GetText();
|
||||
|
||||
void GetTextSize(int* pnWidth, int* pnHeight);
|
||||
|
||||
protected:
|
||||
void OnUpdate();
|
||||
void OnRender();
|
||||
void OnChangePosition();
|
||||
|
||||
virtual void OnSetText(const char * c_szText);
|
||||
|
||||
protected:
|
||||
CGraphicTextInstance m_TextInstance;
|
||||
};
|
||||
|
||||
class CNumberLine : public CWindow
|
||||
{
|
||||
public:
|
||||
CNumberLine(PyObject * ppyObject);
|
||||
CNumberLine(CWindow * pParent);
|
||||
virtual ~CNumberLine();
|
||||
|
||||
void SetPath(const char * c_szPath);
|
||||
void SetHorizontalAlign(int iType);
|
||||
void SetNumber(const char * c_szNumber);
|
||||
|
||||
protected:
|
||||
void ClearNumber();
|
||||
void OnRender();
|
||||
void OnChangePosition();
|
||||
|
||||
protected:
|
||||
std::string m_strPath;
|
||||
std::string m_strNumber;
|
||||
std::vector<CGraphicImageInstance *> m_ImageInstanceVector;
|
||||
|
||||
int m_iHorizontalAlign;
|
||||
DWORD m_dwWidthSummary;
|
||||
};
|
||||
|
||||
// Image
|
||||
class CImageBox : public CWindow
|
||||
{
|
||||
public:
|
||||
CImageBox(PyObject * ppyObject);
|
||||
virtual ~CImageBox();
|
||||
|
||||
BOOL LoadImage(const char * c_szFileName);
|
||||
void SetDiffuseColor(float fr, float fg, float fb, float fa);
|
||||
|
||||
int GetWidth();
|
||||
int GetHeight();
|
||||
|
||||
protected:
|
||||
virtual void OnCreateInstance();
|
||||
virtual void OnDestroyInstance();
|
||||
|
||||
virtual void OnUpdate();
|
||||
virtual void OnRender();
|
||||
void OnChangePosition();
|
||||
|
||||
protected:
|
||||
CGraphicImageInstance * m_pImageInstance;
|
||||
};
|
||||
class CMarkBox : public CWindow
|
||||
{
|
||||
public:
|
||||
CMarkBox(PyObject * ppyObject);
|
||||
virtual ~CMarkBox();
|
||||
|
||||
void LoadImage(const char * c_szFilename);
|
||||
void SetDiffuseColor(float fr, float fg, float fb, float fa);
|
||||
void SetIndex(UINT uIndex);
|
||||
void SetScale(FLOAT fScale);
|
||||
|
||||
protected:
|
||||
virtual void OnCreateInstance();
|
||||
virtual void OnDestroyInstance();
|
||||
|
||||
virtual void OnUpdate();
|
||||
virtual void OnRender();
|
||||
void OnChangePosition();
|
||||
protected:
|
||||
CGraphicMarkInstance * m_pMarkInstance;
|
||||
};
|
||||
class CExpandedImageBox : public CImageBox
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
|
||||
public:
|
||||
CExpandedImageBox(PyObject * ppyObject);
|
||||
virtual ~CExpandedImageBox();
|
||||
|
||||
void SetScale(float fx, float fy);
|
||||
void SetOrigin(float fx, float fy);
|
||||
void SetRotation(float fRotation);
|
||||
void SetRenderingRect(float fLeft, float fTop, float fRight, float fBottom);
|
||||
void SetRenderingMode(int iMode);
|
||||
|
||||
protected:
|
||||
void OnCreateInstance();
|
||||
void OnDestroyInstance();
|
||||
|
||||
virtual void OnUpdate();
|
||||
virtual void OnRender();
|
||||
|
||||
BOOL OnIsType(DWORD dwType);
|
||||
};
|
||||
class CAniImageBox : public CWindow
|
||||
{
|
||||
public:
|
||||
static DWORD Type();
|
||||
|
||||
public:
|
||||
CAniImageBox(PyObject * ppyObject);
|
||||
virtual ~CAniImageBox();
|
||||
|
||||
void SetDelay(int iDelay);
|
||||
void AppendImage(const char * c_szFileName);
|
||||
void SetRenderingRect(float fLeft, float fTop, float fRight, float fBottom);
|
||||
void SetRenderingMode(int iMode);
|
||||
|
||||
void ResetFrame();
|
||||
|
||||
protected:
|
||||
void OnUpdate();
|
||||
void OnRender();
|
||||
void OnChangePosition();
|
||||
virtual void OnEndFrame();
|
||||
|
||||
BOOL OnIsType(DWORD dwType);
|
||||
|
||||
protected:
|
||||
BYTE m_bycurDelay;
|
||||
BYTE m_byDelay;
|
||||
BYTE m_bycurIndex;
|
||||
std::vector<CGraphicExpandedImageInstance*> m_ImageVector;
|
||||
};
|
||||
|
||||
// Button
|
||||
class CButton : public CWindow
|
||||
{
|
||||
public:
|
||||
CButton(PyObject * ppyObject);
|
||||
virtual ~CButton();
|
||||
|
||||
BOOL SetUpVisual(const char * c_szFileName);
|
||||
BOOL SetOverVisual(const char * c_szFileName);
|
||||
BOOL SetDownVisual(const char * c_szFileName);
|
||||
BOOL SetDisableVisual(const char * c_szFileName);
|
||||
|
||||
const char * GetUpVisualFileName();
|
||||
const char * GetOverVisualFileName();
|
||||
const char * GetDownVisualFileName();
|
||||
|
||||
void Flash();
|
||||
void Enable();
|
||||
void Disable();
|
||||
|
||||
void SetUp();
|
||||
void Up();
|
||||
void Over();
|
||||
void Down();
|
||||
|
||||
BOOL IsDisable();
|
||||
BOOL IsPressed();
|
||||
|
||||
protected:
|
||||
void OnUpdate();
|
||||
void OnRender();
|
||||
void OnChangePosition();
|
||||
|
||||
BOOL OnMouseLeftButtonDown();
|
||||
BOOL OnMouseLeftButtonDoubleClick();
|
||||
BOOL OnMouseLeftButtonUp();
|
||||
void OnMouseOverIn();
|
||||
void OnMouseOverOut();
|
||||
|
||||
BOOL IsEnable();
|
||||
|
||||
void SetCurrentVisual(CGraphicImageInstance * pVisual);
|
||||
|
||||
protected:
|
||||
BOOL m_bEnable;
|
||||
BOOL m_isPressed;
|
||||
BOOL m_isFlash;
|
||||
CGraphicImageInstance * m_pcurVisual;
|
||||
CGraphicImageInstance m_upVisual;
|
||||
CGraphicImageInstance m_overVisual;
|
||||
CGraphicImageInstance m_downVisual;
|
||||
CGraphicImageInstance m_disableVisual;
|
||||
};
|
||||
class CRadioButton : public CButton
|
||||
{
|
||||
public:
|
||||
CRadioButton(PyObject * ppyObject);
|
||||
virtual ~CRadioButton();
|
||||
|
||||
protected:
|
||||
BOOL OnMouseLeftButtonDown();
|
||||
BOOL OnMouseLeftButtonUp();
|
||||
void OnMouseOverIn();
|
||||
void OnMouseOverOut();
|
||||
};
|
||||
class CToggleButton : public CButton
|
||||
{
|
||||
public:
|
||||
CToggleButton(PyObject * ppyObject);
|
||||
virtual ~CToggleButton();
|
||||
|
||||
protected:
|
||||
BOOL OnMouseLeftButtonDown();
|
||||
BOOL OnMouseLeftButtonUp();
|
||||
void OnMouseOverIn();
|
||||
void OnMouseOverOut();
|
||||
};
|
||||
class CDragButton : public CButton
|
||||
{
|
||||
public:
|
||||
CDragButton(PyObject * ppyObject);
|
||||
virtual ~CDragButton();
|
||||
|
||||
void SetRestrictMovementArea(int ix, int iy, int iwidth, int iheight);
|
||||
|
||||
protected:
|
||||
void OnChangePosition();
|
||||
void OnMouseOverIn();
|
||||
void OnMouseOverOut();
|
||||
|
||||
protected:
|
||||
RECT m_restrictArea;
|
||||
};
|
||||
};
|
||||
|
||||
extern BOOL g_bOutlineBoxEnable;
|
||||
@@ -0,0 +1,187 @@
|
||||
#pragma once
|
||||
|
||||
namespace UI
|
||||
{
|
||||
class CWindow;
|
||||
|
||||
class CWindowManager : public CSingleton<CWindowManager>
|
||||
{
|
||||
public:
|
||||
typedef std::map<std::string, CWindow *> TLayerContainer;
|
||||
typedef std::list<CWindow *> TWindowContainer;
|
||||
typedef std::map<int, CWindow *> TKeyCaptureWindowMap;
|
||||
|
||||
public:
|
||||
CWindowManager();
|
||||
virtual ~CWindowManager();
|
||||
|
||||
void Destroy();
|
||||
|
||||
float GetAspect();
|
||||
void SetScreenSize(long lWidth, long lHeight);
|
||||
void SetResolution(int hres, int vres);
|
||||
|
||||
void GetResolution(long & rx, long & ry)
|
||||
{
|
||||
rx=m_iHres;
|
||||
ry=m_iVres;
|
||||
}
|
||||
|
||||
void SetMouseHandler(PyObject * poMouseHandler);
|
||||
long GetScreenWidth() { return m_lWidth; }
|
||||
long GetScreenHeight() { return m_lHeight; }
|
||||
void GetMousePosition(long & rx, long & ry);
|
||||
BOOL IsDragging();
|
||||
|
||||
CWindow * GetLockWindow() { return m_pLockWindow; }
|
||||
CWindow * GetPointWindow() { return m_pPointWindow; }
|
||||
bool IsFocus() { return (m_pActiveWindow || m_pLockWindow); }
|
||||
bool IsFocusWindow(CWindow * pWindow) { return pWindow == m_pActiveWindow; }
|
||||
|
||||
void SetParent(CWindow * pWindow, CWindow * pParentWindow);
|
||||
void SetPickAlways(CWindow * pWindow);
|
||||
|
||||
enum
|
||||
{
|
||||
WT_NORMAL,
|
||||
WT_SLOT,
|
||||
WT_GRIDSLOT,
|
||||
WT_TEXTLINE,
|
||||
WT_MARKBOX,
|
||||
WT_IMAGEBOX,
|
||||
WT_EXP_IMAGEBOX,
|
||||
WT_ANI_IMAGEBOX,
|
||||
WT_BUTTON,
|
||||
WT_RATIOBUTTON,
|
||||
WT_TOGGLEBUTTON,
|
||||
WT_DRAGBUTTON,
|
||||
WT_BOX,
|
||||
WT_BAR,
|
||||
WT_LINE,
|
||||
WT_BAR3D,
|
||||
WT_NUMLINE,
|
||||
};
|
||||
|
||||
CWindow * RegisterWindow(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterTypeWindow(PyObject * po, DWORD dwWndType, const char * c_szLayer);
|
||||
|
||||
CWindow * RegisterSlotWindow(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterGridSlotWindow(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterTextLine(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterMarkBox(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterImageBox(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterExpandedImageBox(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterAniImageBox(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterButton(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterRadioButton(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterToggleButton(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterDragButton(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterBox(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterBar(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterLine(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterBar3D(PyObject * po, const char * c_szLayer);
|
||||
CWindow * RegisterNumberLine(PyObject * po, const char * c_szLayer);
|
||||
|
||||
void DestroyWindow(CWindow * pWin);
|
||||
void NotifyDestroyWindow(CWindow * pWindow);
|
||||
|
||||
// Attaching Icon
|
||||
BOOL IsAttaching();
|
||||
DWORD GetAttachingType();
|
||||
DWORD GetAttachingIndex();
|
||||
DWORD GetAttachingSlotNumber();
|
||||
void GetAttachingIconSize(BYTE * pbyWidth, BYTE * pbyHeight);
|
||||
void AttachIcon(DWORD dwType, DWORD dwIndex, DWORD dwSlotNumber, BYTE byWidth, BYTE byHeight);
|
||||
void DeattachIcon();
|
||||
void SetAttachingFlag(BOOL bFlag);
|
||||
// Attaching Icon
|
||||
|
||||
void OnceIgnoreMouseLeftButtonUpEvent();
|
||||
void LockWindow(CWindow * pWin);
|
||||
void UnlockWindow();
|
||||
|
||||
void ActivateWindow(CWindow * pWin);
|
||||
void DeactivateWindow();
|
||||
CWindow * GetActivateWindow();
|
||||
void SetTop(CWindow * pWin);
|
||||
void SetTopUIWindow();
|
||||
void ResetCapture();
|
||||
|
||||
void Update();
|
||||
void Render();
|
||||
|
||||
void RunMouseMove(long x, long y);
|
||||
void RunMouseLeftButtonDown(long x, long y);
|
||||
void RunMouseLeftButtonUp(long x, long y);
|
||||
void RunMouseLeftButtonDoubleClick(long x, long y);
|
||||
void RunMouseRightButtonDown(long x, long y);
|
||||
void RunMouseRightButtonUp(long x, long y);
|
||||
void RunMouseRightButtonDoubleClick(long x, long y);
|
||||
void RunMouseMiddleButtonDown(long x, long y);
|
||||
void RunMouseMiddleButtonUp(long x, long y);
|
||||
|
||||
void RunIMEUpdate();
|
||||
void RunIMETabEvent();
|
||||
void RunIMEReturnEvent();
|
||||
void RunIMEKeyDown(int vkey);
|
||||
void RunChangeCodePage();
|
||||
void RunOpenCandidate();
|
||||
void RunCloseCandidate();
|
||||
void RunOpenReading();
|
||||
void RunCloseReading();
|
||||
|
||||
void RunKeyDown(int vkey);
|
||||
void RunKeyUp(int vkey);
|
||||
void RunPressEscapeKey();
|
||||
void RunPressExitKey();
|
||||
|
||||
private:
|
||||
void SetMousePosition(long x, long y);
|
||||
CWindow * __PickWindow(long x, long y);
|
||||
|
||||
CWindow * __NewWindow(PyObject * po, DWORD dwWndType);
|
||||
void __ClearReserveDeleteWindowList();
|
||||
|
||||
private:
|
||||
long m_lWidth;
|
||||
long m_lHeight;
|
||||
|
||||
int m_iVres;
|
||||
int m_iHres;
|
||||
|
||||
long m_lMouseX, m_lMouseY;
|
||||
long m_lDragX, m_lDragY;
|
||||
long m_lPickedX, m_lPickedY;
|
||||
|
||||
BOOL m_bOnceIgnoreMouseLeftButtonUpEventFlag;
|
||||
int m_iIgnoreEndTime;
|
||||
|
||||
// Attaching Icon
|
||||
PyObject * m_poMouseHandler;
|
||||
BOOL m_bAttachingFlag;
|
||||
DWORD m_dwAttachingType;
|
||||
DWORD m_dwAttachingIndex;
|
||||
DWORD m_dwAttachingSlotNumber;
|
||||
BYTE m_byAttachingIconWidth;
|
||||
BYTE m_byAttachingIconHeight;
|
||||
// Attaching Icon
|
||||
|
||||
CWindow * m_pActiveWindow;
|
||||
TWindowContainer m_ActiveWindowList;
|
||||
CWindow * m_pLockWindow;
|
||||
TWindowContainer m_LockWindowList;
|
||||
CWindow * m_pPointWindow;
|
||||
CWindow * m_pLeftCaptureWindow;
|
||||
CWindow * m_pRightCaptureWindow;
|
||||
CWindow * m_pMiddleCaptureWindow;
|
||||
TKeyCaptureWindowMap m_KeyCaptureWindowMap;
|
||||
TWindowContainer m_ReserveDeleteWindowList;
|
||||
TWindowContainer m_PickAlwaysWindowList;
|
||||
|
||||
CWindow * m_pRootWindow;
|
||||
TWindowContainer m_LayerWindowList;
|
||||
TLayerContainer m_LayerWindowMap;
|
||||
};
|
||||
|
||||
PyObject * BuildEmptyTuple();
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#include "../EterLib/StdAfx.h"
|
||||
#include "../ScriptLib/StdAfx.h"
|
||||
|
||||
#include "PythonGraphic.h"
|
||||
#include "PythonWindowManager.h"
|
||||
|
||||
void initgrp();
|
||||
void initgrpImage();
|
||||
void initgrpText();
|
||||
void initgrpThing();
|
||||
void initscriptWindow();
|
||||
void initwndMgr();
|
||||
Reference in New Issue
Block a user