210 lines
5.5 KiB
C++
210 lines
5.5 KiB
C++
#pragma once
|
|
#include "KUIControl.h"
|
|
|
|
class KUIControlButton;
|
|
class KUIControlSimpleButton;
|
|
|
|
//
|
|
enum ESCROLL_TYPE
|
|
{
|
|
ESCROLL_TYPE_DEFAULT, // 기존 스크롤.
|
|
ESCROLL_TYPE_EX, // Home, End 버튼이 추가된 스크롤.
|
|
ESCROLL_TYPE_SMALL_EX, // Ex 버전에서 Home, End 가 제거된 작은 스크롤.
|
|
|
|
};
|
|
|
|
class KUIControlScrollBase : public KUIControl
|
|
{
|
|
public:
|
|
KUIControlScrollBase(void);
|
|
virtual ~KUIControlScrollBase(void);
|
|
|
|
virtual void PumpUpMessage(LPCSTR lpszControlID, DWORD dwMessage, DWORD lParam, DWORD wParam);
|
|
virtual DWORD OnKeyMessage(DWORD dwMessage, DWORD dwKeyCode);
|
|
virtual DWORD OnMouseMessage( DWORD dwMessage, int x, int y );
|
|
|
|
/// SetMaxRange() 와 SetPosition() 의 아스트랄한 세계를 도저히 이해할 수 없어 래퍼함수를 만들었다. -_- by Testors
|
|
void SetScrollRange( int nVisibleCount, int nTotalCount )
|
|
{
|
|
/// nTotalCount + 1 < nVisibleCount 일 때, SetMaxRange로 들어가는 파라미터가 음수가 되어 문제의 소지가 있다.
|
|
/// 에러처리를 했을 때, 다른 곳에서 문제가 없는지 확인 필요 - prodongi
|
|
SetMaxRange( nTotalCount - nVisibleCount + 1 );
|
|
}
|
|
|
|
/// { 그리고 이 빌어먹을 인터페이스는 하위 호환성을 위해 남겨두기로 결정.
|
|
void SetMaxRange(DWORD dwMaxRange);
|
|
DWORD GetMaxRange() { return m_dwMaxRange; }
|
|
void SetPosition(int nPos);
|
|
int GetPosition() { return m_nCurrentPos; }
|
|
// }
|
|
|
|
const KRect GetRectWithBtn() const;
|
|
|
|
|
|
void ScrollRefresh(); // 추가. bintitle. 2010.05.12
|
|
void ScrollUp(); // 추가. bintitle. 2010.05.12
|
|
void ScrollDown(); // 추가. bintitle. 2010.05.12
|
|
|
|
// 휠기능 사용여부 설정. 추가. bintitle. 2010.08.20
|
|
void SetWheelUse( bool bUse ){
|
|
m_bUseWheel = bUse;
|
|
}
|
|
|
|
bool getButtonRect(unsigned int type, KRect& r) const; /// 2011.06.22 버튼의 영역을 구한다 - prodongi
|
|
KRect getRectWithButton() const; /// 2011.06.22 GetRectWithBtn()가 제대로 안되서 만듬 - prodongi
|
|
|
|
protected:
|
|
virtual void _initControl();
|
|
/// Determine thumb position by getting x,y coordinates
|
|
virtual void _EvalPosition(int x, int y) = 0;
|
|
|
|
virtual void _EvalPositionFromThumRect() = 0;
|
|
|
|
/// Evaulate thum rect by Current Position.
|
|
virtual void _EvalThumbRect() = 0;
|
|
|
|
/// Set Thumb Rect by X, Y
|
|
virtual void _SetThumbRect(int x, int y) = 0;
|
|
virtual void _ResizeThumb() = 0;
|
|
|
|
virtual void _CalScrollBarRect(KRect* pInOutRect) = 0;
|
|
protected:
|
|
enum
|
|
{
|
|
SCROLL_BAR_UP = 0,
|
|
SCROLL_BAR_DOWN = 1,
|
|
SCROLL_BAR_HOME, // 추가. binitle.
|
|
SCROLL_BAR_END, //
|
|
TOTAL_BTN
|
|
};
|
|
KUIControlButton* m_pThumbBtn;
|
|
KUIControlSimpleButton* m_pScrollBarBtn[TOTAL_BTN];
|
|
|
|
bool m_bMouseDrag;
|
|
DWORD m_dwMaxRange;
|
|
int m_nCurrentPos;
|
|
DWORD m_dwOldTime;
|
|
KPoint m_ptMovingOffset;
|
|
KRect m_rcBtnOffset;
|
|
|
|
bool m_bUseWheel; // 휠버튼 사용여부. 하나의 창에 스크롤이 여러개인 경우 창에있는 모든 스크롤에 휠이벤트가 적용된다.
|
|
// 따라서 휠기능을 끄도록 추가. bintitle. 2010.08.20.
|
|
};
|
|
|
|
|
|
/// Horizontal Scroll
|
|
class KUIControlHScroll : public KUIControlScrollBase
|
|
{
|
|
protected:
|
|
virtual void _initControl();
|
|
virtual void _EvalPosition(int x, int y);
|
|
virtual void _EvalPositionFromThumRect();
|
|
virtual void _EvalThumbRect();
|
|
virtual void _SetThumbRect(int x, int y);
|
|
virtual void _ResizeThumb();
|
|
virtual void _CalScrollBarRect(KRect* pInOutRect);
|
|
|
|
void SetHScrollName();
|
|
|
|
std::string scroll_left_btn;
|
|
std::string scroll_right_btn;
|
|
std::string scroll_thumb;
|
|
};
|
|
|
|
/// Vertical Scroll
|
|
class KUIControlVScroll : public KUIControlScrollBase
|
|
{
|
|
protected:
|
|
virtual void _initControl();
|
|
virtual void _EvalPosition(int x, int y);
|
|
virtual void _EvalPositionFromThumRect();
|
|
virtual void _EvalThumbRect();
|
|
virtual void _SetThumbRect(int x, int y);
|
|
virtual void _ResizeThumb();
|
|
virtual void _CalScrollBarRect(KRect* pInOutRect);
|
|
|
|
void SetVScrollName();
|
|
|
|
std::string scroll_down_btn;
|
|
std::string scroll_up_btn;
|
|
std::string scroll_thumb;
|
|
|
|
std::string m_buf;
|
|
std::string strAniName[4];
|
|
|
|
};
|
|
|
|
|
|
// bintitle. 2010.05.04
|
|
/// Vertical Scroll.
|
|
// 기존의 스크롤과 다른이미지, Home,End Key 추가.
|
|
// 기존스크롤의 높이는 UP, DOWN 버튼을 제외한 크기였음. 이버전에서는 추가.
|
|
//
|
|
class KUIControlVScrollEx : public KUIControlScrollBase
|
|
{
|
|
private:
|
|
|
|
int m_nThumbTop;
|
|
int m_nThumbBottom;
|
|
|
|
public:
|
|
|
|
KUIControlVScrollEx();
|
|
|
|
protected:
|
|
virtual void _initControl();
|
|
virtual void _EvalPosition(int x, int y);
|
|
virtual void _EvalPositionFromThumRect();
|
|
virtual void _EvalThumbRect();
|
|
virtual void _SetThumbRect(int x, int y);
|
|
virtual void _ResizeThumb();
|
|
virtual void _CalScrollBarRect(KRect* pInOutRect);
|
|
|
|
void SetVScrollName();
|
|
std::string strAniName[6];
|
|
std::string scroll_home_btn;
|
|
std::string scroll_end_btn;
|
|
std::string scroll_down_btn;
|
|
std::string scroll_up_btn;
|
|
std::string scroll_thumb;
|
|
std::string scroll_back;
|
|
};
|
|
|
|
|
|
// bintitle. 2010.06.01
|
|
/// Small Vertical Scroll.
|
|
// Home, End Key 를 제외하곤 위의 스크롤과 동일한 기능.
|
|
//
|
|
class KUIControlVScrollSmallEx : public KUIControlScrollBase
|
|
{
|
|
private:
|
|
|
|
int m_nThumbTop;
|
|
int m_nThumbBottom;
|
|
|
|
public:
|
|
|
|
KUIControlVScrollSmallEx();
|
|
|
|
protected:
|
|
virtual void _initControl();
|
|
virtual void _EvalPosition(int x, int y);
|
|
virtual void _EvalPositionFromThumRect();
|
|
virtual void _EvalThumbRect();
|
|
virtual void _SetThumbRect(int x, int y);
|
|
virtual void _ResizeThumb();
|
|
virtual void _CalScrollBarRect(KRect* pInOutRect);
|
|
|
|
void SetVScrollName();
|
|
|
|
std::string scroll_down_btn;
|
|
std::string scroll_up_btn;
|
|
std::string scroll_thumb;
|
|
std::string scroll_back;
|
|
std::string m_buf;
|
|
|
|
std::string strAniName[4];
|
|
|
|
};
|
|
|