final pre-release OS/2 updates.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18267 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -17,74 +17,83 @@
|
|||||||
// Scrollbar item
|
// Scrollbar item
|
||||||
class WXDLLEXPORT wxScrollBar : public wxScrollBarBase
|
class WXDLLEXPORT wxScrollBar : public wxScrollBarBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxScrollBar)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; }
|
inline wxScrollBar()
|
||||||
|
{
|
||||||
|
m_nPageSize = 0;
|
||||||
|
m_nViewSize = 0;
|
||||||
|
m_nObjectSize = 0;
|
||||||
|
}
|
||||||
|
inline wxScrollBar( wxWindow* pParent
|
||||||
|
,wxWindowID vId
|
||||||
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
|
,const wxSize& rSize = wxDefaultSize
|
||||||
|
,long lStyle = wxSB_HORIZONTAL
|
||||||
|
#if wxUSE_VALIDATORS
|
||||||
|
,const wxValidator& rValidator = wxDefaultValidator
|
||||||
|
#endif
|
||||||
|
,const wxString& rsName = wxScrollBarNameStr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Create( pParent
|
||||||
|
,vId
|
||||||
|
,rPos
|
||||||
|
,rSize
|
||||||
|
,lStyle
|
||||||
|
#if wxUSE_VALIDATORS
|
||||||
|
,rValidator
|
||||||
|
#endif
|
||||||
|
,rsName
|
||||||
|
);
|
||||||
|
}
|
||||||
~wxScrollBar();
|
~wxScrollBar();
|
||||||
|
|
||||||
inline wxScrollBar(wxWindow *parent, wxWindowID id,
|
bool Create( wxWindow* pParent
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
,wxWindowID vId
|
||||||
const wxSize& size = wxDefaultSize,
|
,const wxPoint& rPos = wxDefaultPosition
|
||||||
long style = wxSB_HORIZONTAL,
|
,const wxSize& rSize = wxDefaultSize
|
||||||
|
,long lStyle = wxSB_HORIZONTAL
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
,const wxValidator& rValidator = wxDefaultValidator
|
||||||
#endif
|
#endif
|
||||||
const wxString& name = wxScrollBarNameStr)
|
,const wxString& rsName = wxScrollBarNameStr
|
||||||
{
|
);
|
||||||
Create(parent, id, pos, size, style, validator, name);
|
|
||||||
}
|
|
||||||
bool Create(wxWindow *parent, wxWindowID id,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = wxSB_HORIZONTAL,
|
|
||||||
#if wxUSE_VALIDATORS
|
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
|
||||||
#endif
|
|
||||||
const wxString& name = wxScrollBarNameStr);
|
|
||||||
|
|
||||||
int GetThumbPosition() const ;
|
int GetThumbPosition(void) const ;
|
||||||
inline int GetThumbSize() const { return m_pageSize; }
|
inline int GetThumbSize(void) const { return m_nPageSize; }
|
||||||
inline int GetPageSize() const { return m_viewSize; }
|
inline int GetPageSize(void) const { return m_nViewSize; }
|
||||||
inline int GetRange() const { return m_objectSize; }
|
inline int GetRange(void) const { return m_nObjectSize; }
|
||||||
|
|
||||||
virtual void SetThumbPosition(int viewStart);
|
virtual void SetThumbPosition(int nViewStart);
|
||||||
virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize,
|
virtual void SetScrollbar( int nPosition
|
||||||
bool refresh = TRUE);
|
,int nThumbSize
|
||||||
|
,int nRange
|
||||||
|
,int nPageSize
|
||||||
|
,bool bRefresh = TRUE
|
||||||
|
);
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
void Command(wxCommandEvent& rEvent);
|
||||||
// Backward compatibility
|
virtual WXHBRUSH OnCtlColor( WXHDC hDC
|
||||||
int GetValue() const { return GetThumbPosition(); }
|
,WXHWND hWnd
|
||||||
void SetValue(int viewStart) { SetThumbPosition(viewStart); }
|
,WXUINT uCtlColor
|
||||||
void GetValues(int *viewStart, int *viewLength, int *objectLength,
|
,WXUINT uMessage
|
||||||
int *pageLength) const ;
|
,WXWPARAM wParam
|
||||||
int GetViewLength() const { return m_viewSize; }
|
,WXLPARAM lParam
|
||||||
int GetObjectLength() const { return m_objectSize; }
|
);
|
||||||
|
virtual bool OS2OnScroll( int nOrientation
|
||||||
void SetPageSize(int pageLength);
|
,WXWORD wParam
|
||||||
void SetObjectLength(int objectLength);
|
,WXWORD wPos
|
||||||
void SetViewLength(int viewLength);
|
,WXHWND hControl
|
||||||
#endif
|
);
|
||||||
|
|
||||||
void Command(wxCommandEvent& event);
|
|
||||||
|
|
||||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
|
||||||
virtual bool OS2OnScroll(int orientation, WXWORD wParam,
|
|
||||||
WXWORD pos, WXHWND control);
|
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
|
||||||
// Backward compatibility: generate an old-style scroll command
|
|
||||||
void OnScroll(wxScrollEvent& event);
|
|
||||||
#endif // WXWIN_COMPATIBILITY
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_pageSize;
|
int m_nPageSize;
|
||||||
int m_viewSize;
|
int m_nViewSize;
|
||||||
int m_objectSize;
|
int m_nObjectSize;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
private:
|
||||||
};
|
DECLARE_DYNAMIC_CLASS(wxScrollBar)
|
||||||
|
}; // end of CLASS wxScrollBar
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_SCROLBAR_H_
|
// _WX_SCROLBAR_H_
|
||||||
|
@@ -189,6 +189,16 @@ void wxChoice::SetString(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
SHORT nIndexType = 0;
|
SHORT nIndexType = 0;
|
||||||
|
void* pData;
|
||||||
|
|
||||||
|
if ( m_clientDataItemsType != wxClientData_None )
|
||||||
|
{
|
||||||
|
pData = DoGetItemClientData(n);
|
||||||
|
}
|
||||||
|
else // no client data
|
||||||
|
{
|
||||||
|
pData = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)n, 0);
|
::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)n, 0);
|
||||||
|
|
||||||
@@ -201,6 +211,13 @@ void wxChoice::SetString(
|
|||||||
,(MPARAM)nIndexType
|
,(MPARAM)nIndexType
|
||||||
,(MPARAM)rsStr.c_str()
|
,(MPARAM)rsStr.c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (pData)
|
||||||
|
{
|
||||||
|
DoSetItemClientData( n
|
||||||
|
,pData
|
||||||
|
);
|
||||||
|
}
|
||||||
} // end of wxChoice::SetString
|
} // end of wxChoice::SetString
|
||||||
|
|
||||||
wxString wxChoice::GetString(
|
wxString wxChoice::GetString(
|
||||||
|
@@ -1113,15 +1113,15 @@ $(WXDIR)\lib\wx.lib: \
|
|||||||
!else
|
!else
|
||||||
|
|
||||||
# Update the dynamic link library
|
# Update the dynamic link library
|
||||||
$(WXDIR)\lib\wx23.dll: $(OBJECTS)
|
$(WXDIR)\lib\wx24.dll: $(OBJECTS)
|
||||||
icc @<<
|
icc @<<
|
||||||
/B" $(LINKFLAGS)" /Fe$@
|
/B" $(LINKFLAGS)" /Fe$@
|
||||||
$(LIBS)
|
$(LIBS)
|
||||||
$(DUMMYOBJ)
|
$(DUMMYOBJ)
|
||||||
$(OBJECTS)
|
$(OBJECTS)
|
||||||
$(WXDIR)\src\os2\wx23.def
|
$(WXDIR)\src\os2\wx24.def
|
||||||
<<
|
<<
|
||||||
implib $(WXDIR)\lib\wx23.lib $(WXDIR)\src\os2\wx23.def
|
implib $(WXDIR)\lib\wx24.lib $(WXDIR)\src\os2\wx24.def
|
||||||
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
@@ -1200,7 +1200,7 @@ clean: $(PERIPH_CLEAN_TARGET) clean_png clean_zlib clean_jpeg clean_tiff
|
|||||||
rd ..\os2\$D
|
rd ..\os2\$D
|
||||||
del $(LIBTARGET)
|
del $(LIBTARGET)
|
||||||
!if "$(WXMAKINGDLL)" == "1"
|
!if "$(WXMAKINGDLL)" == "1"
|
||||||
erase /N ..\..\lib\wx23.lib
|
erase /N ..\..\lib\wx24.lib
|
||||||
!endif
|
!endif
|
||||||
erase /N $(COMMDIR)\y_tab.c
|
erase /N $(COMMDIR)\y_tab.c
|
||||||
erase /N $(COMMDIR)\lex_yy.c
|
erase /N $(COMMDIR)\lex_yy.c
|
||||||
|
@@ -750,6 +750,15 @@ wxMenuBar::wxMenuBar(
|
|||||||
|
|
||||||
wxMenuBar::~wxMenuBar()
|
wxMenuBar::~wxMenuBar()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// We should free PM's resources only if PM doesn't do it for us
|
||||||
|
// which happens if we're attached to a frame
|
||||||
|
//
|
||||||
|
if (m_hMenu && !IsAttached())
|
||||||
|
{
|
||||||
|
::WinDestroyWindow((HMENU)m_hMenu);
|
||||||
|
m_hMenu = (WXHMENU)NULL;
|
||||||
|
}
|
||||||
} // end of wxMenuBar::~wxMenuBar
|
} // end of wxMenuBar::~wxMenuBar
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@@ -423,6 +423,9 @@ void wxMenuItem::SetText(
|
|||||||
|
|
||||||
wxMenuItemBase::SetText(sText);
|
wxMenuItemBase::SetText(sText);
|
||||||
OWNER_DRAWN_ONLY(wxOwnerDrawn::SetName(sText));
|
OWNER_DRAWN_ONLY(wxOwnerDrawn::SetName(sText));
|
||||||
|
#if wxUSE_OWNER_DRAWN
|
||||||
|
SetAccelString(rText.AfterFirst(_T('\t')));
|
||||||
|
#endif // wxUSE_OWNER_DRAWN
|
||||||
|
|
||||||
HWND hMenu = GetHmenuOf(m_parentMenu);
|
HWND hMenu = GetHmenuOf(m_parentMenu);
|
||||||
|
|
||||||
|
@@ -71,16 +71,99 @@ bool wxOwnerDrawn::OnMeasureItem(
|
|||||||
{
|
{
|
||||||
wxMemoryDC vDC;
|
wxMemoryDC vDC;
|
||||||
|
|
||||||
vDC.SetFont(GetFont());
|
|
||||||
|
|
||||||
wxString sStr = wxStripMenuCodes(m_strName);
|
wxString sStr = wxStripMenuCodes(m_strName);
|
||||||
|
|
||||||
|
//
|
||||||
|
// If we have a valid accel string, then pad out
|
||||||
|
// the menu string so the menu and accel string are not
|
||||||
|
// placed ontop of eachother.
|
||||||
|
if (!m_strAccel.empty() )
|
||||||
|
{
|
||||||
|
sStr.Pad(sStr.Length()%8);
|
||||||
|
sStr += m_strAccel;
|
||||||
|
}
|
||||||
|
vDC.SetFont(GetFont());
|
||||||
vDC.GetTextExtent( sStr
|
vDC.GetTextExtent( sStr
|
||||||
,(long *)pWidth
|
,(long *)pWidth
|
||||||
,(long *)pHeight
|
,(long *)pHeight
|
||||||
);
|
);
|
||||||
|
if (!m_strAccel.IsEmpty())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Measure the accelerator string, and add it's width to
|
||||||
|
// the total item width, plus 16 (Accelerators are right justified,
|
||||||
|
// with the right edge of the text rectangle 16 pixels left of
|
||||||
|
// the right edge of the menu)
|
||||||
|
//
|
||||||
|
int nAccelWidth;
|
||||||
|
int nAccelHeight;
|
||||||
|
|
||||||
(*pHeight) = (*pHeight) + 2;
|
vDC.GetTextExtent( m_strAccel
|
||||||
|
,&nAccelWidth
|
||||||
|
,&nAccelHeight
|
||||||
|
);
|
||||||
|
*pWidth += nAccelWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add space at the end of the menu for the submenu expansion arrow
|
||||||
|
// this will also allow offsetting the accel string from the right edge
|
||||||
|
//
|
||||||
|
*pWidth += GetDefaultMarginWidth() * 1.5;
|
||||||
|
|
||||||
|
//
|
||||||
|
// JACS: items still look too tightly packed, so adding 5 pixels.
|
||||||
|
//
|
||||||
|
(*pHeight) += 5;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Ray Gilbert's changes - Corrects the problem of a BMP
|
||||||
|
// being placed next to text in a menu item, and the BMP does
|
||||||
|
// not match the size expected by the system. This will
|
||||||
|
// resize the space so the BMP will fit. Without this, BMPs
|
||||||
|
// must be no larger or smaller than 16x16.
|
||||||
|
//
|
||||||
|
if (m_bmpChecked.Ok())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Is BMP height larger then text height?
|
||||||
|
//
|
||||||
|
size_t nAdjustedHeight = m_bmpChecked.GetHeight() +
|
||||||
|
wxSystemSettings::GetMetric(wxSYS_EDGE_Y);
|
||||||
|
if (*pHeight < nAdjustedHeight)
|
||||||
|
*pHeight = nAdjustedHeight;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Does BMP encroach on default check menu position?
|
||||||
|
//
|
||||||
|
size_t nAdjustedWidth = m_bmpChecked.GetWidth() +
|
||||||
|
(wxSystemSettings::GetMetric(wxSYS_EDGE_X) * 2);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do we need to widen margin to fit BMP?
|
||||||
|
//
|
||||||
|
if ((size_t)GetMarginWidth() < nAdjustedWidth)
|
||||||
|
SetMarginWidth(nAdjustedWidth);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add the size of the bitmap to our total size...
|
||||||
|
//
|
||||||
|
*pWidth += GetMarginWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add the size of the bitmap to our total size - even if we don't have
|
||||||
|
// a bitmap we leave room for one...
|
||||||
|
//
|
||||||
|
*pWidth += GetMarginWidth();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Make sure that this item is at least as
|
||||||
|
// tall as the user's system settings specify
|
||||||
|
//
|
||||||
|
if (*pHeight < m_nMinHeight)
|
||||||
|
*pHeight = m_nMinHeight;
|
||||||
m_nHeight = *pHeight; // remember height for use in OnDrawItem
|
m_nHeight = *pHeight; // remember height for use in OnDrawItem
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // end of wxOwnerDrawn::OnMeasureItem
|
} // end of wxOwnerDrawn::OnMeasureItem
|
||||||
|
@@ -22,252 +22,291 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxScrollBar, wxControl)
|
|
||||||
#if WXWIN_COMPATIBILITY
|
|
||||||
EVT_SCROLL(wxScrollBar::OnScroll)
|
|
||||||
#endif
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
|
|
||||||
// Scrollbar
|
// Scrollbar
|
||||||
bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
bool wxScrollBar::Create (
|
||||||
const wxPoint& pos,
|
wxWindow* pParent
|
||||||
const wxSize& size, long style,
|
, wxWindowID vId
|
||||||
|
, const wxPoint& rPos
|
||||||
|
, const wxSize& rSize
|
||||||
|
, long lStyle
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
const wxValidator& validator,
|
, const wxValidator& rValidator
|
||||||
#endif
|
#endif
|
||||||
const wxString& name)
|
, const wxString& rsName
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (!parent)
|
int nX = rPos.x;
|
||||||
|
int nY = rPos.y;
|
||||||
|
int nWidth = rSize.x;
|
||||||
|
int nHeight = rSize.y;
|
||||||
|
|
||||||
|
if (!pParent)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
parent->AddChild(this);
|
pParent->AddChild(this);
|
||||||
SetName(name);
|
SetName(rsName);
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
SetValidator(validator);
|
SetValidator(rValidator);
|
||||||
#endif
|
#endif
|
||||||
|
SetBackgroundColour(pParent->GetBackgroundColour()) ;
|
||||||
|
SetForegroundColour(pParent->GetForegroundColour()) ;
|
||||||
|
|
||||||
SetBackgroundColour(parent->GetBackgroundColour()) ;
|
if (vId == -1L)
|
||||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
|
||||||
m_windowStyle = style;
|
|
||||||
|
|
||||||
if ( id == -1 )
|
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = vId;
|
||||||
|
|
||||||
int x = pos.x;
|
if (nWidth == -1)
|
||||||
int y = pos.y;
|
|
||||||
int width = size.x;
|
|
||||||
int height = size.y;
|
|
||||||
|
|
||||||
if (width == -1)
|
|
||||||
{
|
{
|
||||||
if (style & wxHORIZONTAL)
|
if (lStyle & wxHORIZONTAL)
|
||||||
width = 140;
|
nWidth = 140;
|
||||||
else
|
else
|
||||||
width = 14;
|
nWidth = 14;
|
||||||
}
|
}
|
||||||
if (height == -1)
|
if (nHeight == -1)
|
||||||
{
|
{
|
||||||
if (style & wxVERTICAL)
|
if (lStyle & wxVERTICAL)
|
||||||
height = 140;
|
nHeight = 140;
|
||||||
else
|
else
|
||||||
height = 14;
|
nHeight = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO create scrollbar
|
DWORD dwStyle = WS_VISIBLE;
|
||||||
|
|
||||||
m_pageSize = 1;
|
if (GetWindowStyleFlag() & wxCLIP_SIBLINGS)
|
||||||
m_viewSize = 1;
|
dwStyle |= WS_CLIPSIBLINGS;
|
||||||
m_objectSize = 1;
|
|
||||||
|
|
||||||
SetFont(parent->GetFont());
|
DWORD dwDirection = (lStyle & wxHORIZONTAL) ? SBS_HORZ: SBS_VERT;
|
||||||
|
|
||||||
m_hWnd = 0; // TODO: (WXHWND)scroll_bar;
|
HWND hScrollBar = ::WinCreateWindow( (HWND)GetHwndOf(pParent)
|
||||||
|
,WC_SCROLLBAR
|
||||||
|
,(PSZ)NULL
|
||||||
|
,dwDirection | dwStyle
|
||||||
|
,0, 0, 0, 0
|
||||||
|
,(HWND)GetHwndOf(pParent)
|
||||||
|
,HWND_TOP
|
||||||
|
,(HMENU)m_windowId
|
||||||
|
,NULL
|
||||||
|
,NULL
|
||||||
|
);
|
||||||
|
|
||||||
HWND scroll_bar = 0; // temporary
|
m_nPageSize = 1;
|
||||||
|
m_nViewSize = 1;
|
||||||
|
m_nObjectSize = 1;
|
||||||
|
::WinSendMsg( hScrollBar
|
||||||
|
,SBM_SETSCROLLBAR
|
||||||
|
,(MPARAM)0
|
||||||
|
,MPFROM2SHORT(0,1)
|
||||||
|
);
|
||||||
|
::WinShowWindow( hScrollBar
|
||||||
|
,TRUE
|
||||||
|
);
|
||||||
|
SetFont(*wxSMALL_FONT);
|
||||||
|
|
||||||
|
m_hWnd = hScrollBar;
|
||||||
|
|
||||||
|
//
|
||||||
// Subclass again for purposes of dialog editing mode
|
// Subclass again for purposes of dialog editing mode
|
||||||
SubclassWin((WXHWND) scroll_bar);
|
//
|
||||||
|
SubclassWin((WXHWND)hScrollBar);
|
||||||
SetSize(x, y, width, height);
|
SetSize( nX
|
||||||
|
,nY
|
||||||
|
,nWidth
|
||||||
|
,nHeight
|
||||||
|
);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
} // end of wxScrollBar::Create
|
||||||
|
|
||||||
wxScrollBar::~wxScrollBar()
|
wxScrollBar::~wxScrollBar()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxScrollBar::OS2OnScroll(int WXUNUSED(orientation), WXWORD wParam,
|
bool wxScrollBar::OS2OnScroll (
|
||||||
WXWORD pos, WXHWND control)
|
int nOrientation
|
||||||
|
, WXWORD wParam
|
||||||
|
, WXWORD wPos
|
||||||
|
, WXHWND hControl
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// TODO:
|
int nPosition;
|
||||||
/*
|
int nMaxPos;
|
||||||
int position = ::GetScrollPos((HWND) control, SB_CTL);
|
int nTrackPos = wPos;
|
||||||
int minPos, maxPos;
|
int nMinPos;
|
||||||
::GetScrollRange((HWND) control, SB_CTL, &minPos, &maxPos);
|
int nScrollInc;
|
||||||
|
wxEventType vScrollEvent = wxEVT_NULL;
|
||||||
|
|
||||||
#if defined(__WIN95__)
|
MRESULT vRange;
|
||||||
|
|
||||||
|
//
|
||||||
|
// When we're dragging the scrollbar we can't use pos parameter because it
|
||||||
|
// is limited to 16 bits
|
||||||
|
//
|
||||||
|
if (wParam == SB_SLIDERPOSITION || wParam == SB_SLIDERTRACK)
|
||||||
|
{
|
||||||
|
SBCDATA vScrollInfo;
|
||||||
|
|
||||||
|
vScrollInfo.sHilite = SB_SLIDERTRACK;
|
||||||
|
|
||||||
|
::WinSendMsg((HWND)GetHwnd(), WM_QUERYWINDOWPARAMS, (PVOID)&vScrollInfo, NULL);
|
||||||
|
|
||||||
|
nTrackPos = vScrollInfo.posThumb;
|
||||||
|
nPosition = vScrollInfo.posFirst;
|
||||||
|
nMaxPos = vScrollInfo.posLast;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nPosition = (int)(MRESULT)::WinSendMsg((HWND)GetHwnd(), SBM_QUERYPOS, (MPARAM)NULL, (MPARAM)NULL);
|
||||||
|
vRange = ::WinSendMsg((HWND)GetHwnd(), SBM_QUERYRANGE, (MPARAM)NULL, (MPARAM)NULL);
|
||||||
|
nMinPos = SHORT1FROMMR(vRange);
|
||||||
|
nMaxPos = SHORT2FROMMR(vRange);
|
||||||
|
}
|
||||||
|
//
|
||||||
// A page size greater than one has the effect of reducing the effective
|
// A page size greater than one has the effect of reducing the effective
|
||||||
// range, therefore the range has already been boosted artificially - so
|
// range, therefore the range has already been boosted artificially - so
|
||||||
// reduce it again.
|
// reduce it again.
|
||||||
if ( m_pageSize > 1 )
|
//
|
||||||
maxPos -= (m_pageSize - 1);
|
if (m_nPageSize > 1)
|
||||||
#endif // __WIN95__
|
nMaxPos -= (m_nPageSize - 1);
|
||||||
|
|
||||||
wxEventType scrollEvent = wxEVT_NULL;
|
|
||||||
|
|
||||||
int nScrollInc;
|
|
||||||
switch (wParam)
|
switch (wParam)
|
||||||
{
|
{
|
||||||
case SB_TOP:
|
|
||||||
nScrollInc = maxPos - position;
|
|
||||||
scrollEvent = wxEVT_SCROLL_TOP;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SB_BOTTOM:
|
|
||||||
nScrollInc = - position;
|
|
||||||
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SB_LINEUP:
|
case SB_LINEUP:
|
||||||
nScrollInc = -1;
|
nScrollInc = -1;
|
||||||
scrollEvent = wxEVT_SCROLL_LINEUP;
|
vScrollEvent = wxEVT_SCROLL_LINEUP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_LINEDOWN:
|
case SB_LINEDOWN:
|
||||||
nScrollInc = 1;
|
nScrollInc = 1;
|
||||||
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
vScrollEvent = wxEVT_SCROLL_LINEDOWN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_PAGEUP:
|
case SB_PAGEUP:
|
||||||
nScrollInc = -GetPageSize();
|
nScrollInc = -GetPageSize();
|
||||||
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
vScrollEvent = wxEVT_SCROLL_PAGEUP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_PAGEDOWN:
|
case SB_PAGEDOWN:
|
||||||
nScrollInc = GetPageSize();
|
nScrollInc = GetPageSize();
|
||||||
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
vScrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_THUMBTRACK:
|
case SB_SLIDERTRACK:
|
||||||
case SB_THUMBPOSITION:
|
nScrollInc = nTrackPos - nPosition;
|
||||||
nScrollInc = pos - position;
|
vScrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
break;
|
||||||
|
|
||||||
|
case SB_ENDSCROLL:
|
||||||
|
nScrollInc = 0;
|
||||||
|
vScrollEvent = wxEVT_SCROLL_ENDSCROLL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
nScrollInc = 0;
|
nScrollInc = 0;
|
||||||
}
|
}
|
||||||
|
if (nScrollInc)
|
||||||
if ( nScrollInc == 0 )
|
|
||||||
{
|
{
|
||||||
// no event to process, so don't process it
|
nPosition += nScrollInc;
|
||||||
|
|
||||||
|
if (nPosition < 0)
|
||||||
|
nPosition = 0;
|
||||||
|
if (nPosition > nMaxPos)
|
||||||
|
nPosition = nMaxPos;
|
||||||
|
SetThumbPosition(nPosition);
|
||||||
|
}
|
||||||
|
else if ( vScrollEvent != wxEVT_SCROLL_THUMBRELEASE &&
|
||||||
|
vScrollEvent != wxEVT_SCROLL_ENDSCROLL
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Don't process the event if there is no displacement,
|
||||||
|
// unless this is a thumb release or end scroll event.
|
||||||
|
//
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int new_pos = position + nScrollInc;
|
wxScrollEvent vEvent( vScrollEvent
|
||||||
|
,m_windowId
|
||||||
|
);
|
||||||
|
|
||||||
if (new_pos < 0)
|
vEvent.SetPosition(nPosition);
|
||||||
new_pos = 0;
|
vEvent.SetEventObject(this);
|
||||||
if (new_pos > maxPos)
|
return GetEventHandler()->ProcessEvent(vEvent);
|
||||||
new_pos = maxPos;
|
} // end of wxScrollBar::OS2OnScroll
|
||||||
|
|
||||||
SetThumbPosition(new_pos);
|
void wxScrollBar::SetThumbPosition (
|
||||||
wxScrollEvent event(scrollEvent, m_windowId);
|
int nViewStart
|
||||||
event.SetPosition(new_pos);
|
)
|
||||||
event.SetEventObject( this );
|
|
||||||
|
|
||||||
return GetEventHandler()->ProcessEvent(event);
|
|
||||||
*/
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxScrollBar::SetThumbPosition(int viewStart)
|
|
||||||
{
|
{
|
||||||
// TODO
|
SBCDATA vInfo;
|
||||||
}
|
|
||||||
|
memset(&vInfo, '\0', sizeof(SBCDATA));
|
||||||
|
vInfo.cb = sizeof(SBCDATA);
|
||||||
|
vInfo.posThumb = nViewStart;
|
||||||
|
|
||||||
|
::WinSendMsg((HWND)GetHwnd(), WM_SETWINDOWPARAMS, (MPARAM)&vInfo, (MPARAM)NULL);
|
||||||
|
::WinSendMsg((HWND)GetHwnd(), SBM_SETPOS, (MPARAM)nViewStart, (MPARAM)NULL);
|
||||||
|
} // end of wxScrollBar::SetThumbPosition
|
||||||
|
|
||||||
int wxScrollBar::GetThumbPosition() const
|
int wxScrollBar::GetThumbPosition() const
|
||||||
{
|
{
|
||||||
// TODO
|
return((int)(MRESULT)::WinSendMsg((HWND)GetHwnd(), SBM_QUERYPOS, (MPARAM)NULL, (MPARAM)NULL));
|
||||||
|
} // end of wxScrollBar::GetThumbPosition
|
||||||
|
|
||||||
|
void wxScrollBar::SetScrollbar (
|
||||||
|
int nPosition
|
||||||
|
, int nThumbSize
|
||||||
|
, int nRange
|
||||||
|
, int nPageSize
|
||||||
|
, bool bRefresh
|
||||||
|
)
|
||||||
|
{
|
||||||
|
SBCDATA vInfo;
|
||||||
|
//
|
||||||
|
// The lRange (number of scroll steps) is the
|
||||||
|
// object length minus the page size.
|
||||||
|
//
|
||||||
|
int nRange1 = wxMax((m_nObjectSize - m_nPageSize), 0);
|
||||||
|
|
||||||
|
m_nViewSize = nPageSize;
|
||||||
|
m_nPageSize = nThumbSize;
|
||||||
|
m_nObjectSize = nRange;
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Try to adjust the lRange to cope with page size > 1
|
||||||
|
// (see comment for SetPageLength)
|
||||||
|
//
|
||||||
|
if (m_nPageSize > 1 )
|
||||||
|
{
|
||||||
|
nRange1 += (m_nPageSize - 1);
|
||||||
|
}
|
||||||
|
vInfo.cb = sizeof(SBCDATA);
|
||||||
|
vInfo.cVisible = m_nPageSize;
|
||||||
|
vInfo.posFirst = 0;
|
||||||
|
vInfo.posLast = nRange1;
|
||||||
|
vInfo.posThumb = nPosition;
|
||||||
|
|
||||||
|
::WinSendMsg((HWND)GetHwnd(), WM_SETWINDOWPARAMS, (MPARAM)&vInfo, (MPARAM)NULL);
|
||||||
|
} // end of wxScrollBar::SetScrollbar
|
||||||
|
|
||||||
|
WXHBRUSH wxScrollBar::OnCtlColor (
|
||||||
|
WXHDC hDC
|
||||||
|
, WXHWND hWnd
|
||||||
|
, WXUINT uCtlColor
|
||||||
|
, WXUINT uMessage
|
||||||
|
, WXWPARAM wParam
|
||||||
|
, WXLPARAM lParam
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Does nothing under OS/2
|
||||||
|
//
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} // end of wxScrollBar::OnCtlColor
|
||||||
|
|
||||||
void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize,
|
void wxScrollBar::Command (
|
||||||
bool refresh)
|
wxCommandEvent& rEvent
|
||||||
|
)
|
||||||
{
|
{
|
||||||
m_viewSize = pageSize;
|
SetThumbPosition(rEvent.m_commandInt);
|
||||||
m_pageSize = thumbSize;
|
ProcessCommand(rEvent);
|
||||||
m_objectSize = range;
|
} // end of wxScrollBar::Command
|
||||||
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
|
||||||
void wxScrollBar::SetPageSize(int pageLength)
|
|
||||||
{
|
|
||||||
m_pageSize = pageLength;
|
|
||||||
|
|
||||||
// TODO:
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxScrollBar::SetObjectLength(int objectLength)
|
|
||||||
{
|
|
||||||
m_objectSize = objectLength;
|
|
||||||
|
|
||||||
// The range (number of scroll steps) is the
|
|
||||||
// object length minus the view size.
|
|
||||||
int range = wxMax((objectLength - m_viewSize), 0) ;
|
|
||||||
|
|
||||||
// TODO:
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxScrollBar::SetViewLength(int viewLength)
|
|
||||||
{
|
|
||||||
m_viewSize = viewLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxScrollBar::GetValues(int *viewStart, int *viewLength, int *objectLength,
|
|
||||||
int *pageLength) const
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
/*
|
|
||||||
*viewStart = ::GetScrollPos((HWND)m_hWnd, SB_CTL);
|
|
||||||
*viewLength = m_viewSize;
|
|
||||||
*objectLength = m_objectSize;
|
|
||||||
*pageLength = m_pageSize;
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
WXHBRUSH wxScrollBar::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxScrollBar::Command(wxCommandEvent& event)
|
|
||||||
{
|
|
||||||
SetThumbPosition(event.m_commandInt);
|
|
||||||
ProcessCommand(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
|
||||||
// Backward compatibility
|
|
||||||
void wxScrollBar::OnScroll(wxScrollEvent& event)
|
|
||||||
{
|
|
||||||
// TODO:
|
|
||||||
/*
|
|
||||||
wxEventType oldEvent = event.GetEventType();
|
|
||||||
event.SetEventType( wxEVT_COMMAND_SCROLLBAR_UPDATED );
|
|
||||||
if ( !GetEventHandler()->ProcessEvent(event) )
|
|
||||||
{
|
|
||||||
event.SetEventType( oldEvent );
|
|
||||||
if (!GetParent()->GetEventHandler()->ProcessEvent(event))
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@@ -1175,9 +1175,11 @@ void wxTextCtrl::AdjustSpaceLimit()
|
|||||||
bool wxTextCtrl::AcceptsFocus() const
|
bool wxTextCtrl::AcceptsFocus() const
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// We don't want focus if we can't be edited
|
// We don't want focus if we can't be edited unless we're a multiline
|
||||||
|
// control because then it might be still nice to get focus from keyboard
|
||||||
|
// to be able to scroll it without mouse
|
||||||
//
|
//
|
||||||
return IsEditable() && wxControl::AcceptsFocus();
|
return (IsEditable() || IsMultiLine()) && wxControl::AcceptsFocus();
|
||||||
} // end of wxTextCtrl::Command
|
} // end of wxTextCtrl::Command
|
||||||
|
|
||||||
wxSize wxTextCtrl::DoGetBestSize() const
|
wxSize wxTextCtrl::DoGetBestSize() const
|
||||||
|
@@ -2234,6 +2234,8 @@ static void wxYieldForCommandsOnly()
|
|||||||
{
|
{
|
||||||
wxTheApp->DoMessage((WXMSG*)&vMsg);
|
wxTheApp->DoMessage((WXMSG*)&vMsg);
|
||||||
}
|
}
|
||||||
|
if (vMsg.msg == WM_QUIT)
|
||||||
|
::WinPostMsg(NULL, WM_QUIT, 0, 0);
|
||||||
}
|
}
|
||||||
#endif // wxUSE_MENUS_NATIVE
|
#endif // wxUSE_MENUS_NATIVE
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user