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:
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 wxUSE_SCROLLBAR 1
|
||||||
// Define 1 to compile contributed wxScrollBar class
|
// Define 1 to compile contributed wxScrollBar class
|
||||||
|
#define wxUSE_CARET 1
|
||||||
|
// Define 1 to use wxCaret class
|
||||||
#define wxUSE_XPM_IN_MSW 1
|
#define wxUSE_XPM_IN_MSW 1
|
||||||
// Define 1 to support the XPM package in wxBitmap.
|
// Define 1 to support the XPM package in wxBitmap.
|
||||||
#define wxUSE_IMAGE_LOADING_IN_MSW 1
|
#define wxUSE_IMAGE_LOADING_IN_MSW 1
|
||||||
|
@@ -190,9 +190,13 @@ protected:
|
|||||||
|
|
||||||
wxString m_fileName;
|
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,
|
virtual void DoSetSize(int x, int y,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
int sizeFlags = wxSIZE_AUTO);
|
int sizeFlags = wxSIZE_AUTO);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -144,13 +144,16 @@ public:
|
|||||||
virtual void OnDefaultAction(wxControl * WXUNUSED(initiatingItem)) { }
|
virtual void OnDefaultAction(wxControl * WXUNUSED(initiatingItem)) { }
|
||||||
#endif // WXWIN_COMPATIBILITY
|
#endif // WXWIN_COMPATIBILITY
|
||||||
|
|
||||||
// caret manipulation (MSW only)
|
#if wxUSE_CARET
|
||||||
virtual void CreateCaret(int w, int h);
|
// caret manipulation (old MSW only functions, see wxCaret class for the
|
||||||
virtual void CreateCaret(const wxBitmap *bitmap);
|
// new API)
|
||||||
virtual void DestroyCaret();
|
void CreateCaret(int w, int h);
|
||||||
virtual void ShowCaret(bool show);
|
void CreateCaret(const wxBitmap *bitmap);
|
||||||
virtual void SetCaretPos(int x, int y);
|
void DestroyCaret();
|
||||||
virtual void GetCaretPos(int *x, int *y) const;
|
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)
|
// Native resource loading (implemented in src/msw/nativdlg.cpp)
|
||||||
// FIXME: should they really be all virtual?
|
// FIXME: should they really be all virtual?
|
||||||
@@ -374,12 +377,6 @@ protected:
|
|||||||
bool m_doubleClickAllowed:1;
|
bool m_doubleClickAllowed:1;
|
||||||
bool m_winCaptured: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
|
// the size of one page for scrolling
|
||||||
int m_xThumbSize;
|
int m_xThumbSize;
|
||||||
int m_yThumbSize;
|
int m_yThumbSize;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: window.h
|
// Name: window.h
|
||||||
// Purpose: wxWindowBase class - the interface of wxWindowBase
|
// Purpose: wxWindowBase class - the interface of wxWindow
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
// forward declarations
|
// forward declarations
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxCaret;
|
||||||
class WXDLLEXPORT wxClientData;
|
class WXDLLEXPORT wxClientData;
|
||||||
class WXDLLEXPORT wxControl;
|
class WXDLLEXPORT wxControl;
|
||||||
class WXDLLEXPORT wxCursor;
|
class WXDLLEXPORT wxCursor;
|
||||||
@@ -475,6 +476,13 @@ public:
|
|||||||
const wxFont& GetFont() const { return m_font; }
|
const wxFont& GetFont() const { return m_font; }
|
||||||
wxFont& GetFont() { 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
|
// get the (average) character size for the current font
|
||||||
virtual int GetCharHeight() const = 0;
|
virtual int GetCharHeight() const = 0;
|
||||||
virtual int GetCharWidth() const = 0;
|
virtual int GetCharWidth() const = 0;
|
||||||
@@ -658,6 +666,10 @@ protected:
|
|||||||
wxFont m_font;
|
wxFont m_font;
|
||||||
wxColour m_backgroundColour, m_foregroundColour;
|
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
|
// the region which should be repainted in response to paint event
|
||||||
wxRegion m_updateRegion;
|
wxRegion m_updateRegion;
|
||||||
|
|
||||||
|
@@ -53,6 +53,10 @@
|
|||||||
#include "wx/tooltip.h"
|
#include "wx/tooltip.h"
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
|
#if wxUSE_CARET
|
||||||
|
#include "wx/caret.h"
|
||||||
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// static data
|
// static data
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -136,6 +140,10 @@ void wxWindowBase::InitBase()
|
|||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
m_tooltip = (wxToolTip *)NULL;
|
m_tooltip = (wxToolTip *)NULL;
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
|
#if wxUSE_CARET
|
||||||
|
m_caret = (wxCaret *)NULL;
|
||||||
|
#endif // wxUSE_CARET
|
||||||
}
|
}
|
||||||
|
|
||||||
// common part of window creation process
|
// common part of window creation process
|
||||||
@@ -181,6 +189,11 @@ wxWindowBase::~wxWindowBase()
|
|||||||
|
|
||||||
wxASSERT_MSG( GetChildren().GetCount() == 0, _T("children not destroyed") );
|
wxASSERT_MSG( GetChildren().GetCount() == 0, _T("children not destroyed") );
|
||||||
|
|
||||||
|
#if wxUSE_CARET
|
||||||
|
if ( m_caret )
|
||||||
|
delete m_caret;
|
||||||
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
if ( m_windowValidator )
|
if ( m_windowValidator )
|
||||||
delete m_windowValidator;
|
delete m_windowValidator;
|
||||||
|
|
||||||
@@ -512,6 +525,24 @@ bool wxWindowBase::SetFont(const wxFont& font)
|
|||||||
return TRUE;
|
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
|
// 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)\bmpbuttn.obj \
|
||||||
$(MSWDIR)\brush.obj \
|
$(MSWDIR)\brush.obj \
|
||||||
$(MSWDIR)\button.obj \
|
$(MSWDIR)\button.obj \
|
||||||
|
$(MSWDIR)\caret.obj \
|
||||||
$(MSWDIR)\checkbox.obj \
|
$(MSWDIR)\checkbox.obj \
|
||||||
$(MSWDIR)\checklst.obj \
|
$(MSWDIR)\checklst.obj \
|
||||||
$(MSWDIR)\choice.obj \
|
$(MSWDIR)\choice.obj \
|
||||||
@@ -320,12 +321,14 @@ $(MSWDIR)\brush.obj: $(MSWDIR)\brush.$(SRCSUFF)
|
|||||||
|
|
||||||
$(MSWDIR)\button.obj: $(MSWDIR)\button.$(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)\checkbox.obj: $(MSWDIR)\checkbox.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\checklst.obj: $(MSWDIR)\checklst.$(SRCSUFF)
|
$(MSWDIR)\checklst.obj: $(MSWDIR)\checklst.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(MSWDIR)\choice.obj: $(MSWDIR)\choice.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\clipbrd.obj: $(MSWDIR)\clipbrd.$(SRCSUFF)
|
$(MSWDIR)\clipbrd.obj: $(MSWDIR)\clipbrd.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\colordlg.obj: $(MSWDIR)\colordlg.$(SRCSUFF)
|
$(MSWDIR)\colordlg.obj: $(MSWDIR)\colordlg.$(SRCSUFF)
|
||||||
|
@@ -173,6 +173,7 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\button.obj \
|
$(MSWDIR)\button.obj \
|
||||||
$(MSWDIR)\checkbox.obj \
|
$(MSWDIR)\checkbox.obj \
|
||||||
$(MSWDIR)\checklst.obj \
|
$(MSWDIR)\checklst.obj \
|
||||||
|
$(MSWDIR)\caret.obj \
|
||||||
$(MSWDIR)\choice.obj \
|
$(MSWDIR)\choice.obj \
|
||||||
$(MSWDIR)\clipbrd.obj \
|
$(MSWDIR)\clipbrd.obj \
|
||||||
$(MSWDIR)\colordlg.obj \
|
$(MSWDIR)\colordlg.obj \
|
||||||
@@ -302,6 +303,8 @@ $(MSWDIR)\brush.obj: $(MSWDIR)\brush.$(SRCSUFF)
|
|||||||
|
|
||||||
$(MSWDIR)\button.obj: $(MSWDIR)\button.$(SRCSUFF)
|
$(MSWDIR)\button.obj: $(MSWDIR)\button.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(MSWDIR)\caret.obj: $(MSWDIR)\caret.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\choice.obj: $(MSWDIR)\choice.$(SRCSUFF)
|
$(MSWDIR)\choice.obj: $(MSWDIR)\choice.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\checkbox.obj: $(MSWDIR)\checkbox.$(SRCSUFF)
|
$(MSWDIR)\checkbox.obj: $(MSWDIR)\checkbox.$(SRCSUFF)
|
||||||
|
@@ -147,6 +147,7 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\button.obj \
|
$(MSWDIR)\button.obj \
|
||||||
$(MSWDIR)\checkbox.obj \
|
$(MSWDIR)\checkbox.obj \
|
||||||
$(MSWDIR)\checklst.obj \
|
$(MSWDIR)\checklst.obj \
|
||||||
|
$(MSWDIR)\caret.obj \
|
||||||
$(MSWDIR)\choice.obj \
|
$(MSWDIR)\choice.obj \
|
||||||
$(MSWDIR)\clipbrd.obj \
|
$(MSWDIR)\clipbrd.obj \
|
||||||
$(MSWDIR)\colordlg.obj \
|
$(MSWDIR)\colordlg.obj \
|
||||||
@@ -317,6 +318,11 @@ $(MSWDIR)/button.obj: $*.$(SRCSUFF)
|
|||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
|
|
||||||
|
$(MSWDIR)/caret.obj: $*.$(SRCSUFF)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
$(MSWDIR)/choice.obj: $*.$(SRCSUFF)
|
$(MSWDIR)/choice.obj: $*.$(SRCSUFF)
|
||||||
cl @<<
|
cl @<<
|
||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
|
@@ -153,6 +153,7 @@ MSWOBJS = \
|
|||||||
button.$(OBJSUFF) \
|
button.$(OBJSUFF) \
|
||||||
checkbox.$(OBJSUFF) \
|
checkbox.$(OBJSUFF) \
|
||||||
checklst.$(OBJSUFF) \
|
checklst.$(OBJSUFF) \
|
||||||
|
caret.$(OBJSUFF) \
|
||||||
choice.$(OBJSUFF) \
|
choice.$(OBJSUFF) \
|
||||||
clipbrd.$(OBJSUFF) \
|
clipbrd.$(OBJSUFF) \
|
||||||
colordlg.$(OBJSUFF) \
|
colordlg.$(OBJSUFF) \
|
||||||
|
@@ -130,6 +130,7 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\button.obj \
|
$(MSWDIR)\button.obj \
|
||||||
$(MSWDIR)\checkbox.obj \
|
$(MSWDIR)\checkbox.obj \
|
||||||
$(MSWDIR)\checklst.obj \
|
$(MSWDIR)\checklst.obj \
|
||||||
|
$(MSWDIR)\caret.obj \
|
||||||
$(MSWDIR)\choice.obj \
|
$(MSWDIR)\choice.obj \
|
||||||
$(MSWDIR)\clipbrd.obj \
|
$(MSWDIR)\clipbrd.obj \
|
||||||
$(MSWDIR)\colordlg.obj \
|
$(MSWDIR)\colordlg.obj \
|
||||||
|
@@ -116,6 +116,7 @@ MSWOBJS = \
|
|||||||
button.obj \
|
button.obj \
|
||||||
checkbox.obj \
|
checkbox.obj \
|
||||||
checklst.obj \
|
checklst.obj \
|
||||||
|
caret.obj \
|
||||||
choice.obj \
|
choice.obj \
|
||||||
clipbrd.obj \
|
clipbrd.obj \
|
||||||
colordlg.obj \
|
colordlg.obj \
|
||||||
@@ -243,6 +244,9 @@ brush.obj: $(MSWDIR)\brush.cpp
|
|||||||
button.obj: $(MSWDIR)\button.cpp
|
button.obj: $(MSWDIR)\button.cpp
|
||||||
$(CCC) $(CPPFLAGS) $(IFLAGS) $(MSWDIR)\button.cpp /BINARY button.obj
|
$(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
|
choice.obj: $(MSWDIR)\choice.cpp
|
||||||
$(CCC) $(CPPFLAGS) $(IFLAGS) $(MSWDIR)\choice.cpp /BINARY choice.obj
|
$(CCC) $(CPPFLAGS) $(IFLAGS) $(MSWDIR)\choice.cpp /BINARY choice.obj
|
||||||
|
|
||||||
|
@@ -154,6 +154,7 @@ MSWOBJS = \
|
|||||||
button.$(OBJSUFF) \
|
button.$(OBJSUFF) \
|
||||||
checkbox.$(OBJSUFF) \
|
checkbox.$(OBJSUFF) \
|
||||||
checklst.$(OBJSUFF) \
|
checklst.$(OBJSUFF) \
|
||||||
|
caret.$(OBJSUFF) \
|
||||||
choice.$(OBJSUFF) \
|
choice.$(OBJSUFF) \
|
||||||
clipbrd.$(OBJSUFF) \
|
clipbrd.$(OBJSUFF) \
|
||||||
colordlg.$(OBJSUFF) \
|
colordlg.$(OBJSUFF) \
|
||||||
|
@@ -174,6 +174,7 @@ MSWOBJS = \
|
|||||||
..\msw\$D\button.obj \
|
..\msw\$D\button.obj \
|
||||||
..\msw\$D\checkbox.obj \
|
..\msw\$D\checkbox.obj \
|
||||||
..\msw\$D\checklst.obj \
|
..\msw\$D\checklst.obj \
|
||||||
|
..\msw\$D\caret.obj \
|
||||||
..\msw\$D\choice.obj \
|
..\msw\$D\choice.obj \
|
||||||
..\msw\$D\clipbrd.obj \
|
..\msw\$D\clipbrd.obj \
|
||||||
..\msw\$D\colordlg.obj \
|
..\msw\$D\colordlg.obj \
|
||||||
|
@@ -126,6 +126,7 @@ MSWOBJS = &
|
|||||||
button.obj &
|
button.obj &
|
||||||
checkbox.obj &
|
checkbox.obj &
|
||||||
checklst.obj &
|
checklst.obj &
|
||||||
|
caret.obj &
|
||||||
choice.obj &
|
choice.obj &
|
||||||
clipbrd.obj &
|
clipbrd.obj &
|
||||||
colordlg.obj &
|
colordlg.obj &
|
||||||
@@ -256,6 +257,9 @@ brush.obj: $(MSWDIR)\brush.cpp
|
|||||||
button.obj: $(MSWDIR)\button.cpp
|
button.obj: $(MSWDIR)\button.cpp
|
||||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||||
|
|
||||||
|
caret.obj: $(MSWDIR)\caret.cpp
|
||||||
|
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||||
|
|
||||||
choice.obj: $(MSWDIR)\choice.cpp
|
choice.obj: $(MSWDIR)\choice.cpp
|
||||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||||
|
|
||||||
|
@@ -143,28 +143,16 @@ bool wxNotebook::Create(wxWindow *parent,
|
|||||||
if (m_windowStyle & wxNB_FIXEDWIDTH)
|
if (m_windowStyle & wxNB_FIXEDWIDTH)
|
||||||
tabStyle |= TCS_FIXEDWIDTH ;
|
tabStyle |= TCS_FIXEDWIDTH ;
|
||||||
|
|
||||||
// create the tab control.
|
if ( !MSWCreate(GetId(), GetParent(), WC_TABCONTROL,
|
||||||
m_hWnd = (WXHWND)CreateWindowEx
|
this, NULL, pos.x, pos.y, size.x, size.y,
|
||||||
(
|
tabStyle, NULL, 0) )
|
||||||
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");
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not all compilers recognise SetWindowFont
|
// Not all compilers recognise SetWindowFont
|
||||||
::SendMessage((HWND) m_hwnd, WM_SETFONT,
|
::SendMessage(GetHwnd(), WM_SETFONT,
|
||||||
(WPARAM)::GetStockObject(DEFAULT_GUI_FONT),TRUE);
|
(WPARAM)::GetStockObject(DEFAULT_GUI_FONT), TRUE);
|
||||||
|
|
||||||
|
|
||||||
if ( parent != NULL )
|
if ( parent != NULL )
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msw/region.cpp
|
// Name: msw/region.cpp
|
||||||
// Purpose: Region handling for wxWindows/X11
|
// Purpose: Region handling for wxWindows/X11
|
||||||
// Author: Markus Holzem
|
// Author: Markus Holzem
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: Fri Oct 24 10:46:34 MET 1997
|
// Created: Fri Oct 24 10:46:34 MET 1997
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 1997 Julian Smart and Markus Holzem
|
// Copyright: (c) 1997 Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -23,30 +23,31 @@
|
|||||||
#include "wx/msw/region.h"
|
#include "wx/msw/region.h"
|
||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include "wx/msw/private.h"
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxRegionRefData implementation
|
// wxRegionRefData implementation
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxRegionRefData : public wxGDIRefData {
|
class WXDLLEXPORT wxRegionRefData : public wxGDIRefData
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
wxRegionRefData(void)
|
wxRegionRefData()
|
||||||
{
|
{
|
||||||
m_region = 0;
|
m_region = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRegionRefData(const wxRegionRefData& data)
|
wxRegionRefData(const wxRegionRefData& data)
|
||||||
{
|
{
|
||||||
#if defined(__WIN32__)
|
#if defined(__WIN32__)
|
||||||
DWORD noBytes = ::GetRegionData(data.m_region, 0, NULL);
|
DWORD noBytes = ::GetRegionData(data.m_region, 0, NULL);
|
||||||
RGNDATA *rgnData = (RGNDATA*) new char[noBytes];
|
RGNDATA *rgnData = (RGNDATA*) new char[noBytes];
|
||||||
::GetRegionData(data.m_region, noBytes, rgnData);
|
::GetRegionData(data.m_region, noBytes, rgnData);
|
||||||
m_region = ::ExtCreateRegion(NULL, noBytes, rgnData);
|
m_region = ::ExtCreateRegion(NULL, noBytes, rgnData);
|
||||||
delete[] (char*) rgnData;
|
delete[] (char*) rgnData;
|
||||||
#else
|
#else
|
||||||
@@ -54,15 +55,15 @@ public:
|
|||||||
::GetRgnBox(data.m_region, &rect);
|
::GetRgnBox(data.m_region, &rect);
|
||||||
m_region = ::CreateRectRgnIndirect(&rect);
|
m_region = ::CreateRectRgnIndirect(&rect);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
~wxRegionRefData(void)
|
~wxRegionRefData()
|
||||||
{
|
{
|
||||||
::DeleteObject(m_region);
|
::DeleteObject(m_region);
|
||||||
m_region = 0;
|
m_region = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRGN m_region;
|
HRGN m_region;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define M_REGION (((wxRegionRefData*)m_refData)->m_region)
|
#define M_REGION (((wxRegionRefData*)m_refData)->m_region)
|
||||||
@@ -71,10 +72,10 @@ public:
|
|||||||
// wxRegion
|
// wxRegion
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
* Create an empty region.
|
* Create an empty region.
|
||||||
*/
|
*/
|
||||||
wxRegion::wxRegion(void)
|
wxRegion::wxRegion()
|
||||||
{
|
{
|
||||||
m_refData = new wxRegionRefData;
|
m_refData = new wxRegionRefData;
|
||||||
M_REGION = ::CreateRectRgn(0, 0, 0, 0);
|
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());
|
M_REGION = ::CreateRectRgn(rect.GetLeft(), rect.GetTop(), rect.GetRight(), rect.GetBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
* Destroy the region.
|
* Destroy the region.
|
||||||
*/
|
*/
|
||||||
wxRegion::~wxRegion(void)
|
wxRegion::~wxRegion()
|
||||||
{
|
{
|
||||||
// m_refData unrefed in ~wxObject
|
// m_refData unrefed in ~wxObject
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//# Modify region
|
// Modify region
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
//! Clear current region
|
// Clear current region
|
||||||
void wxRegion::Clear(void)
|
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)
|
bool wxRegion::Combine(long x, long y, long width, long height, wxRegionOp op)
|
||||||
{
|
{
|
||||||
// Don't change shared data
|
// Don't change shared data
|
||||||
if (!m_refData) {
|
if (!m_refData) {
|
||||||
m_refData = new wxRegionRefData();
|
m_refData = new wxRegionRefData();
|
||||||
} else if (m_refData->GetRefCount() > 1) {
|
} else if (m_refData->GetRefCount() > 1) {
|
||||||
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
||||||
UnRef();
|
UnRef();
|
||||||
m_refData = new wxRegionRefData(*ref);
|
m_refData = new wxRegionRefData(*ref);
|
||||||
}
|
}
|
||||||
// If ref count is 1, that means it's 'ours' anyway so no action.
|
// If ref count is 1, that means it's 'ours' anyway so no action.
|
||||||
|
|
||||||
HRGN rectRegion = ::CreateRectRgn(x, y, x + width, y + height);
|
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 ;
|
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);
|
::DeleteObject(rectRegion);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Union /e region with this.
|
// Union /e region with this.
|
||||||
bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
|
bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
|
||||||
{
|
{
|
||||||
if (region.Empty())
|
if (region.Empty())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Don't change shared data
|
// Don't change shared data
|
||||||
if (!m_refData) {
|
if (!m_refData) {
|
||||||
m_refData = new wxRegionRefData();
|
m_refData = new wxRegionRefData();
|
||||||
} else if (m_refData->GetRefCount() > 1) {
|
} else if (m_refData->GetRefCount() > 1) {
|
||||||
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
||||||
UnRef();
|
UnRef();
|
||||||
m_refData = new wxRegionRefData(*ref);
|
m_refData = new wxRegionRefData(*ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
switch (op)
|
switch (op)
|
||||||
@@ -183,7 +184,7 @@ bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
|
|||||||
mode = RGN_COPY; break ;
|
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)
|
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
|
// Outer bounds of region
|
||||||
void wxRegion::GetBox(long& x, long& y, long&w, long &h) const
|
void wxRegion::GetBox(long& x, long& y, long&w, long &h) const
|
||||||
{
|
{
|
||||||
if (m_refData) {
|
if (m_refData) {
|
||||||
RECT rect;
|
RECT rect;
|
||||||
::GetRgnBox(M_REGION, & rect);
|
::GetRgnBox(M_REGION, & rect);
|
||||||
x = rect.left;
|
x = rect.left;
|
||||||
y = rect.top;
|
y = rect.top;
|
||||||
w = rect.right - rect.left;
|
w = rect.right - rect.left;
|
||||||
h = rect.bottom - rect.top;
|
h = rect.bottom - rect.top;
|
||||||
} else {
|
} else {
|
||||||
x = y = w = h = 0;
|
x = y = w = h = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRect wxRegion::GetBox(void) const
|
wxRect wxRegion::GetBox() const
|
||||||
{
|
{
|
||||||
long x, y, w, h;
|
long x, y, w, h;
|
||||||
GetBox(x, y, w, h);
|
GetBox(x, y, w, h);
|
||||||
@@ -218,7 +219,7 @@ wxRect wxRegion::GetBox(void) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Is region empty?
|
// Is region empty?
|
||||||
bool wxRegion::Empty(void) const
|
bool wxRegion::Empty() const
|
||||||
{
|
{
|
||||||
if (M_REGION == 0)
|
if (M_REGION == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -229,14 +230,14 @@ bool wxRegion::Empty(void) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//# Tests
|
// Tests
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Does the region contain the point (x,y)?
|
// Does the region contain the point (x,y)?
|
||||||
wxRegionContain wxRegion::Contains(long x, long y) const
|
wxRegionContain wxRegion::Contains(long x, long y) const
|
||||||
{
|
{
|
||||||
if (!m_refData)
|
if (!m_refData)
|
||||||
return wxOutRegion;
|
return wxOutRegion;
|
||||||
|
|
||||||
if (::PtInRegion(M_REGION, (int) x, (int) y))
|
if (::PtInRegion(M_REGION, (int) x, (int) y))
|
||||||
return wxInRegion;
|
return wxInRegion;
|
||||||
@@ -247,8 +248,8 @@ wxRegionContain wxRegion::Contains(long x, long y) const
|
|||||||
// Does the region contain the point pt?
|
// Does the region contain the point pt?
|
||||||
wxRegionContain wxRegion::Contains(const wxPoint& pt) const
|
wxRegionContain wxRegion::Contains(const wxPoint& pt) const
|
||||||
{
|
{
|
||||||
if (!m_refData)
|
if (!m_refData)
|
||||||
return wxOutRegion;
|
return wxOutRegion;
|
||||||
|
|
||||||
if (::PtInRegion(M_REGION, (int) pt.x, (int) pt.y))
|
if (::PtInRegion(M_REGION, (int) pt.x, (int) pt.y))
|
||||||
return wxInRegion;
|
return wxInRegion;
|
||||||
@@ -259,8 +260,8 @@ wxRegionContain wxRegion::Contains(const wxPoint& pt) const
|
|||||||
// Does the region contain the rectangle (x, y, w, h)?
|
// Does the region contain the rectangle (x, y, w, h)?
|
||||||
wxRegionContain wxRegion::Contains(long x, long y, long w, long h) const
|
wxRegionContain wxRegion::Contains(long x, long y, long w, long h) const
|
||||||
{
|
{
|
||||||
if (!m_refData)
|
if (!m_refData)
|
||||||
return wxOutRegion;
|
return wxOutRegion;
|
||||||
|
|
||||||
RECT rect;
|
RECT rect;
|
||||||
rect.left = x;
|
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
|
// Does the region contain the rectangle rect
|
||||||
wxRegionContain wxRegion::Contains(const wxRect& rect) const
|
wxRegionContain wxRegion::Contains(const wxRect& rect) const
|
||||||
{
|
{
|
||||||
if (!m_refData)
|
if (!m_refData)
|
||||||
return wxOutRegion;
|
return wxOutRegion;
|
||||||
|
|
||||||
long x, y, w, h;
|
long x, y, w, h;
|
||||||
x = rect.x;
|
x = rect.x;
|
||||||
@@ -297,55 +298,55 @@ WXHRGN wxRegion::GetHRGN() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// wxRegionIterator //
|
// wxRegionIterator //
|
||||||
// //
|
// //
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
* Initialize empty iterator
|
* 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)
|
if (m_rects)
|
||||||
delete[] m_rects;
|
delete[] m_rects;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
* Initialize iterator for region
|
* Initialize iterator for region
|
||||||
*/
|
*/
|
||||||
wxRegionIterator::wxRegionIterator(const wxRegion& region)
|
wxRegionIterator::wxRegionIterator(const wxRegion& region)
|
||||||
{
|
{
|
||||||
m_rects = NULL;
|
m_rects = NULL;
|
||||||
|
|
||||||
Reset(region);
|
Reset(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
* Reset iterator for a new /e region.
|
* Reset iterator for a new /e region.
|
||||||
*/
|
*/
|
||||||
void wxRegionIterator::Reset(const wxRegion& region)
|
void wxRegionIterator::Reset(const wxRegion& region)
|
||||||
{
|
{
|
||||||
m_current = 0;
|
m_current = 0;
|
||||||
m_region = region;
|
m_region = region;
|
||||||
|
|
||||||
if (m_rects)
|
if (m_rects)
|
||||||
delete[] m_rects;
|
delete[] m_rects;
|
||||||
|
|
||||||
m_rects = NULL;
|
m_rects = NULL;
|
||||||
|
|
||||||
if (m_region.Empty())
|
if (m_region.Empty())
|
||||||
m_numRects = 0;
|
m_numRects = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(__WIN32__)
|
#if defined(__WIN32__)
|
||||||
DWORD noBytes = ::GetRegionData(((wxRegionRefData*)region.m_refData)->m_region, 0, NULL);
|
DWORD noBytes = ::GetRegionData(((wxRegionRefData*)region.m_refData)->m_region, 0, NULL);
|
||||||
RGNDATA *rgnData = (RGNDATA*) new char[noBytes];
|
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;
|
RGNDATAHEADER* header = (RGNDATAHEADER*) rgnData;
|
||||||
|
|
||||||
@@ -377,51 +378,51 @@ void wxRegionIterator::Reset(const wxRegion& region)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
* Increment iterator. The rectangle returned is the one after the
|
* Increment iterator. The rectangle returned is the one after the
|
||||||
* incrementation.
|
* incrementation.
|
||||||
*/
|
*/
|
||||||
void wxRegionIterator::operator ++ (void)
|
void wxRegionIterator::operator ++ ()
|
||||||
{
|
{
|
||||||
if (m_current < m_numRects)
|
if (m_current < m_numRects)
|
||||||
++m_current;
|
++m_current;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
* Increment iterator. The rectangle returned is the one before the
|
* Increment iterator. The rectangle returned is the one before the
|
||||||
* incrementation.
|
* incrementation.
|
||||||
*/
|
*/
|
||||||
void wxRegionIterator::operator ++ (int)
|
void wxRegionIterator::operator ++ (int)
|
||||||
{
|
{
|
||||||
if (m_current < m_numRects)
|
if (m_current < m_numRects)
|
||||||
++m_current;
|
++m_current;
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxRegionIterator::GetX(void) const
|
long wxRegionIterator::GetX() const
|
||||||
{
|
{
|
||||||
if (m_current < m_numRects)
|
if (m_current < m_numRects)
|
||||||
return m_rects[m_current].x;
|
return m_rects[m_current].x;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxRegionIterator::GetY(void) const
|
long wxRegionIterator::GetY() const
|
||||||
{
|
{
|
||||||
if (m_current < m_numRects)
|
if (m_current < m_numRects)
|
||||||
return m_rects[m_current].y;
|
return m_rects[m_current].y;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxRegionIterator::GetW(void) const
|
long wxRegionIterator::GetW() const
|
||||||
{
|
{
|
||||||
if (m_current < m_numRects)
|
if (m_current < m_numRects)
|
||||||
return m_rects[m_current].width ;
|
return m_rects[m_current].width ;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxRegionIterator::GetH(void) const
|
long wxRegionIterator::GetH() const
|
||||||
{
|
{
|
||||||
if (m_current < m_numRects)
|
if (m_current < m_numRects)
|
||||||
return m_rects[m_current].height;
|
return m_rects[m_current].height;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -235,7 +235,7 @@ void wxTextCtrl::AdoptAttributesFromHWND()
|
|||||||
{
|
{
|
||||||
wxWindow::AdoptAttributesFromHWND();
|
wxWindow::AdoptAttributesFromHWND();
|
||||||
|
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = GetHwnd();
|
||||||
long style = GetWindowLong((HWND) hWnd, GWL_STYLE);
|
long style = GetWindowLong((HWND) hWnd, GWL_STYLE);
|
||||||
|
|
||||||
// retrieve the style to see whether this is an edit or richedit ctrl
|
// retrieve the style to see whether this is an edit or richedit ctrl
|
||||||
@@ -283,12 +283,7 @@ void wxTextCtrl::SetupColours()
|
|||||||
|
|
||||||
wxString wxTextCtrl::GetValue() const
|
wxString wxTextCtrl::GetValue() const
|
||||||
{
|
{
|
||||||
int length = GetWindowTextLength((HWND) GetHWND());
|
return wxGetWindowText(GetHWND());
|
||||||
char *s = new char[length+1];
|
|
||||||
GetWindowText((HWND) GetHWND(), s, length+1);
|
|
||||||
wxString str(s);
|
|
||||||
delete[] s;
|
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::SetValue(const wxString& value)
|
void wxTextCtrl::SetValue(const wxString& value)
|
||||||
@@ -317,11 +312,13 @@ void wxTextCtrl::SetValue(const wxString& value)
|
|||||||
j ++;
|
j ++;
|
||||||
}
|
}
|
||||||
tmp[j] = 0;
|
tmp[j] = 0;
|
||||||
SetWindowText((HWND) GetHWND(), tmp);
|
SetWindowText(GetHwnd(), tmp);
|
||||||
delete[] tmp;
|
delete[] tmp;
|
||||||
}
|
}
|
||||||
else
|
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)
|
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)
|
if (control_width <= 0)
|
||||||
control_width = DEFAULT_ITEM_WIDTH;
|
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);
|
(int)control_width, (int)control_height, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,7 +375,7 @@ void wxTextCtrl::Copy()
|
|||||||
{
|
{
|
||||||
if (CanCopy())
|
if (CanCopy())
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = GetHwnd();
|
||||||
SendMessage(hWnd, WM_COPY, 0, 0L);
|
SendMessage(hWnd, WM_COPY, 0, 0L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -387,7 +384,7 @@ void wxTextCtrl::Cut()
|
|||||||
{
|
{
|
||||||
if (CanCut())
|
if (CanCut())
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = GetHwnd();
|
||||||
SendMessage(hWnd, WM_CUT, 0, 0L);
|
SendMessage(hWnd, WM_CUT, 0, 0L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -396,20 +393,20 @@ void wxTextCtrl::Paste()
|
|||||||
{
|
{
|
||||||
if (CanPaste())
|
if (CanPaste())
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = GetHwnd();
|
||||||
SendMessage(hWnd, WM_PASTE, 0, 0L);
|
SendMessage(hWnd, WM_PASTE, 0, 0L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::SetEditable(bool editable)
|
void wxTextCtrl::SetEditable(bool editable)
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = GetHwnd();
|
||||||
SendMessage(hWnd, EM_SETREADONLY, (WPARAM)!editable, (LPARAM)0L);
|
SendMessage(hWnd, EM_SETREADONLY, (WPARAM)!editable, (LPARAM)0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::SetInsertionPoint(long pos)
|
void wxTextCtrl::SetInsertionPoint(long pos)
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = GetHwnd();
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
#if wxUSE_RICHEDIT
|
#if wxUSE_RICHEDIT
|
||||||
if ( m_isRich)
|
if ( m_isRich)
|
||||||
@@ -447,18 +444,18 @@ long wxTextCtrl::GetInsertionPoint() const
|
|||||||
CHARRANGE range;
|
CHARRANGE range;
|
||||||
range.cpMin = 0;
|
range.cpMin = 0;
|
||||||
range.cpMax = 0;
|
range.cpMax = 0;
|
||||||
SendMessage((HWND) GetHWND(), EM_EXGETSEL, 0, (LPARAM) &range);
|
SendMessage(GetHwnd(), EM_EXGETSEL, 0, (LPARAM) &range);
|
||||||
return range.cpMin;
|
return range.cpMin;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DWORD Pos=(DWORD)SendMessage((HWND) GetHWND(), EM_GETSEL, 0, 0L);
|
DWORD Pos=(DWORD)SendMessage(GetHwnd(), EM_GETSEL, 0, 0L);
|
||||||
return Pos&0xFFFF;
|
return Pos&0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxTextCtrl::GetLastPosition() const
|
long wxTextCtrl::GetLastPosition() const
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = GetHwnd();
|
||||||
|
|
||||||
// Will always return a number > 0 (according to docs)
|
// Will always return a number > 0 (according to docs)
|
||||||
int noLines = (int)SendMessage(hWnd, EM_GETLINECOUNT, (WPARAM)0, (LPARAM)0L);
|
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)
|
void wxTextCtrl::Replace(long from, long to, const wxString& value)
|
||||||
{
|
{
|
||||||
#if wxUSE_CLIPBOARD
|
#if wxUSE_CLIPBOARD
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = GetHwnd();
|
||||||
long fromChar = from;
|
long fromChar = from;
|
||||||
long toChar = to;
|
long toChar = to;
|
||||||
|
|
||||||
@@ -500,7 +497,7 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value)
|
|||||||
|
|
||||||
void wxTextCtrl::Remove(long from, long to)
|
void wxTextCtrl::Remove(long from, long to)
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = GetHwnd();
|
||||||
long fromChar = from;
|
long fromChar = from;
|
||||||
long toChar = to;
|
long toChar = to;
|
||||||
|
|
||||||
@@ -515,7 +512,7 @@ void wxTextCtrl::Remove(long from, long to)
|
|||||||
|
|
||||||
void wxTextCtrl::SetSelection(long from, long to)
|
void wxTextCtrl::SetSelection(long from, long to)
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = GetHwnd();
|
||||||
long fromChar = from;
|
long fromChar = from;
|
||||||
long toChar = to;
|
long toChar = to;
|
||||||
// if from and to are both -1, it means
|
// if from and to are both -1, it means
|
||||||
@@ -584,11 +581,13 @@ bool wxTextCtrl::LoadFile(const wxString& file)
|
|||||||
no_lines++;
|
no_lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendMessage((HWND) GetHWND(), WM_SETTEXT, 0, (LPARAM)tmp_buffer);
|
SetWindowText(GetHwnd(), tmp_buffer);
|
||||||
SetWindowText((HWND) GetHWND(), tmp_buffer);
|
SendMessage(GetHwnd(), EM_SETMODIFY, FALSE, 0L);
|
||||||
SendMessage((HWND) GetHWND(), EM_SETMODIFY, FALSE, 0L);
|
|
||||||
farfree(tmp_buffer);
|
farfree(tmp_buffer);
|
||||||
|
|
||||||
|
// update the size limit if needed
|
||||||
|
AdjustSpaceLimit();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -613,9 +612,9 @@ bool wxTextCtrl::SaveFile(const wxString& file)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// This will only save 64K max
|
// 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));
|
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;
|
char *pstr = tmp_buffer;
|
||||||
|
|
||||||
// Convert \r\n to just \n
|
// Convert \r\n to just \n
|
||||||
@@ -627,7 +626,7 @@ bool wxTextCtrl::SaveFile(const wxString& file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
farfree(tmp_buffer);
|
farfree(tmp_buffer);
|
||||||
SendMessage((HWND) GetHWND(), EM_SETMODIFY, FALSE, 0L);
|
SendMessage(GetHwnd(), EM_SETMODIFY, FALSE, 0L);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -651,8 +650,10 @@ void wxTextCtrl::WriteText(const wxString& text)
|
|||||||
j ++;
|
j ++;
|
||||||
}
|
}
|
||||||
newtext[j] = 0;
|
newtext[j] = 0;
|
||||||
SendMessage((HWND) GetHWND(), EM_REPLACESEL, 0, (LPARAM)newtext);
|
SendMessage(GetHwnd(), EM_REPLACESEL, 0, (LPARAM)newtext);
|
||||||
delete[] newtext;
|
delete[] newtext;
|
||||||
|
|
||||||
|
AdjustSpaceLimit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::AppendText(const wxString& text)
|
void wxTextCtrl::AppendText(const wxString& text)
|
||||||
@@ -663,18 +664,18 @@ void wxTextCtrl::AppendText(const wxString& text)
|
|||||||
|
|
||||||
void wxTextCtrl::Clear()
|
void wxTextCtrl::Clear()
|
||||||
{
|
{
|
||||||
SetWindowText((HWND) GetHWND(), "");
|
SetWindowText(GetHwnd(), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTextCtrl::IsModified() const
|
bool wxTextCtrl::IsModified() const
|
||||||
{
|
{
|
||||||
return (SendMessage((HWND) GetHWND(), EM_GETMODIFY, 0, 0) != 0);
|
return (SendMessage(GetHwnd(), EM_GETMODIFY, 0, 0) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Makes 'unmodified'
|
// Makes 'unmodified'
|
||||||
void wxTextCtrl::DiscardEdits()
|
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
|
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
|
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
|
// This gets the char index for the _beginning_ of this line
|
||||||
int charIndex = (int)SendMessage(hWnd, EM_LINEINDEX, (WPARAM)y, (LPARAM)0);
|
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
|
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
|
// This gets the line number containing the character
|
||||||
int lineNo = (int)SendMessage(hWnd, EM_LINEFROMCHAR, (WPARAM)pos, (LPARAM)0);
|
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)
|
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 to a position, we pass the number of lines and characters
|
||||||
// to scroll *by*. This means that we need to:
|
// to scroll *by*. This means that we need to:
|
||||||
@@ -737,14 +738,14 @@ void wxTextCtrl::ShowPosition(long pos)
|
|||||||
int wxTextCtrl::GetLineLength(long lineNo) const
|
int wxTextCtrl::GetLineLength(long lineNo) const
|
||||||
{
|
{
|
||||||
long charIndex = XYToPosition(0, lineNo);
|
long charIndex = XYToPosition(0, lineNo);
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = GetHwnd();
|
||||||
int len = (int)SendMessage(hWnd, EM_LINELENGTH, (WPARAM)charIndex, (LPARAM)0);
|
int len = (int)SendMessage(hWnd, EM_LINELENGTH, (WPARAM)charIndex, (LPARAM)0);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxTextCtrl::GetLineText(long lineNo) const
|
wxString wxTextCtrl::GetLineText(long lineNo) const
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) GetHWND();
|
HWND hWnd = GetHwnd();
|
||||||
*(WORD *)wxBuffer = 512;
|
*(WORD *)wxBuffer = 512;
|
||||||
int noChars = (int)SendMessage(hWnd, EM_GETLINE, (WPARAM)lineNo, (LPARAM)wxBuffer);
|
int noChars = (int)SendMessage(hWnd, EM_GETLINE, (WPARAM)lineNo, (LPARAM)wxBuffer);
|
||||||
wxBuffer[noChars] = 0;
|
wxBuffer[noChars] = 0;
|
||||||
@@ -773,7 +774,7 @@ bool wxTextCtrl::CanPaste() const
|
|||||||
if (m_isRich)
|
if (m_isRich)
|
||||||
{
|
{
|
||||||
int dataFormat = 0; // 0 == any format
|
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
|
#endif
|
||||||
if (!IsEditable())
|
if (!IsEditable())
|
||||||
@@ -794,7 +795,7 @@ void wxTextCtrl::Undo()
|
|||||||
{
|
{
|
||||||
if (CanUndo())
|
if (CanUndo())
|
||||||
{
|
{
|
||||||
::SendMessage((HWND) GetHWND(), EM_UNDO, 0, 0);
|
::SendMessage(GetHwnd(), EM_UNDO, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -803,18 +804,18 @@ void wxTextCtrl::Redo()
|
|||||||
if (CanRedo())
|
if (CanRedo())
|
||||||
{
|
{
|
||||||
// Same as Undo, since Undo undoes the undo, i.e. a redo.
|
// 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
|
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
|
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
|
// 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)
|
if (m_isRich)
|
||||||
{
|
{
|
||||||
CHARRANGE charRange;
|
CHARRANGE charRange;
|
||||||
::SendMessage((HWND) GetHWND(), EM_EXGETSEL, 0, (LPARAM) (CHARRANGE*) & charRange);
|
::SendMessage(GetHwnd(), EM_EXGETSEL, 0, (LPARAM) (CHARRANGE*) & charRange);
|
||||||
|
|
||||||
*from = charRange.cpMin;
|
*from = charRange.cpMin;
|
||||||
*to = charRange.cpMax;
|
*to = charRange.cpMax;
|
||||||
@@ -837,7 +838,7 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
|
|||||||
WPARAM wParam = (WPARAM) (DWORD*) & dwStart; // receives starting position
|
WPARAM wParam = (WPARAM) (DWORD*) & dwStart; // receives starting position
|
||||||
LPARAM lParam = (LPARAM) (DWORD*) & dwEnd; // receives ending position
|
LPARAM lParam = (LPARAM) (DWORD*) & dwEnd; // receives ending position
|
||||||
|
|
||||||
::SendMessage((HWND) GetHWND(), EM_GETSEL, wParam, lParam);
|
::SendMessage(GetHwnd(), EM_GETSEL, wParam, lParam);
|
||||||
|
|
||||||
*from = dwStart;
|
*from = dwStart;
|
||||||
*to = dwEnd;
|
*to = dwEnd;
|
||||||
@@ -845,7 +846,8 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
|
|||||||
|
|
||||||
bool wxTextCtrl::IsEditable() const
|
bool wxTextCtrl::IsEditable() const
|
||||||
{
|
{
|
||||||
long style = ::GetWindowLong((HWND) GetHWND(), GWL_STYLE);
|
long style = ::GetWindowLong(GetHwnd(), GWL_STYLE);
|
||||||
|
|
||||||
return ((style & ES_READONLY) == 0);
|
return ((style & ES_READONLY) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1137,78 +1139,62 @@ long wxTextCtrl::MSWGetDlgCode()
|
|||||||
|
|
||||||
bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||||
{
|
{
|
||||||
/*
|
switch (param)
|
||||||
// Debugging
|
{
|
||||||
wxDebugMsg("Edit control %d: ", (int)id);
|
case EN_SETFOCUS:
|
||||||
switch (param)
|
case EN_KILLFOCUS:
|
||||||
{
|
{
|
||||||
case EN_SETFOCUS:
|
wxFocusEvent event(param == EN_KILLFOCUS ? wxEVT_KILL_FOCUS
|
||||||
wxDebugMsg("EN_SETFOCUS\n");
|
: wxEVT_SET_FOCUS,
|
||||||
break;
|
m_windowId);
|
||||||
case EN_KILLFOCUS:
|
event.SetEventObject( this );
|
||||||
wxDebugMsg("EN_KILLFOCUS\n");
|
GetEventHandler()->ProcessEvent(event);
|
||||||
break;
|
}
|
||||||
case EN_CHANGE:
|
break;
|
||||||
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;
|
|
||||||
|
|
||||||
case EN_CHANGE:
|
case EN_CHANGE:
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
|
||||||
wxString val(GetValue());
|
wxString val(GetValue());
|
||||||
if ( !val.IsNull() )
|
if ( !val.IsNull() )
|
||||||
event.m_commandString = WXSTRINGCAST val;
|
event.m_commandString = WXSTRINGCAST val;
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
ProcessCommand(event);
|
ProcessCommand(event);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// the other notification messages are not processed
|
case EN_ERRSPACE:
|
||||||
case EN_UPDATE:
|
// the text size limit has been hit - increase it
|
||||||
case EN_ERRSPACE:
|
AdjustSpaceLimit();
|
||||||
case EN_MAXTEXT:
|
break;
|
||||||
case EN_HSCROLL:
|
|
||||||
case EN_VSCROLL:
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// processed
|
// the other notification messages are not processed
|
||||||
return TRUE;
|
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?
|
// For Rich Edit controls. Do we need it?
|
||||||
#if 0
|
#if 0
|
||||||
|
@@ -61,6 +61,10 @@
|
|||||||
#include "wx/tooltip.h"
|
#include "wx/tooltip.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_CARET
|
||||||
|
#include "wx/caret.h"
|
||||||
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
|
||||||
@@ -231,12 +235,6 @@ void wxWindow::Init()
|
|||||||
m_doubleClickAllowed = 0;
|
m_doubleClickAllowed = 0;
|
||||||
m_winCaptured = FALSE;
|
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_isBeingDeleted = FALSE;
|
||||||
m_oldWndProc = 0;
|
m_oldWndProc = 0;
|
||||||
m_useCtl3D = FALSE;
|
m_useCtl3D = FALSE;
|
||||||
@@ -1296,51 +1294,47 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y,
|
|||||||
if ( externalLeading ) *externalLeading = tm.tmExternalLeading;
|
if ( externalLeading ) *externalLeading = tm.tmExternalLeading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_CARET
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Caret manipulation
|
// Caret manipulation
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxWindow::CreateCaret(int w, int h)
|
void wxWindow::CreateCaret(int w, int h)
|
||||||
{
|
{
|
||||||
m_caretWidth = w;
|
SetCaret(new wxCaret(this, w, h));
|
||||||
m_caretHeight = h;
|
|
||||||
m_caretEnabled = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::CreateCaret(const wxBitmap *WXUNUSED(bitmap))
|
void wxWindow::CreateCaret(const wxBitmap *WXUNUSED(bitmap))
|
||||||
{
|
{
|
||||||
// Not implemented
|
wxFAIL_MSG("not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::ShowCaret(bool show)
|
void wxWindow::ShowCaret(bool show)
|
||||||
{
|
{
|
||||||
if ( m_caretEnabled )
|
wxCHECK_RET( m_caret, "no caret to show" );
|
||||||
{
|
|
||||||
if ( show )
|
m_caret->Show(show);
|
||||||
::ShowCaret(GetHwnd());
|
|
||||||
else
|
|
||||||
::HideCaret(GetHwnd());
|
|
||||||
m_caretShown = show;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::DestroyCaret()
|
void wxWindow::DestroyCaret()
|
||||||
{
|
{
|
||||||
m_caretEnabled = FALSE;
|
SetCaret(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::SetCaretPos(int x, int y)
|
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
|
void wxWindow::GetCaretPos(int *x, int *y) const
|
||||||
{
|
{
|
||||||
POINT point;
|
wxCHECK_RET( m_caret, "no caret to get position of" );
|
||||||
::GetCaretPos(&point);
|
|
||||||
*x = point.x;
|
m_caret->GetPosition(x, y);
|
||||||
*y = point.y;
|
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
// pre/post message processing
|
// pre/post message processing
|
||||||
@@ -2089,7 +2083,22 @@ bool wxWindow::MSWCreate(int id,
|
|||||||
return FALSE;
|
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
|
else
|
||||||
{
|
{
|
||||||
@@ -2277,20 +2286,13 @@ bool wxWindow::HandleActivate(int state,
|
|||||||
|
|
||||||
bool wxWindow::HandleSetFocus(WXHWND WXUNUSED(hwnd))
|
bool wxWindow::HandleSetFocus(WXHWND WXUNUSED(hwnd))
|
||||||
{
|
{
|
||||||
|
#if wxUSE_CARET
|
||||||
// Deal with caret
|
// Deal with caret
|
||||||
if ( m_caretEnabled && (m_caretWidth > 0) && (m_caretHeight > 0) )
|
if ( m_caret )
|
||||||
{
|
{
|
||||||
if ( ::CreateCaret(GetHwnd(), NULL, m_caretWidth, m_caretHeight) )
|
m_caret->OnSetFocus();
|
||||||
{
|
|
||||||
if ( m_caretShown )
|
|
||||||
{
|
|
||||||
if ( !::ShowCaret(GetHwnd()) )
|
|
||||||
wxLogLastError("ShowCaret");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
wxLogLastError("CreateCaret");
|
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
// panel wants to track the window which was the last to have focus in it
|
// panel wants to track the window which was the last to have focus in it
|
||||||
wxWindow *parent = GetParent();
|
wxWindow *parent = GetParent();
|
||||||
@@ -2307,12 +2309,13 @@ bool wxWindow::HandleSetFocus(WXHWND WXUNUSED(hwnd))
|
|||||||
|
|
||||||
bool wxWindow::HandleKillFocus(WXHWND WXUNUSED(hwnd))
|
bool wxWindow::HandleKillFocus(WXHWND WXUNUSED(hwnd))
|
||||||
{
|
{
|
||||||
|
#if wxUSE_CARET
|
||||||
// Deal with caret
|
// Deal with caret
|
||||||
if ( m_caretEnabled )
|
if ( m_caret )
|
||||||
{
|
{
|
||||||
if ( !::DestroyCaret() )
|
m_caret->OnKillFocus();
|
||||||
wxLogLastError("DestroyCaret");
|
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
wxFocusEvent event(wxEVT_KILL_FOCUS, m_windowId);
|
wxFocusEvent event(wxEVT_KILL_FOCUS, m_windowId);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
Reference in New Issue
Block a user