1. some minor but nasty bugs fixed (see post to the list)
2. new wxCaret class (MSW only so far) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2547 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
c52d95b412
commit
789295bf7b
178
include/wx/caret.h
Normal file
178
include/wx/caret.h
Normal file
@ -0,0 +1,178 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: caret.h
|
||||
// Purpose: wxCaretBase class - the interface of wxCaret
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 23.05.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CARET_H_BASE_
|
||||
#define _WX_CARET_H_BASE_
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxWindow;
|
||||
class WXDLLEXPORT wxWindowBase;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// A caret is a blinking cursor showing the position where the typed text will
|
||||
// appear. It can be either a solid block or a custom bitmap (TODO)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxCaretBase
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
// -----
|
||||
// default - use Create
|
||||
wxCaretBase() { Init(); }
|
||||
// create the caret of given (in pixels) width and height and associate
|
||||
// with the given window
|
||||
wxCaretBase(wxWindowBase *window, int width, int height)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(window, width, height);
|
||||
}
|
||||
// same as above
|
||||
wxCaretBase(wxWindowBase *window, const wxSize& size)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(window, size);
|
||||
}
|
||||
|
||||
// Create() functions - same as ctor but returns the success code
|
||||
// --------------------------------------------------------------
|
||||
|
||||
// same as ctor
|
||||
bool Create(wxWindowBase *window, int width, int height)
|
||||
{ return DoCreate(window, width, height); }
|
||||
// same as ctor
|
||||
bool Create(wxWindowBase *window, const wxSize& size)
|
||||
{ return DoCreate(window, size.x, size.y); }
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
// is the caret valid?
|
||||
bool IsOk() const { return m_width != 0 && m_height != 0; }
|
||||
|
||||
// get the caret position
|
||||
void GetPosition(int *x, int *y) const
|
||||
{
|
||||
if ( x ) *x = m_x;
|
||||
if ( y ) *y = m_y;
|
||||
}
|
||||
wxPoint GetPosition() const { return wxPoint(m_x, m_y); }
|
||||
|
||||
// get the caret size
|
||||
void GetSize(int *width, int *height) const
|
||||
{
|
||||
if ( width ) *width = m_width;
|
||||
if ( height ) *height = m_height;
|
||||
}
|
||||
wxSize GetSize() const { return wxSize(m_width, m_height); }
|
||||
|
||||
// get the window we're associated with
|
||||
wxWindow *GetWindow() const { return (wxWindow *)m_window; }
|
||||
|
||||
// operations
|
||||
// ----------
|
||||
|
||||
// move the caret to given position (in logical coords)
|
||||
void Move(int x, int y) { m_x = x; m_y = y; DoMove(); }
|
||||
void Move(const wxPoint& pt) { m_x = pt.x; m_y = pt.y; DoMove(); }
|
||||
|
||||
// show/hide the caret (should be called by wxWindow when needed):
|
||||
// Show() must be called as many times as Hide() + 1 to make the caret
|
||||
// visible
|
||||
virtual void Show(bool show = TRUE)
|
||||
{
|
||||
if ( show )
|
||||
{
|
||||
if ( ++m_countVisible > 0 )
|
||||
DoShow();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( --m_countVisible < 1 )
|
||||
DoHide();
|
||||
}
|
||||
}
|
||||
virtual void Hide() { Show(FALSE); }
|
||||
|
||||
// blink time is measured in milliseconds and is the time elapsed
|
||||
// between 2 inversions of the caret (blink time of the caret is common
|
||||
// to all carets in the Universe, so these functions are static)
|
||||
static int GetBlinkTime();
|
||||
static void SetBlinkTime(int milliseconds);
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
// these functions should be called by wxWindow when the window gets/loses
|
||||
// the focus - we create/show and hide/destroy the caret here
|
||||
virtual void OnSetFocus() { }
|
||||
virtual void OnKillFocus() { }
|
||||
|
||||
protected:
|
||||
// these functions may be overriden in the derived classes, but they
|
||||
// should call the base class version first
|
||||
virtual bool DoCreate(wxWindowBase *window, int width, int height)
|
||||
{
|
||||
m_window = window;
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// pure virtuals to implement in the derived class
|
||||
virtual void DoShow() = 0;
|
||||
virtual void DoHide() = 0;
|
||||
virtual void DoMove() = 0;
|
||||
|
||||
// the common initialization
|
||||
void Init()
|
||||
{
|
||||
m_window = (wxWindowBase *)NULL;
|
||||
m_x = m_y = 0;
|
||||
m_width = m_height = 0;
|
||||
m_countVisible = 0;
|
||||
}
|
||||
|
||||
// the size of the caret
|
||||
int m_width, m_height;
|
||||
|
||||
// the position of the caret
|
||||
int m_x, m_y;
|
||||
|
||||
// the window we're associated with
|
||||
wxWindowBase *m_window;
|
||||
|
||||
// visibility count: the caret is visible only if it's positive
|
||||
int m_countVisible;
|
||||
|
||||
private:
|
||||
DECLARE_NO_COPY_CLASS(wxCaretBase);
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// now include the real thing
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#include "wx/msw/caret.h"
|
||||
#else
|
||||
// not implemented yet
|
||||
typedef wxCaretBase wxCaret;
|
||||
#endif // platform
|
||||
|
||||
#endif // _WX_CARET_H_BASE_
|
||||
|
65
include/wx/msw/caret.h
Normal file
65
include/wx/msw/caret.h
Normal file
@ -0,0 +1,65 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: msw/caret.h
|
||||
// Purpose: wxCaret class - the MSW implementation of wxCaret
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 23.05.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CARET_H_
|
||||
#define _WX_CARET_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "caret.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxCaret : public wxCaretBase
|
||||
{
|
||||
public:
|
||||
wxCaret() { Init(); }
|
||||
// create the caret of given (in pixels) width and height and associate
|
||||
// with the given window
|
||||
wxCaret(wxWindow *window, int width, int height)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(window, width, height);
|
||||
}
|
||||
// same as above
|
||||
wxCaret(wxWindowBase *window, const wxSize& size)
|
||||
{
|
||||
wxCaretBase::Init();
|
||||
|
||||
(void)Create(window, size);
|
||||
}
|
||||
|
||||
// process wxWindow notifications
|
||||
virtual void OnSetFocus();
|
||||
virtual void OnKillFocus();
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
wxCaretBase::Init();
|
||||
|
||||
m_hasCaret = FALSE;
|
||||
}
|
||||
|
||||
// override base class virtuals
|
||||
virtual void DoMove();
|
||||
virtual void DoShow();
|
||||
virtual void DoHide();
|
||||
|
||||
// helper function which creates the system caret
|
||||
bool MSWCreateCaret();
|
||||
|
||||
private:
|
||||
bool m_hasCaret;
|
||||
};
|
||||
|
||||
#endif // _WX_CARET_H_
|
||||
|
||||
|
@ -71,6 +71,8 @@
|
||||
|
||||
#define wxUSE_SCROLLBAR 1
|
||||
// Define 1 to compile contributed wxScrollBar class
|
||||
#define wxUSE_CARET 1
|
||||
// Define 1 to use wxCaret class
|
||||
#define wxUSE_XPM_IN_MSW 1
|
||||
// Define 1 to support the XPM package in wxBitmap.
|
||||
#define wxUSE_IMAGE_LOADING_IN_MSW 1
|
||||
|
@ -190,9 +190,13 @@ protected:
|
||||
|
||||
wxString m_fileName;
|
||||
|
||||
// call this to increase the size limit (will do nothing if the current
|
||||
// limit is big enough)
|
||||
void AdjustSpaceLimit();
|
||||
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
@ -144,13 +144,16 @@ public:
|
||||
virtual void OnDefaultAction(wxControl * WXUNUSED(initiatingItem)) { }
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
// caret manipulation (MSW only)
|
||||
virtual void CreateCaret(int w, int h);
|
||||
virtual void CreateCaret(const wxBitmap *bitmap);
|
||||
virtual void DestroyCaret();
|
||||
virtual void ShowCaret(bool show);
|
||||
virtual void SetCaretPos(int x, int y);
|
||||
virtual void GetCaretPos(int *x, int *y) const;
|
||||
#if wxUSE_CARET
|
||||
// caret manipulation (old MSW only functions, see wxCaret class for the
|
||||
// new API)
|
||||
void CreateCaret(int w, int h);
|
||||
void CreateCaret(const wxBitmap *bitmap);
|
||||
void DestroyCaret();
|
||||
void ShowCaret(bool show);
|
||||
void SetCaretPos(int x, int y);
|
||||
void GetCaretPos(int *x, int *y) const;
|
||||
#endif // wxUSE_CARET
|
||||
|
||||
// Native resource loading (implemented in src/msw/nativdlg.cpp)
|
||||
// FIXME: should they really be all virtual?
|
||||
@ -374,12 +377,6 @@ protected:
|
||||
bool m_doubleClickAllowed:1;
|
||||
bool m_winCaptured:1;
|
||||
|
||||
// Caret data
|
||||
bool m_caretEnabled:1;
|
||||
bool m_caretShown:1;
|
||||
int m_caretWidth;
|
||||
int m_caretHeight;
|
||||
|
||||
// the size of one page for scrolling
|
||||
int m_xThumbSize;
|
||||
int m_yThumbSize;
|
||||
|
@ -1,6 +1,6 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: window.h
|
||||
// Purpose: wxWindowBase class - the interface of wxWindowBase
|
||||
// Purpose: wxWindowBase class - the interface of wxWindow
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
@ -34,6 +34,7 @@
|
||||
// forward declarations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxCaret;
|
||||
class WXDLLEXPORT wxClientData;
|
||||
class WXDLLEXPORT wxControl;
|
||||
class WXDLLEXPORT wxCursor;
|
||||
@ -475,6 +476,13 @@ public:
|
||||
const wxFont& GetFont() const { return m_font; }
|
||||
wxFont& GetFont() { return m_font; }
|
||||
|
||||
#if wxUSE_CARET
|
||||
// associate a caret with the window
|
||||
void SetCaret(wxCaret *caret);
|
||||
// get the current caret (may be NULL)
|
||||
wxCaret *GetCaret() const { return m_caret; }
|
||||
#endif // wxUSE_CARET
|
||||
|
||||
// get the (average) character size for the current font
|
||||
virtual int GetCharHeight() const = 0;
|
||||
virtual int GetCharWidth() const = 0;
|
||||
@ -658,6 +666,10 @@ protected:
|
||||
wxFont m_font;
|
||||
wxColour m_backgroundColour, m_foregroundColour;
|
||||
|
||||
#if wxUSE_CARET
|
||||
wxCaret *m_caret;
|
||||
#endif // wxUSE_CARET
|
||||
|
||||
// the region which should be repainted in response to paint event
|
||||
wxRegion m_updateRegion;
|
||||
|
||||
|
@ -53,6 +53,10 @@
|
||||
#include "wx/tooltip.h"
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
#if wxUSE_CARET
|
||||
#include "wx/caret.h"
|
||||
#endif // wxUSE_CARET
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// static data
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -136,6 +140,10 @@ void wxWindowBase::InitBase()
|
||||
#if wxUSE_TOOLTIPS
|
||||
m_tooltip = (wxToolTip *)NULL;
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
#if wxUSE_CARET
|
||||
m_caret = (wxCaret *)NULL;
|
||||
#endif // wxUSE_CARET
|
||||
}
|
||||
|
||||
// common part of window creation process
|
||||
@ -181,6 +189,11 @@ wxWindowBase::~wxWindowBase()
|
||||
|
||||
wxASSERT_MSG( GetChildren().GetCount() == 0, _T("children not destroyed") );
|
||||
|
||||
#if wxUSE_CARET
|
||||
if ( m_caret )
|
||||
delete m_caret;
|
||||
#endif // wxUSE_CARET
|
||||
|
||||
if ( m_windowValidator )
|
||||
delete m_windowValidator;
|
||||
|
||||
@ -512,6 +525,24 @@ bool wxWindowBase::SetFont(const wxFont& font)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if wxUSE_CARET
|
||||
void wxWindowBase::SetCaret(wxCaret *caret)
|
||||
{
|
||||
if ( m_caret )
|
||||
{
|
||||
delete m_caret;
|
||||
}
|
||||
|
||||
m_caret = caret;
|
||||
|
||||
if ( m_caret )
|
||||
{
|
||||
wxASSERT_MSG( m_caret->GetWindow() == this,
|
||||
"caret should be created associated to this window" );
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_CARET
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// validators
|
||||
// ----------------------------------------------------------------------------
|
||||
|
163
src/msw/caret.cpp
Normal file
163
src/msw/caret.cpp
Normal file
@ -0,0 +1,163 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: msw/caret.cpp
|
||||
// Purpose: MSW implementation of wxCaret
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 23.05.99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) wxWindows team
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ===========================================================================
|
||||
// declarations
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// headers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "caret.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/window.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/caret.h"
|
||||
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
// ===========================================================================
|
||||
// implementation
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// blink time
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
//static
|
||||
int wxCaretBase::GetBlinkTime()
|
||||
{
|
||||
int blinkTime = ::GetCaretBlinkTime();
|
||||
if ( !blinkTime )
|
||||
{
|
||||
wxLogLastError("GetCaretBlinkTime");
|
||||
}
|
||||
|
||||
return blinkTime;
|
||||
}
|
||||
|
||||
//static
|
||||
void wxCaretBase::SetBlinkTime(int milliseconds)
|
||||
{
|
||||
if ( !::SetCaretBlinkTime(milliseconds) )
|
||||
{
|
||||
wxLogLastError("SetCaretBlinkTime");
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// creating/destroying the caret
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
bool wxCaret::MSWCreateCaret()
|
||||
{
|
||||
wxASSERT_MSG( GetWindow(), "caret without window cannot be created" );
|
||||
wxASSERT_MSG( IsOk(), "caret of zero size cannot be created" );
|
||||
|
||||
if ( !m_hasCaret )
|
||||
{
|
||||
if ( !::CreateCaret(GetWinHwnd(GetWindow()), 0, m_width, m_height) )
|
||||
{
|
||||
wxLogLastError("CreateCaret");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_hasCaret = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return m_hasCaret;
|
||||
}
|
||||
|
||||
void wxCaret::OnSetFocus()
|
||||
{
|
||||
if ( m_countVisible > 0 )
|
||||
{
|
||||
if ( MSWCreateCaret() )
|
||||
{
|
||||
// the caret was recreated but it doesn't remember its position and
|
||||
// it's not shown
|
||||
|
||||
DoMove();
|
||||
DoShow();
|
||||
}
|
||||
}
|
||||
//else: caret is invisible, don't waste time creating it
|
||||
}
|
||||
|
||||
void wxCaret::OnKillFocus()
|
||||
{
|
||||
if ( m_hasCaret )
|
||||
{
|
||||
m_hasCaret = FALSE;
|
||||
|
||||
if ( !::DestroyCaret() )
|
||||
{
|
||||
wxLogLastError("DestroyCaret");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// showing/hiding the caret
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void wxCaret::DoShow()
|
||||
{
|
||||
wxASSERT_MSG( GetWindow(), "caret without window cannot be shown" );
|
||||
wxASSERT_MSG( IsOk(), "caret of zero size cannot be shown" );
|
||||
|
||||
if ( !m_hasCaret )
|
||||
{
|
||||
(void)MSWCreateCaret();
|
||||
}
|
||||
|
||||
if ( !::ShowCaret(GetWinHwnd(GetWindow())) )
|
||||
{
|
||||
wxLogLastError("ShowCaret");
|
||||
}
|
||||
}
|
||||
|
||||
void wxCaret::DoHide()
|
||||
{
|
||||
wxASSERT_MSG( m_hasCaret, "cannot hide non existent caret" );
|
||||
|
||||
if ( !::HideCaret(GetWinHwnd(GetWindow())) )
|
||||
{
|
||||
wxLogLastError("HideCaret");
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// moving the caret
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void wxCaret::DoMove()
|
||||
{
|
||||
wxASSERT_MSG( m_hasCaret, "cannot move non existent caret" );
|
||||
|
||||
if ( !::SetCaretPos(m_x, m_y) )
|
||||
{
|
||||
wxLogLastError("SetCaretPos");
|
||||
}
|
||||
}
|
@ -172,6 +172,7 @@ MSWOBJS = \
|
||||
$(MSWDIR)\bmpbuttn.obj \
|
||||
$(MSWDIR)\brush.obj \
|
||||
$(MSWDIR)\button.obj \
|
||||
$(MSWDIR)\caret.obj \
|
||||
$(MSWDIR)\checkbox.obj \
|
||||
$(MSWDIR)\checklst.obj \
|
||||
$(MSWDIR)\choice.obj \
|
||||
@ -320,12 +321,14 @@ $(MSWDIR)\brush.obj: $(MSWDIR)\brush.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\button.obj: $(MSWDIR)\button.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\choice.obj: $(MSWDIR)\choice.$(SRCSUFF)
|
||||
$(MSWDIR)\caret.obj: $(MSWDIR)\caret.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\checkbox.obj: $(MSWDIR)\checkbox.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\checklst.obj: $(MSWDIR)\checklst.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\choice.obj: $(MSWDIR)\choice.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\clipbrd.obj: $(MSWDIR)\clipbrd.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\colordlg.obj: $(MSWDIR)\colordlg.$(SRCSUFF)
|
||||
|
@ -173,6 +173,7 @@ MSWOBJS = \
|
||||
$(MSWDIR)\button.obj \
|
||||
$(MSWDIR)\checkbox.obj \
|
||||
$(MSWDIR)\checklst.obj \
|
||||
$(MSWDIR)\caret.obj \
|
||||
$(MSWDIR)\choice.obj \
|
||||
$(MSWDIR)\clipbrd.obj \
|
||||
$(MSWDIR)\colordlg.obj \
|
||||
@ -302,6 +303,8 @@ $(MSWDIR)\brush.obj: $(MSWDIR)\brush.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\button.obj: $(MSWDIR)\button.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\caret.obj: $(MSWDIR)\caret.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\choice.obj: $(MSWDIR)\choice.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\checkbox.obj: $(MSWDIR)\checkbox.$(SRCSUFF)
|
||||
|
@ -147,6 +147,7 @@ MSWOBJS = \
|
||||
$(MSWDIR)\button.obj \
|
||||
$(MSWDIR)\checkbox.obj \
|
||||
$(MSWDIR)\checklst.obj \
|
||||
$(MSWDIR)\caret.obj \
|
||||
$(MSWDIR)\choice.obj \
|
||||
$(MSWDIR)\clipbrd.obj \
|
||||
$(MSWDIR)\colordlg.obj \
|
||||
@ -317,6 +318,11 @@ $(MSWDIR)/button.obj: $*.$(SRCSUFF)
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(MSWDIR)/caret.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(MSWDIR)/choice.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
|
@ -153,6 +153,7 @@ MSWOBJS = \
|
||||
button.$(OBJSUFF) \
|
||||
checkbox.$(OBJSUFF) \
|
||||
checklst.$(OBJSUFF) \
|
||||
caret.$(OBJSUFF) \
|
||||
choice.$(OBJSUFF) \
|
||||
clipbrd.$(OBJSUFF) \
|
||||
colordlg.$(OBJSUFF) \
|
||||
|
@ -130,6 +130,7 @@ MSWOBJS = \
|
||||
$(MSWDIR)\button.obj \
|
||||
$(MSWDIR)\checkbox.obj \
|
||||
$(MSWDIR)\checklst.obj \
|
||||
$(MSWDIR)\caret.obj \
|
||||
$(MSWDIR)\choice.obj \
|
||||
$(MSWDIR)\clipbrd.obj \
|
||||
$(MSWDIR)\colordlg.obj \
|
||||
|
@ -116,6 +116,7 @@ MSWOBJS = \
|
||||
button.obj \
|
||||
checkbox.obj \
|
||||
checklst.obj \
|
||||
caret.obj \
|
||||
choice.obj \
|
||||
clipbrd.obj \
|
||||
colordlg.obj \
|
||||
@ -243,6 +244,9 @@ brush.obj: $(MSWDIR)\brush.cpp
|
||||
button.obj: $(MSWDIR)\button.cpp
|
||||
$(CCC) $(CPPFLAGS) $(IFLAGS) $(MSWDIR)\button.cpp /BINARY button.obj
|
||||
|
||||
caret.obj: $(MSWDIR)\caret.cpp
|
||||
$(CCC) $(CPPFLAGS) $(IFLAGS) $(MSWDIR)\caret.cpp /BINARY caret.obj
|
||||
|
||||
choice.obj: $(MSWDIR)\choice.cpp
|
||||
$(CCC) $(CPPFLAGS) $(IFLAGS) $(MSWDIR)\choice.cpp /BINARY choice.obj
|
||||
|
||||
|
@ -154,6 +154,7 @@ MSWOBJS = \
|
||||
button.$(OBJSUFF) \
|
||||
checkbox.$(OBJSUFF) \
|
||||
checklst.$(OBJSUFF) \
|
||||
caret.$(OBJSUFF) \
|
||||
choice.$(OBJSUFF) \
|
||||
clipbrd.$(OBJSUFF) \
|
||||
colordlg.$(OBJSUFF) \
|
||||
|
@ -174,6 +174,7 @@ MSWOBJS = \
|
||||
..\msw\$D\button.obj \
|
||||
..\msw\$D\checkbox.obj \
|
||||
..\msw\$D\checklst.obj \
|
||||
..\msw\$D\caret.obj \
|
||||
..\msw\$D\choice.obj \
|
||||
..\msw\$D\clipbrd.obj \
|
||||
..\msw\$D\colordlg.obj \
|
||||
|
@ -126,6 +126,7 @@ MSWOBJS = &
|
||||
button.obj &
|
||||
checkbox.obj &
|
||||
checklst.obj &
|
||||
caret.obj &
|
||||
choice.obj &
|
||||
clipbrd.obj &
|
||||
colordlg.obj &
|
||||
@ -256,6 +257,9 @@ brush.obj: $(MSWDIR)\brush.cpp
|
||||
button.obj: $(MSWDIR)\button.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
caret.obj: $(MSWDIR)\caret.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
choice.obj: $(MSWDIR)\choice.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
|
@ -143,28 +143,16 @@ bool wxNotebook::Create(wxWindow *parent,
|
||||
if (m_windowStyle & wxNB_FIXEDWIDTH)
|
||||
tabStyle |= TCS_FIXEDWIDTH ;
|
||||
|
||||
// create the tab control.
|
||||
m_hWnd = (WXHWND)CreateWindowEx
|
||||
(
|
||||
0, // extended style
|
||||
WC_TABCONTROL, // class name for the tab control
|
||||
"", // no caption
|
||||
tabStyle, // style
|
||||
pos.x, pos.y, size.x, size.y, // size and position
|
||||
(HWND)parent->GetHWND(), // parent window
|
||||
(HMENU)m_windowId, // child id
|
||||
wxGetInstance(), // current instance
|
||||
NULL // no class data
|
||||
);
|
||||
|
||||
if ( m_hWnd == 0 ) {
|
||||
wxLogSysError("Can't create the notebook control");
|
||||
if ( !MSWCreate(GetId(), GetParent(), WC_TABCONTROL,
|
||||
this, NULL, pos.x, pos.y, size.x, size.y,
|
||||
tabStyle, NULL, 0) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Not all compilers recognise SetWindowFont
|
||||
::SendMessage((HWND) m_hwnd, WM_SETFONT,
|
||||
(WPARAM)::GetStockObject(DEFAULT_GUI_FONT),TRUE);
|
||||
::SendMessage(GetHwnd(), WM_SETFONT,
|
||||
(WPARAM)::GetStockObject(DEFAULT_GUI_FONT), TRUE);
|
||||
|
||||
|
||||
if ( parent != NULL )
|
||||
|
@ -1,10 +1,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: msw/region.cpp
|
||||
// Name: msw/region.cpp
|
||||
// Purpose: Region handling for wxWindows/X11
|
||||
// Author: Markus Holzem
|
||||
// Modified by:
|
||||
// Created: Fri Oct 24 10:46:34 MET 1997
|
||||
// RCS-ID: $Id$
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1997 Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -23,30 +23,31 @@
|
||||
#include "wx/msw/region.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxRegionRefData implementation
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxRegionRefData : public wxGDIRefData {
|
||||
class WXDLLEXPORT wxRegionRefData : public wxGDIRefData
|
||||
{
|
||||
public:
|
||||
wxRegionRefData(void)
|
||||
{
|
||||
wxRegionRefData()
|
||||
{
|
||||
m_region = 0;
|
||||
}
|
||||
}
|
||||
|
||||
wxRegionRefData(const wxRegionRefData& data)
|
||||
{
|
||||
wxRegionRefData(const wxRegionRefData& data)
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
DWORD noBytes = ::GetRegionData(data.m_region, 0, NULL);
|
||||
RGNDATA *rgnData = (RGNDATA*) new char[noBytes];
|
||||
::GetRegionData(data.m_region, noBytes, rgnData);
|
||||
::GetRegionData(data.m_region, noBytes, rgnData);
|
||||
m_region = ::ExtCreateRegion(NULL, noBytes, rgnData);
|
||||
delete[] (char*) rgnData;
|
||||
#else
|
||||
@ -54,15 +55,15 @@ public:
|
||||
::GetRgnBox(data.m_region, &rect);
|
||||
m_region = ::CreateRectRgnIndirect(&rect);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
~wxRegionRefData(void)
|
||||
{
|
||||
::DeleteObject(m_region);
|
||||
~wxRegionRefData()
|
||||
{
|
||||
::DeleteObject(m_region);
|
||||
m_region = 0;
|
||||
}
|
||||
}
|
||||
|
||||
HRGN m_region;
|
||||
HRGN m_region;
|
||||
};
|
||||
|
||||
#define M_REGION (((wxRegionRefData*)m_refData)->m_region)
|
||||
@ -71,10 +72,10 @@ public:
|
||||
// wxRegion
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
/*
|
||||
* Create an empty region.
|
||||
*/
|
||||
wxRegion::wxRegion(void)
|
||||
wxRegion::wxRegion()
|
||||
{
|
||||
m_refData = new wxRegionRefData;
|
||||
M_REGION = ::CreateRectRgn(0, 0, 0, 0);
|
||||
@ -104,35 +105,35 @@ wxRegion::wxRegion(const wxRect& rect)
|
||||
M_REGION = ::CreateRectRgn(rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom());
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
* Destroy the region.
|
||||
*/
|
||||
wxRegion::~wxRegion(void)
|
||||
wxRegion::~wxRegion()
|
||||
{
|
||||
// m_refData unrefed in ~wxObject
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//# Modify region
|
||||
// Modify region
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//! Clear current region
|
||||
void wxRegion::Clear(void)
|
||||
// Clear current region
|
||||
void wxRegion::Clear()
|
||||
{
|
||||
UnRef();
|
||||
UnRef();
|
||||
}
|
||||
|
||||
//! Combine rectangle (x, y, w, h) with this.
|
||||
// Combine rectangle (x, y, w, h) with this.
|
||||
bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
|
||||
{
|
||||
// Don't change shared data
|
||||
if (!m_refData) {
|
||||
m_refData = new wxRegionRefData();
|
||||
} else if (m_refData->GetRefCount() > 1) {
|
||||
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
||||
UnRef();
|
||||
m_refData = new wxRegionRefData(*ref);
|
||||
}
|
||||
// Don't change shared data
|
||||
if (!m_refData) {
|
||||
m_refData = new wxRegionRefData();
|
||||
} else if (m_refData->GetRefCount() > 1) {
|
||||
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
||||
UnRef();
|
||||
m_refData = new wxRegionRefData(*ref);
|
||||
}
|
||||
// If ref count is 1, that means it's 'ours' anyway so no action.
|
||||
|
||||
HRGN rectRegion = ::CreateRectRgn(x, y, x + width, y + height);
|
||||
@ -149,27 +150,27 @@ bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
|
||||
mode = RGN_COPY; break ;
|
||||
}
|
||||
|
||||
bool success = (ERROR != ::CombineRgn(M_REGION, M_REGION, rectRegion, mode));
|
||||
bool success = (ERROR != ::CombineRgn(M_REGION, M_REGION, rectRegion, mode));
|
||||
|
||||
::DeleteObject(rectRegion);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
//! Union /e region with this.
|
||||
// Union /e region with this.
|
||||
bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
|
||||
{
|
||||
if (region.Empty())
|
||||
return FALSE;
|
||||
if (region.Empty())
|
||||
return FALSE;
|
||||
|
||||
// Don't change shared data
|
||||
if (!m_refData) {
|
||||
m_refData = new wxRegionRefData();
|
||||
} else if (m_refData->GetRefCount() > 1) {
|
||||
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
||||
UnRef();
|
||||
m_refData = new wxRegionRefData(*ref);
|
||||
}
|
||||
// Don't change shared data
|
||||
if (!m_refData) {
|
||||
m_refData = new wxRegionRefData();
|
||||
} else if (m_refData->GetRefCount() > 1) {
|
||||
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
||||
UnRef();
|
||||
m_refData = new wxRegionRefData(*ref);
|
||||
}
|
||||
|
||||
int mode = 0;
|
||||
switch (op)
|
||||
@ -183,7 +184,7 @@ bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
|
||||
mode = RGN_COPY; break ;
|
||||
}
|
||||
|
||||
return (ERROR != ::CombineRgn(M_REGION, M_REGION, ((wxRegionRefData*)region.m_refData)->m_region, mode));
|
||||
return (ERROR != ::CombineRgn(M_REGION, M_REGION, ((wxRegionRefData*)region.m_refData)->m_region, mode));
|
||||
}
|
||||
|
||||
bool wxRegion::Combine(const wxRect& rect, wxRegionOp op)
|
||||
@ -192,25 +193,25 @@ bool wxRegion::Combine(const wxRect& rect, wxRegionOp op)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//# Information on region
|
||||
// Information on region
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Outer bounds of region
|
||||
void wxRegion::GetBox(long& x, long& y, long&w, long &h) const
|
||||
{
|
||||
if (m_refData) {
|
||||
if (m_refData) {
|
||||
RECT rect;
|
||||
::GetRgnBox(M_REGION, & rect);
|
||||
x = rect.left;
|
||||
y = rect.top;
|
||||
w = rect.right - rect.left;
|
||||
h = rect.bottom - rect.top;
|
||||
} else {
|
||||
x = y = w = h = 0;
|
||||
}
|
||||
x = rect.left;
|
||||
y = rect.top;
|
||||
w = rect.right - rect.left;
|
||||
h = rect.bottom - rect.top;
|
||||
} else {
|
||||
x = y = w = h = 0;
|
||||
}
|
||||
}
|
||||
|
||||
wxRect wxRegion::GetBox(void) const
|
||||
wxRect wxRegion::GetBox() const
|
||||
{
|
||||
long x, y, w, h;
|
||||
GetBox(x, y, w, h);
|
||||
@ -218,7 +219,7 @@ wxRect wxRegion::GetBox(void) const
|
||||
}
|
||||
|
||||
// Is region empty?
|
||||
bool wxRegion::Empty(void) const
|
||||
bool wxRegion::Empty() const
|
||||
{
|
||||
if (M_REGION == 0)
|
||||
return TRUE;
|
||||
@ -229,14 +230,14 @@ bool wxRegion::Empty(void) const
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//# Tests
|
||||
// Tests
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Does the region contain the point (x,y)?
|
||||
wxRegionContain wxRegion::Contains(long x, long y) const
|
||||
{
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
if (::PtInRegion(M_REGION, (int) x, (int) y))
|
||||
return wxInRegion;
|
||||
@ -247,8 +248,8 @@ wxRegionContain wxRegion::Contains(long x, long y) const
|
||||
// Does the region contain the point pt?
|
||||
wxRegionContain wxRegion::Contains(const wxPoint& pt) const
|
||||
{
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
if (::PtInRegion(M_REGION, (int) pt.x, (int) pt.y))
|
||||
return wxInRegion;
|
||||
@ -259,8 +260,8 @@ wxRegionContain wxRegion::Contains(const wxPoint& pt) const
|
||||
// Does the region contain the rectangle (x, y, w, h)?
|
||||
wxRegionContain wxRegion::Contains(long x, long y, long w, long h) const
|
||||
{
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
RECT rect;
|
||||
rect.left = x;
|
||||
@ -277,8 +278,8 @@ wxRegionContain wxRegion::Contains(long x, long y, long w, long h) const
|
||||
// Does the region contain the rectangle rect
|
||||
wxRegionContain wxRegion::Contains(const wxRect& rect) const
|
||||
{
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
if (!m_refData)
|
||||
return wxOutRegion;
|
||||
|
||||
long x, y, w, h;
|
||||
x = rect.x;
|
||||
@ -297,55 +298,55 @@ WXHRGN wxRegion::GetHRGN() const
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// wxRegionIterator //
|
||||
// //
|
||||
// //
|
||||
// wxRegionIterator //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*!
|
||||
/*
|
||||
* Initialize empty iterator
|
||||
*/
|
||||
wxRegionIterator::wxRegionIterator(void) : m_current(0), m_numRects(0), m_rects(NULL)
|
||||
wxRegionIterator::wxRegionIterator() : m_current(0), m_numRects(0), m_rects(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
wxRegionIterator::~wxRegionIterator(void)
|
||||
wxRegionIterator::~wxRegionIterator()
|
||||
{
|
||||
if (m_rects)
|
||||
delete[] m_rects;
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
* Initialize iterator for region
|
||||
*/
|
||||
wxRegionIterator::wxRegionIterator(const wxRegion& region)
|
||||
{
|
||||
m_rects = NULL;
|
||||
|
||||
Reset(region);
|
||||
Reset(region);
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
* Reset iterator for a new /e region.
|
||||
*/
|
||||
void wxRegionIterator::Reset(const wxRegion& region)
|
||||
{
|
||||
m_current = 0;
|
||||
m_region = region;
|
||||
m_current = 0;
|
||||
m_region = region;
|
||||
|
||||
if (m_rects)
|
||||
delete[] m_rects;
|
||||
|
||||
m_rects = NULL;
|
||||
|
||||
if (m_region.Empty())
|
||||
m_numRects = 0;
|
||||
else
|
||||
if (m_region.Empty())
|
||||
m_numRects = 0;
|
||||
else
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
DWORD noBytes = ::GetRegionData(((wxRegionRefData*)region.m_refData)->m_region, 0, NULL);
|
||||
RGNDATA *rgnData = (RGNDATA*) new char[noBytes];
|
||||
::GetRegionData(((wxRegionRefData*)region.m_refData)->m_region, noBytes, rgnData);
|
||||
::GetRegionData(((wxRegionRefData*)region.m_refData)->m_region, noBytes, rgnData);
|
||||
|
||||
RGNDATAHEADER* header = (RGNDATAHEADER*) rgnData;
|
||||
|
||||
@ -377,51 +378,51 @@ void wxRegionIterator::Reset(const wxRegion& region)
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
* Increment iterator. The rectangle returned is the one after the
|
||||
* incrementation.
|
||||
*/
|
||||
void wxRegionIterator::operator ++ (void)
|
||||
void wxRegionIterator::operator ++ ()
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
++m_current;
|
||||
if (m_current < m_numRects)
|
||||
++m_current;
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
* Increment iterator. The rectangle returned is the one before the
|
||||
* incrementation.
|
||||
*/
|
||||
void wxRegionIterator::operator ++ (int)
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
++m_current;
|
||||
if (m_current < m_numRects)
|
||||
++m_current;
|
||||
}
|
||||
|
||||
long wxRegionIterator::GetX(void) const
|
||||
long wxRegionIterator::GetX() const
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].x;
|
||||
return 0;
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].x;
|
||||
return 0;
|
||||
}
|
||||
|
||||
long wxRegionIterator::GetY(void) const
|
||||
long wxRegionIterator::GetY() const
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].y;
|
||||
return 0;
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].y;
|
||||
return 0;
|
||||
}
|
||||
|
||||
long wxRegionIterator::GetW(void) const
|
||||
long wxRegionIterator::GetW() const
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].width ;
|
||||
return 0;
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].width ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
long wxRegionIterator::GetH(void) const
|
||||
long wxRegionIterator::GetH() const
|
||||
{
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].height;
|
||||
return 0;
|
||||
if (m_current < m_numRects)
|
||||
return m_rects[m_current].height;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ void wxTextCtrl::AdoptAttributesFromHWND()
|
||||
{
|
||||
wxWindow::AdoptAttributesFromHWND();
|
||||
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
long style = GetWindowLong((HWND) hWnd, GWL_STYLE);
|
||||
|
||||
// retrieve the style to see whether this is an edit or richedit ctrl
|
||||
@ -283,12 +283,7 @@ void wxTextCtrl::SetupColours()
|
||||
|
||||
wxString wxTextCtrl::GetValue() const
|
||||
{
|
||||
int length = GetWindowTextLength((HWND) GetHWND());
|
||||
char *s = new char[length+1];
|
||||
GetWindowText((HWND) GetHWND(), s, length+1);
|
||||
wxString str(s);
|
||||
delete[] s;
|
||||
return str;
|
||||
return wxGetWindowText(GetHWND());
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetValue(const wxString& value)
|
||||
@ -317,11 +312,13 @@ void wxTextCtrl::SetValue(const wxString& value)
|
||||
j ++;
|
||||
}
|
||||
tmp[j] = 0;
|
||||
SetWindowText((HWND) GetHWND(), tmp);
|
||||
SetWindowText(GetHwnd(), tmp);
|
||||
delete[] tmp;
|
||||
}
|
||||
else
|
||||
SetWindowText((HWND) GetHWND(), (const char *)value);
|
||||
SetWindowText(GetHwnd(), (const char *)value);
|
||||
|
||||
AdjustSpaceLimit();
|
||||
}
|
||||
|
||||
void wxTextCtrl::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
@ -369,7 +366,7 @@ void wxTextCtrl::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (control_width <= 0)
|
||||
control_width = DEFAULT_ITEM_WIDTH;
|
||||
|
||||
MoveWindow((HWND) GetHWND(), (int)control_x, (int)control_y,
|
||||
MoveWindow(GetHwnd(), (int)control_x, (int)control_y,
|
||||
(int)control_width, (int)control_height, TRUE);
|
||||
}
|
||||
|
||||
@ -378,7 +375,7 @@ void wxTextCtrl::Copy()
|
||||
{
|
||||
if (CanCopy())
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
SendMessage(hWnd, WM_COPY, 0, 0L);
|
||||
}
|
||||
}
|
||||
@ -387,7 +384,7 @@ void wxTextCtrl::Cut()
|
||||
{
|
||||
if (CanCut())
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
SendMessage(hWnd, WM_CUT, 0, 0L);
|
||||
}
|
||||
}
|
||||
@ -396,20 +393,20 @@ void wxTextCtrl::Paste()
|
||||
{
|
||||
if (CanPaste())
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
SendMessage(hWnd, WM_PASTE, 0, 0L);
|
||||
}
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetEditable(bool editable)
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
SendMessage(hWnd, EM_SETREADONLY, (WPARAM)!editable, (LPARAM)0L);
|
||||
}
|
||||
|
||||
void wxTextCtrl::SetInsertionPoint(long pos)
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
#ifdef __WIN32__
|
||||
#if wxUSE_RICHEDIT
|
||||
if ( m_isRich)
|
||||
@ -447,18 +444,18 @@ long wxTextCtrl::GetInsertionPoint() const
|
||||
CHARRANGE range;
|
||||
range.cpMin = 0;
|
||||
range.cpMax = 0;
|
||||
SendMessage((HWND) GetHWND(), EM_EXGETSEL, 0, (LPARAM) &range);
|
||||
SendMessage(GetHwnd(), EM_EXGETSEL, 0, (LPARAM) &range);
|
||||
return range.cpMin;
|
||||
}
|
||||
#endif
|
||||
|
||||
DWORD Pos=(DWORD)SendMessage((HWND) GetHWND(), EM_GETSEL, 0, 0L);
|
||||
DWORD Pos=(DWORD)SendMessage(GetHwnd(), EM_GETSEL, 0, 0L);
|
||||
return Pos&0xFFFF;
|
||||
}
|
||||
|
||||
long wxTextCtrl::GetLastPosition() const
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
|
||||
// Will always return a number > 0 (according to docs)
|
||||
int noLines = (int)SendMessage(hWnd, EM_GETLINECOUNT, (WPARAM)0, (LPARAM)0L);
|
||||
@ -476,7 +473,7 @@ long wxTextCtrl::GetLastPosition() const
|
||||
void wxTextCtrl::Replace(long from, long to, const wxString& value)
|
||||
{
|
||||
#if wxUSE_CLIPBOARD
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
long fromChar = from;
|
||||
long toChar = to;
|
||||
|
||||
@ -500,7 +497,7 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value)
|
||||
|
||||
void wxTextCtrl::Remove(long from, long to)
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
long fromChar = from;
|
||||
long toChar = to;
|
||||
|
||||
@ -515,7 +512,7 @@ void wxTextCtrl::Remove(long from, long to)
|
||||
|
||||
void wxTextCtrl::SetSelection(long from, long to)
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
long fromChar = from;
|
||||
long toChar = to;
|
||||
// if from and to are both -1, it means
|
||||
@ -584,11 +581,13 @@ bool wxTextCtrl::LoadFile(const wxString& file)
|
||||
no_lines++;
|
||||
}
|
||||
|
||||
// SendMessage((HWND) GetHWND(), WM_SETTEXT, 0, (LPARAM)tmp_buffer);
|
||||
SetWindowText((HWND) GetHWND(), tmp_buffer);
|
||||
SendMessage((HWND) GetHWND(), EM_SETMODIFY, FALSE, 0L);
|
||||
SetWindowText(GetHwnd(), tmp_buffer);
|
||||
SendMessage(GetHwnd(), EM_SETMODIFY, FALSE, 0L);
|
||||
farfree(tmp_buffer);
|
||||
|
||||
// update the size limit if needed
|
||||
AdjustSpaceLimit();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -613,9 +612,9 @@ bool wxTextCtrl::SaveFile(const wxString& file)
|
||||
return FALSE;
|
||||
|
||||
// This will only save 64K max
|
||||
unsigned long nbytes = SendMessage((HWND) GetHWND(), WM_GETTEXTLENGTH, 0, 0);
|
||||
unsigned long nbytes = SendMessage(GetHwnd(), WM_GETTEXTLENGTH, 0, 0);
|
||||
char *tmp_buffer = (char*)farmalloc((size_t)(nbytes+1));
|
||||
SendMessage((HWND) GetHWND(), WM_GETTEXT, (WPARAM)(nbytes+1), (LPARAM)tmp_buffer);
|
||||
SendMessage(GetHwnd(), WM_GETTEXT, (WPARAM)(nbytes+1), (LPARAM)tmp_buffer);
|
||||
char *pstr = tmp_buffer;
|
||||
|
||||
// Convert \r\n to just \n
|
||||
@ -627,7 +626,7 @@ bool wxTextCtrl::SaveFile(const wxString& file)
|
||||
}
|
||||
|
||||
farfree(tmp_buffer);
|
||||
SendMessage((HWND) GetHWND(), EM_SETMODIFY, FALSE, 0L);
|
||||
SendMessage(GetHwnd(), EM_SETMODIFY, FALSE, 0L);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -651,8 +650,10 @@ void wxTextCtrl::WriteText(const wxString& text)
|
||||
j ++;
|
||||
}
|
||||
newtext[j] = 0;
|
||||
SendMessage((HWND) GetHWND(), EM_REPLACESEL, 0, (LPARAM)newtext);
|
||||
SendMessage(GetHwnd(), EM_REPLACESEL, 0, (LPARAM)newtext);
|
||||
delete[] newtext;
|
||||
|
||||
AdjustSpaceLimit();
|
||||
}
|
||||
|
||||
void wxTextCtrl::AppendText(const wxString& text)
|
||||
@ -663,18 +664,18 @@ void wxTextCtrl::AppendText(const wxString& text)
|
||||
|
||||
void wxTextCtrl::Clear()
|
||||
{
|
||||
SetWindowText((HWND) GetHWND(), "");
|
||||
SetWindowText(GetHwnd(), "");
|
||||
}
|
||||
|
||||
bool wxTextCtrl::IsModified() const
|
||||
{
|
||||
return (SendMessage((HWND) GetHWND(), EM_GETMODIFY, 0, 0) != 0);
|
||||
return (SendMessage(GetHwnd(), EM_GETMODIFY, 0, 0) != 0);
|
||||
}
|
||||
|
||||
// Makes 'unmodified'
|
||||
void wxTextCtrl::DiscardEdits()
|
||||
{
|
||||
SendMessage((HWND) GetHWND(), EM_SETMODIFY, FALSE, 0L);
|
||||
SendMessage(GetHwnd(), EM_SETMODIFY, FALSE, 0L);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -684,12 +685,12 @@ void wxTextCtrl::DiscardEdits()
|
||||
|
||||
int wxTextCtrl::GetNumberOfLines() const
|
||||
{
|
||||
return (int)SendMessage((HWND) GetHWND(), EM_GETLINECOUNT, (WPARAM)0, (LPARAM)0);
|
||||
return (int)SendMessage(GetHwnd(), EM_GETLINECOUNT, (WPARAM)0, (LPARAM)0);
|
||||
}
|
||||
|
||||
long wxTextCtrl::XYToPosition(long x, long y) const
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
|
||||
// This gets the char index for the _beginning_ of this line
|
||||
int charIndex = (int)SendMessage(hWnd, EM_LINEINDEX, (WPARAM)y, (LPARAM)0);
|
||||
@ -698,7 +699,7 @@ long wxTextCtrl::XYToPosition(long x, long y) const
|
||||
|
||||
void wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
|
||||
// This gets the line number containing the character
|
||||
int lineNo = (int)SendMessage(hWnd, EM_LINEFROMCHAR, (WPARAM)pos, (LPARAM)0);
|
||||
@ -711,7 +712,7 @@ void wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
|
||||
|
||||
void wxTextCtrl::ShowPosition(long pos)
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
|
||||
// To scroll to a position, we pass the number of lines and characters
|
||||
// to scroll *by*. This means that we need to:
|
||||
@ -737,14 +738,14 @@ void wxTextCtrl::ShowPosition(long pos)
|
||||
int wxTextCtrl::GetLineLength(long lineNo) const
|
||||
{
|
||||
long charIndex = XYToPosition(0, lineNo);
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
int len = (int)SendMessage(hWnd, EM_LINELENGTH, (WPARAM)charIndex, (LPARAM)0);
|
||||
return len;
|
||||
}
|
||||
|
||||
wxString wxTextCtrl::GetLineText(long lineNo) const
|
||||
{
|
||||
HWND hWnd = (HWND) GetHWND();
|
||||
HWND hWnd = GetHwnd();
|
||||
*(WORD *)wxBuffer = 512;
|
||||
int noChars = (int)SendMessage(hWnd, EM_GETLINE, (WPARAM)lineNo, (LPARAM)wxBuffer);
|
||||
wxBuffer[noChars] = 0;
|
||||
@ -773,7 +774,7 @@ bool wxTextCtrl::CanPaste() const
|
||||
if (m_isRich)
|
||||
{
|
||||
int dataFormat = 0; // 0 == any format
|
||||
return (::SendMessage( (HWND) GetHWND(), EM_CANPASTE, (WPARAM) (UINT) dataFormat, 0) != 0);
|
||||
return (::SendMessage( GetHwnd(), EM_CANPASTE, (WPARAM) (UINT) dataFormat, 0) != 0);
|
||||
}
|
||||
#endif
|
||||
if (!IsEditable())
|
||||
@ -794,7 +795,7 @@ void wxTextCtrl::Undo()
|
||||
{
|
||||
if (CanUndo())
|
||||
{
|
||||
::SendMessage((HWND) GetHWND(), EM_UNDO, 0, 0);
|
||||
::SendMessage(GetHwnd(), EM_UNDO, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -803,18 +804,18 @@ void wxTextCtrl::Redo()
|
||||
if (CanRedo())
|
||||
{
|
||||
// Same as Undo, since Undo undoes the undo, i.e. a redo.
|
||||
::SendMessage((HWND) GetHWND(), EM_UNDO, 0, 0);
|
||||
::SendMessage(GetHwnd(), EM_UNDO, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool wxTextCtrl::CanUndo() const
|
||||
{
|
||||
return (::SendMessage((HWND) GetHWND(), EM_CANUNDO, 0, 0) != 0);
|
||||
return (::SendMessage(GetHwnd(), EM_CANUNDO, 0, 0) != 0);
|
||||
}
|
||||
|
||||
bool wxTextCtrl::CanRedo() const
|
||||
{
|
||||
return (::SendMessage((HWND) GetHWND(), EM_CANUNDO, 0, 0) != 0);
|
||||
return (::SendMessage(GetHwnd(), EM_CANUNDO, 0, 0) != 0);
|
||||
}
|
||||
|
||||
// If the return values from and to are the same, there is no
|
||||
@ -825,7 +826,7 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
|
||||
if (m_isRich)
|
||||
{
|
||||
CHARRANGE charRange;
|
||||
::SendMessage((HWND) GetHWND(), EM_EXGETSEL, 0, (LPARAM) (CHARRANGE*) & charRange);
|
||||
::SendMessage(GetHwnd(), EM_EXGETSEL, 0, (LPARAM) (CHARRANGE*) & charRange);
|
||||
|
||||
*from = charRange.cpMin;
|
||||
*to = charRange.cpMax;
|
||||
@ -837,7 +838,7 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
|
||||
WPARAM wParam = (WPARAM) (DWORD*) & dwStart; // receives starting position
|
||||
LPARAM lParam = (LPARAM) (DWORD*) & dwEnd; // receives ending position
|
||||
|
||||
::SendMessage((HWND) GetHWND(), EM_GETSEL, wParam, lParam);
|
||||
::SendMessage(GetHwnd(), EM_GETSEL, wParam, lParam);
|
||||
|
||||
*from = dwStart;
|
||||
*to = dwEnd;
|
||||
@ -845,7 +846,8 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
|
||||
|
||||
bool wxTextCtrl::IsEditable() const
|
||||
{
|
||||
long style = ::GetWindowLong((HWND) GetHWND(), GWL_STYLE);
|
||||
long style = ::GetWindowLong(GetHwnd(), GWL_STYLE);
|
||||
|
||||
return ((style & ES_READONLY) == 0);
|
||||
}
|
||||
|
||||
@ -1137,78 +1139,62 @@ long wxTextCtrl::MSWGetDlgCode()
|
||||
|
||||
bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||
{
|
||||
/*
|
||||
// Debugging
|
||||
wxDebugMsg("Edit control %d: ", (int)id);
|
||||
switch (param)
|
||||
{
|
||||
case EN_SETFOCUS:
|
||||
wxDebugMsg("EN_SETFOCUS\n");
|
||||
break;
|
||||
case EN_KILLFOCUS:
|
||||
wxDebugMsg("EN_KILLFOCUS\n");
|
||||
break;
|
||||
case EN_CHANGE:
|
||||
wxDebugMsg("EN_CHANGE\n");
|
||||
break;
|
||||
case EN_UPDATE:
|
||||
wxDebugMsg("EN_UPDATE\n");
|
||||
break;
|
||||
case EN_ERRSPACE:
|
||||
wxDebugMsg("EN_ERRSPACE\n");
|
||||
break;
|
||||
case EN_MAXTEXT:
|
||||
wxDebugMsg("EN_MAXTEXT\n");
|
||||
break;
|
||||
case EN_HSCROLL:
|
||||
wxDebugMsg("EN_HSCROLL\n");
|
||||
break;
|
||||
case EN_VSCROLL:
|
||||
wxDebugMsg("EN_VSCROLL\n");
|
||||
break;
|
||||
default:
|
||||
wxDebugMsg("Unknown EDIT notification\n");
|
||||
break;
|
||||
}
|
||||
*/
|
||||
switch (param)
|
||||
{
|
||||
case EN_SETFOCUS:
|
||||
case EN_KILLFOCUS:
|
||||
{
|
||||
wxFocusEvent event(param == EN_KILLFOCUS ? wxEVT_KILL_FOCUS
|
||||
: wxEVT_SET_FOCUS,
|
||||
m_windowId);
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
break;
|
||||
switch (param)
|
||||
{
|
||||
case EN_SETFOCUS:
|
||||
case EN_KILLFOCUS:
|
||||
{
|
||||
wxFocusEvent event(param == EN_KILLFOCUS ? wxEVT_KILL_FOCUS
|
||||
: wxEVT_SET_FOCUS,
|
||||
m_windowId);
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
break;
|
||||
|
||||
case EN_CHANGE:
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
||||
wxString val(GetValue());
|
||||
if ( !val.IsNull() )
|
||||
event.m_commandString = WXSTRINGCAST val;
|
||||
event.SetEventObject( this );
|
||||
ProcessCommand(event);
|
||||
}
|
||||
break;
|
||||
case EN_CHANGE:
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
||||
wxString val(GetValue());
|
||||
if ( !val.IsNull() )
|
||||
event.m_commandString = WXSTRINGCAST val;
|
||||
event.SetEventObject( this );
|
||||
ProcessCommand(event);
|
||||
}
|
||||
break;
|
||||
|
||||
// the other notification messages are not processed
|
||||
case EN_UPDATE:
|
||||
case EN_ERRSPACE:
|
||||
case EN_MAXTEXT:
|
||||
case EN_HSCROLL:
|
||||
case EN_VSCROLL:
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
case EN_ERRSPACE:
|
||||
// the text size limit has been hit - increase it
|
||||
AdjustSpaceLimit();
|
||||
break;
|
||||
|
||||
// processed
|
||||
return TRUE;
|
||||
// the other notification messages are not processed
|
||||
case EN_UPDATE:
|
||||
case EN_MAXTEXT:
|
||||
case EN_HSCROLL:
|
||||
case EN_VSCROLL:
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// processed
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxTextCtrl::AdjustSpaceLimit()
|
||||
{
|
||||
unsigned int len = ::GetWindowTextLength(GetHwnd()),
|
||||
limit = ::SendMessage(GetHwnd(), EM_GETLIMITTEXT, 0, 0);
|
||||
if ( len > limit )
|
||||
{
|
||||
limit = len + 0x8000; // 32Kb
|
||||
|
||||
if ( m_isRich || limit > 0xffff )
|
||||
::SendMessage(GetHwnd(), EM_LIMITTEXT, 0, limit);
|
||||
else
|
||||
::SendMessage(GetHwnd(), EM_LIMITTEXT, limit, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// For Rich Edit controls. Do we need it?
|
||||
#if 0
|
||||
|
@ -61,6 +61,10 @@
|
||||
#include "wx/tooltip.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_CARET
|
||||
#include "wx/caret.h"
|
||||
#endif // wxUSE_CARET
|
||||
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
@ -231,12 +235,6 @@ void wxWindow::Init()
|
||||
m_doubleClickAllowed = 0;
|
||||
m_winCaptured = FALSE;
|
||||
|
||||
// caret stuff: initially there is no caret at all
|
||||
m_caretWidth =
|
||||
m_caretHeight = 0;
|
||||
m_caretEnabled =
|
||||
m_caretShown = FALSE;
|
||||
|
||||
m_isBeingDeleted = FALSE;
|
||||
m_oldWndProc = 0;
|
||||
m_useCtl3D = FALSE;
|
||||
@ -1296,51 +1294,47 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y,
|
||||
if ( externalLeading ) *externalLeading = tm.tmExternalLeading;
|
||||
}
|
||||
|
||||
#if wxUSE_CARET
|
||||
// ---------------------------------------------------------------------------
|
||||
// Caret manipulation
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void wxWindow::CreateCaret(int w, int h)
|
||||
{
|
||||
m_caretWidth = w;
|
||||
m_caretHeight = h;
|
||||
m_caretEnabled = TRUE;
|
||||
SetCaret(new wxCaret(this, w, h));
|
||||
}
|
||||
|
||||
void wxWindow::CreateCaret(const wxBitmap *WXUNUSED(bitmap))
|
||||
{
|
||||
// Not implemented
|
||||
wxFAIL_MSG("not implemented");
|
||||
}
|
||||
|
||||
void wxWindow::ShowCaret(bool show)
|
||||
{
|
||||
if ( m_caretEnabled )
|
||||
{
|
||||
if ( show )
|
||||
::ShowCaret(GetHwnd());
|
||||
else
|
||||
::HideCaret(GetHwnd());
|
||||
m_caretShown = show;
|
||||
}
|
||||
wxCHECK_RET( m_caret, "no caret to show" );
|
||||
|
||||
m_caret->Show(show);
|
||||
}
|
||||
|
||||
void wxWindow::DestroyCaret()
|
||||
{
|
||||
m_caretEnabled = FALSE;
|
||||
SetCaret(NULL);
|
||||
}
|
||||
|
||||
void wxWindow::SetCaretPos(int x, int y)
|
||||
{
|
||||
::SetCaretPos(x, y);
|
||||
wxCHECK_RET( m_caret, "no caret to move" );
|
||||
|
||||
m_caret->Move(x, y);
|
||||
}
|
||||
|
||||
void wxWindow::GetCaretPos(int *x, int *y) const
|
||||
{
|
||||
POINT point;
|
||||
::GetCaretPos(&point);
|
||||
*x = point.x;
|
||||
*y = point.y;
|
||||
wxCHECK_RET( m_caret, "no caret to get position of" );
|
||||
|
||||
m_caret->GetPosition(x, y);
|
||||
}
|
||||
#endif // wxUSE_CARET
|
||||
|
||||
// ===========================================================================
|
||||
// pre/post message processing
|
||||
@ -2089,7 +2083,22 @@ bool wxWindow::MSWCreate(int id,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
::MoveWindow(GetHwnd(), x1, y1, width1, height1, FALSE);
|
||||
// ::SetWindowLong(GWL_EXSTYLE) doesn't work for the dialogs, so try
|
||||
// to take care of (at least some) extended style flags ourselves
|
||||
if ( extendedStyle & WS_EX_TOPMOST )
|
||||
{
|
||||
if ( !::SetWindowPos(GetHwnd(), HWND_TOPMOST, 0, 0, 0, 0,
|
||||
SWP_NOSIZE | SWP_NOMOVE) )
|
||||
{
|
||||
wxLogLastError("SetWindowPos");
|
||||
}
|
||||
}
|
||||
|
||||
// move the dialog to its initial position without forcing repainting
|
||||
if ( !::MoveWindow(GetHwnd(), x1, y1, width1, height1, FALSE) )
|
||||
{
|
||||
wxLogLastError("MoveWindow");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2277,20 +2286,13 @@ bool wxWindow::HandleActivate(int state,
|
||||
|
||||
bool wxWindow::HandleSetFocus(WXHWND WXUNUSED(hwnd))
|
||||
{
|
||||
#if wxUSE_CARET
|
||||
// Deal with caret
|
||||
if ( m_caretEnabled && (m_caretWidth > 0) && (m_caretHeight > 0) )
|
||||
if ( m_caret )
|
||||
{
|
||||
if ( ::CreateCaret(GetHwnd(), NULL, m_caretWidth, m_caretHeight) )
|
||||
{
|
||||
if ( m_caretShown )
|
||||
{
|
||||
if ( !::ShowCaret(GetHwnd()) )
|
||||
wxLogLastError("ShowCaret");
|
||||
}
|
||||
}
|
||||
else
|
||||
wxLogLastError("CreateCaret");
|
||||
m_caret->OnSetFocus();
|
||||
}
|
||||
#endif // wxUSE_CARET
|
||||
|
||||
// panel wants to track the window which was the last to have focus in it
|
||||
wxWindow *parent = GetParent();
|
||||
@ -2307,12 +2309,13 @@ bool wxWindow::HandleSetFocus(WXHWND WXUNUSED(hwnd))
|
||||
|
||||
bool wxWindow::HandleKillFocus(WXHWND WXUNUSED(hwnd))
|
||||
{
|
||||
#if wxUSE_CARET
|
||||
// Deal with caret
|
||||
if ( m_caretEnabled )
|
||||
if ( m_caret )
|
||||
{
|
||||
if ( !::DestroyCaret() )
|
||||
wxLogLastError("DestroyCaret");
|
||||
m_caret->OnKillFocus();
|
||||
}
|
||||
#endif // wxUSE_CARET
|
||||
|
||||
wxFocusEvent event(wxEVT_KILL_FOCUS, m_windowId);
|
||||
event.SetEventObject(this);
|
||||
|
Loading…
Reference in New Issue
Block a user