1. generic wxCaret fixes
2. wxGTK focus fix 3. wxCaret docs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7612 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -482,6 +482,7 @@ used internally by the HTML classes.
|
|||||||
|
|
||||||
\begin{twocollist}\itemsep=0pt
|
\begin{twocollist}\itemsep=0pt
|
||||||
\twocolitem{\helpref{wxApp}{wxapp}}{Application class}
|
\twocolitem{\helpref{wxApp}{wxapp}}{Application class}
|
||||||
|
\twocolitem{\helpref{wxCaret}{wxcaret}}{A caret (cursor) object}
|
||||||
\twocolitem{\helpref{wxCmdLineParser}{wxcmdlineparser}}{Command line parser class}
|
\twocolitem{\helpref{wxCmdLineParser}{wxcmdlineparser}}{Command line parser class}
|
||||||
\twocolitem{\helpref{wxConfig}{wxconfigbase}}{Classes for configuration reading/writing (using either INI files or registry)}
|
\twocolitem{\helpref{wxConfig}{wxconfigbase}}{Classes for configuration reading/writing (using either INI files or registry)}
|
||||||
\twocolitem{\helpref{wxDllLoader}{wxdllloader}}{Class to work with shared libraries.}
|
\twocolitem{\helpref{wxDllLoader}{wxdllloader}}{Class to work with shared libraries.}
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
\input strmbfrd.tex
|
\input strmbfrd.tex
|
||||||
\input calclevt.tex
|
\input calclevt.tex
|
||||||
\input calctrl.tex
|
\input calctrl.tex
|
||||||
|
\input caret.tex
|
||||||
\input checkbox.tex
|
\input checkbox.tex
|
||||||
\input checklst.tex
|
\input checklst.tex
|
||||||
\input choice.tex
|
\input choice.tex
|
||||||
|
@@ -481,6 +481,12 @@ control label is not truncated. For windows containing subwindows (typically
|
|||||||
same as the size the window would have had after calling
|
same as the size the window would have had after calling
|
||||||
\helpref{Fit}{wxwindowfit}.
|
\helpref{Fit}{wxwindowfit}.
|
||||||
|
|
||||||
|
\membersection{wxWindow::GetCaret}\label{wxwindowgetcaret}
|
||||||
|
|
||||||
|
\constfunc{wxCaret *}{GetCaret}{\void}
|
||||||
|
|
||||||
|
Returns the \helpref{caret}{wxcaret} associated with the window.
|
||||||
|
|
||||||
\membersection{wxWindow::GetCharHeight}
|
\membersection{wxWindow::GetCharHeight}
|
||||||
|
|
||||||
\constfunc{virtual int}{GetCharHeight}{\void}
|
\constfunc{virtual int}{GetCharHeight}{\void}
|
||||||
@@ -1807,6 +1813,12 @@ look as the user wishes with run-time loadable modules.
|
|||||||
\helpref{wxWindow::Refresh}{wxwindowrefresh},\rtfsp
|
\helpref{wxWindow::Refresh}{wxwindowrefresh},\rtfsp
|
||||||
\helpref{wxWindow::OnEraseBackground}{wxwindowonerasebackground}
|
\helpref{wxWindow::OnEraseBackground}{wxwindowonerasebackground}
|
||||||
|
|
||||||
|
\membersection{wxWindow::SetCaret}\label{wxwindowsetcaret}
|
||||||
|
|
||||||
|
\constfunc{void}{SetCaret}{\param{wxCaret *}{caret}}
|
||||||
|
|
||||||
|
Sets the \helpref{caret}{wxcaret} associated with the window.
|
||||||
|
|
||||||
\membersection{wxWindow::SetClientSize}\label{wxwindowsetclientsize}
|
\membersection{wxWindow::SetClientSize}\label{wxwindowsetclientsize}
|
||||||
|
|
||||||
\func{virtual void}{SetClientSize}{\param{int}{ width}, \param{int}{ height}}
|
\func{virtual void}{SetClientSize}{\param{int}{ width}, \param{int}{ height}}
|
||||||
@@ -1854,36 +1866,6 @@ be reset back to default.
|
|||||||
|
|
||||||
\helpref{::wxSetCursor}{wxsetcursor}, \helpref{wxCursor}{wxcursor}
|
\helpref{::wxSetCursor}{wxsetcursor}, \helpref{wxCursor}{wxcursor}
|
||||||
|
|
||||||
\membersection{wxWindow::SetEventHandler}\label{wxwindowseteventhandler}
|
|
||||||
|
|
||||||
\func{void}{SetEventHandler}{\param{wxEvtHandler* }{handler}}
|
|
||||||
|
|
||||||
Sets the event handler for this window.
|
|
||||||
|
|
||||||
\wxheading{Parameters}
|
|
||||||
|
|
||||||
\docparam{handler}{Specifies the handler to be set.}
|
|
||||||
|
|
||||||
\wxheading{Remarks}
|
|
||||||
|
|
||||||
An event handler is an object that is capable of processing the events
|
|
||||||
sent to a window. By default, the window is its own event handler, but
|
|
||||||
an application may wish to substitute another, for example to allow
|
|
||||||
central implementation of event-handling for a variety of different
|
|
||||||
window classes.
|
|
||||||
|
|
||||||
It is usually better to use \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler} since
|
|
||||||
this sets up a chain of event handlers, where an event not handled by one event handler is
|
|
||||||
handed to the next one in the chain.
|
|
||||||
|
|
||||||
\wxheading{See also}
|
|
||||||
|
|
||||||
\helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp
|
|
||||||
\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp
|
|
||||||
\helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp
|
|
||||||
\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp
|
|
||||||
\helpref{wxEvtHandler}{wxevthandler}
|
|
||||||
|
|
||||||
\membersection{wxWindow::SetConstraints}\label{wxwindowsetconstraints}
|
\membersection{wxWindow::SetConstraints}\label{wxwindowsetconstraints}
|
||||||
|
|
||||||
\func{void}{SetConstraints}{\param{wxLayoutConstraints* }{constraints}}
|
\func{void}{SetConstraints}{\param{wxLayoutConstraints* }{constraints}}
|
||||||
@@ -1918,6 +1900,36 @@ If the window already has a drop target, it is deleted.
|
|||||||
\helpref{wxWindow::GetDropTarget}{wxwindowgetdroptarget},
|
\helpref{wxWindow::GetDropTarget}{wxwindowgetdroptarget},
|
||||||
\helpref{Drag and drop overview}{wxdndoverview}
|
\helpref{Drag and drop overview}{wxdndoverview}
|
||||||
|
|
||||||
|
\membersection{wxWindow::SetEventHandler}\label{wxwindowseteventhandler}
|
||||||
|
|
||||||
|
\func{void}{SetEventHandler}{\param{wxEvtHandler* }{handler}}
|
||||||
|
|
||||||
|
Sets the event handler for this window.
|
||||||
|
|
||||||
|
\wxheading{Parameters}
|
||||||
|
|
||||||
|
\docparam{handler}{Specifies the handler to be set.}
|
||||||
|
|
||||||
|
\wxheading{Remarks}
|
||||||
|
|
||||||
|
An event handler is an object that is capable of processing the events
|
||||||
|
sent to a window. By default, the window is its own event handler, but
|
||||||
|
an application may wish to substitute another, for example to allow
|
||||||
|
central implementation of event-handling for a variety of different
|
||||||
|
window classes.
|
||||||
|
|
||||||
|
It is usually better to use \helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler} since
|
||||||
|
this sets up a chain of event handlers, where an event not handled by one event handler is
|
||||||
|
handed to the next one in the chain.
|
||||||
|
|
||||||
|
\wxheading{See also}
|
||||||
|
|
||||||
|
\helpref{wxWindow::GetEventHandler}{wxwindowgeteventhandler},\rtfsp
|
||||||
|
\helpref{wxWindow::PushEventHandler}{wxwindowpusheventhandler},\rtfsp
|
||||||
|
\helpref{wxWindow::PopEventHandler}{wxwindowpusheventhandler},\rtfsp
|
||||||
|
\helpref{wxEvtHandler::ProcessEvent}{wxevthandlerprocessevent},\rtfsp
|
||||||
|
\helpref{wxEvtHandler}{wxevthandler}
|
||||||
|
|
||||||
\membersection{wxWindow::SetExtraStyle}\label{wxwindowsetextrastyle}
|
\membersection{wxWindow::SetExtraStyle}\label{wxwindowsetextrastyle}
|
||||||
|
|
||||||
\func{void}{SetExtraStyle}{\param{long }{exStyle}}
|
\func{void}{SetExtraStyle}{\param{long }{exStyle}}
|
||||||
|
@@ -48,14 +48,24 @@ public:
|
|||||||
// implementation
|
// implementation
|
||||||
// --------------
|
// --------------
|
||||||
|
|
||||||
// blink the caret once
|
// called by wxWindow (not using the event tables)
|
||||||
void Blink();
|
virtual void OnSetFocus();
|
||||||
|
virtual void OnKillFocus();
|
||||||
|
|
||||||
|
// called by wxCaretTimer
|
||||||
|
void OnTimer();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoShow();
|
virtual void DoShow();
|
||||||
virtual void DoHide();
|
virtual void DoHide();
|
||||||
virtual void DoMove();
|
virtual void DoMove();
|
||||||
|
|
||||||
|
// blink the caret once
|
||||||
|
void Blink();
|
||||||
|
|
||||||
|
// refresh the caret
|
||||||
|
void Refresh();
|
||||||
|
|
||||||
// draw the caret on the given DC
|
// draw the caret on the given DC
|
||||||
void DoDraw(wxDC *dc);
|
void DoDraw(wxDC *dc);
|
||||||
|
|
||||||
@@ -64,7 +74,8 @@ private:
|
|||||||
void InitGeneric();
|
void InitGeneric();
|
||||||
|
|
||||||
wxCaretTimer m_timer;
|
wxCaretTimer m_timer;
|
||||||
bool m_blinkedOut; // TRUE => caret hidden right now
|
bool m_blinkedOut, // TRUE => caret hidden right now
|
||||||
|
m_hasFocus; // TRUE => our window has focus
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _WX_CARET_H_
|
#endif // _WX_CARET_H_
|
||||||
|
@@ -61,6 +61,7 @@ public:
|
|||||||
// event handlers (these functions should _not_ be virtual)
|
// event handlers (these functions should _not_ be virtual)
|
||||||
void OnQuit(wxCommandEvent& event);
|
void OnQuit(wxCommandEvent& event);
|
||||||
void OnAbout(wxCommandEvent& event);
|
void OnAbout(wxCommandEvent& event);
|
||||||
|
void OnSetBlinkTime(wxCommandEvent& event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// any class wishing to process wxWindows events must use this macro
|
// any class wishing to process wxWindows events must use this macro
|
||||||
@@ -124,8 +125,7 @@ enum
|
|||||||
// menu items
|
// menu items
|
||||||
Caret_Quit = 1,
|
Caret_Quit = 1,
|
||||||
Caret_About,
|
Caret_About,
|
||||||
Caret_Test1,
|
Caret_SetBlinkTime,
|
||||||
Caret_Test2,
|
|
||||||
|
|
||||||
// controls start here (the numbers are, of course, arbitrary)
|
// controls start here (the numbers are, of course, arbitrary)
|
||||||
Caret_Text = 1000
|
Caret_Text = 1000
|
||||||
@@ -141,6 +141,7 @@ enum
|
|||||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
EVT_MENU(Caret_Quit, MyFrame::OnQuit)
|
EVT_MENU(Caret_Quit, MyFrame::OnQuit)
|
||||||
EVT_MENU(Caret_About, MyFrame::OnAbout)
|
EVT_MENU(Caret_About, MyFrame::OnAbout)
|
||||||
|
EVT_MENU(Caret_SetBlinkTime, MyFrame::OnSetBlinkTime)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// Create a new application object: this macro will allow wxWindows to create
|
// Create a new application object: this macro will allow wxWindows to create
|
||||||
@@ -190,6 +191,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
|||||||
// create a menu bar
|
// create a menu bar
|
||||||
wxMenu *menuFile = new wxMenu;
|
wxMenu *menuFile = new wxMenu;
|
||||||
|
|
||||||
|
menuFile->Append(Caret_SetBlinkTime, "&Blink time...\tCtrl-B");
|
||||||
|
menuFile->AppendSeparator();
|
||||||
menuFile->Append(Caret_About, "&About...\tCtrl-A", "Show about dialog");
|
menuFile->Append(Caret_About, "&About...\tCtrl-A", "Show about dialog");
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
menuFile->Append(Caret_Quit, "E&xit\tAlt-X", "Quit this program");
|
menuFile->Append(Caret_Quit, "E&xit\tAlt-X", "Quit this program");
|
||||||
@@ -219,9 +222,26 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxMessageBox(_T("This is the about dialog of caret sample."), "About Caret", wxOK | wxICON_INFORMATION, this);
|
wxMessageBox(_T("The caret wxWindows sample.\n<EFBFBD> 1999 Vadim Zeitlin"),
|
||||||
|
_T("About Caret"), wxOK | wxICON_INFORMATION, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnSetBlinkTime(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
long blinkTime = wxGetNumberFromUser
|
||||||
|
(
|
||||||
|
_T("The caret blink time is the time between two blinks"),
|
||||||
|
_T("Time in milliseconds:"),
|
||||||
|
_T("wxCaret sample"),
|
||||||
|
wxCaret::GetBlinkTime(), 0, 10000,
|
||||||
|
this
|
||||||
|
);
|
||||||
|
if ( blinkTime != -1 )
|
||||||
|
{
|
||||||
|
wxCaret::SetBlinkTime((int)blinkTime);
|
||||||
|
wxLogStatus(this, _T("Blink time set to %ld milliseconds."), blinkTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// MyCanvas
|
// MyCanvas
|
||||||
@@ -292,10 +312,15 @@ void MyCanvas::OnSize( wxSizeEvent &event )
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NB: this method is horrible inefficient especially because the caret
|
||||||
|
// needs to be redrawn often and in this case we only have to redraw
|
||||||
|
// the caret location and not the entire window - in a real program we
|
||||||
|
// would use GetUpdateRegion() and iterate over rectangles it contains
|
||||||
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxPaintDC dc( this );
|
wxPaintDC dc( this );
|
||||||
PrepareDC( dc );
|
PrepareDC( dc );
|
||||||
|
dc.Clear();
|
||||||
|
|
||||||
dc.SetFont( m_font );
|
dc.SetFont( m_font );
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: generic/caret.h
|
// Name: generic/caret.cpp
|
||||||
// Purpose: generic wxCaret class
|
// Purpose: generic wxCaret class implementation
|
||||||
// Author: Vadim Zeitlin (original code by Robert Roebling)
|
// Author: Vadim Zeitlin (original code by Robert Roebling)
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 25.05.99
|
// Created: 25.05.99
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "caret.h"
|
#pragma implementation "caret.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
@@ -46,6 +46,10 @@ static int gs_blinkTime = 500; // in milliseconds
|
|||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// timer stuff
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxCaretTimer::wxCaretTimer(wxCaret *caret)
|
wxCaretTimer::wxCaretTimer(wxCaret *caret)
|
||||||
{
|
{
|
||||||
m_caret = caret;
|
m_caret = caret;
|
||||||
@@ -53,14 +57,20 @@ wxCaretTimer::wxCaretTimer(wxCaret *caret)
|
|||||||
|
|
||||||
void wxCaretTimer::Notify()
|
void wxCaretTimer::Notify()
|
||||||
{
|
{
|
||||||
m_caret->Blink();
|
m_caret->OnTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxCaret::OnTimer()
|
||||||
|
{
|
||||||
|
// don't blink the caret when we don't have the focus
|
||||||
|
if ( m_hasFocus )
|
||||||
|
Blink();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxCaret static functions and data
|
// wxCaret static functions and data
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
int wxCaretBase::GetBlinkTime()
|
int wxCaretBase::GetBlinkTime()
|
||||||
{
|
{
|
||||||
return gs_blinkTime;
|
return gs_blinkTime;
|
||||||
@@ -77,6 +87,8 @@ void wxCaretBase::SetBlinkTime(int milliseconds)
|
|||||||
|
|
||||||
void wxCaret::InitGeneric()
|
void wxCaret::InitGeneric()
|
||||||
{
|
{
|
||||||
|
m_hasFocus = TRUE;
|
||||||
|
m_blinkedOut = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCaret::~wxCaret()
|
wxCaret::~wxCaret()
|
||||||
@@ -119,6 +131,32 @@ void wxCaret::DoMove()
|
|||||||
//else: will be shown at the correct location next time it blinks
|
//else: will be shown at the correct location next time it blinks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// handling the focus
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxCaret::OnSetFocus()
|
||||||
|
{
|
||||||
|
m_hasFocus = TRUE;
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxCaret::OnKillFocus()
|
||||||
|
{
|
||||||
|
m_hasFocus = FALSE;
|
||||||
|
|
||||||
|
if ( IsVisible() )
|
||||||
|
{
|
||||||
|
// the caret must be shown - otherwise, if it is hidden now, it will
|
||||||
|
// stay so until the focus doesn't return because it won't blink any
|
||||||
|
// more
|
||||||
|
m_blinkedOut = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// drawing the caret
|
// drawing the caret
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -127,14 +165,23 @@ void wxCaret::Blink()
|
|||||||
{
|
{
|
||||||
m_blinkedOut = !m_blinkedOut;
|
m_blinkedOut = !m_blinkedOut;
|
||||||
|
|
||||||
wxClientDC dc(GetWindow());
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxCaret::Refresh()
|
||||||
|
{
|
||||||
if ( !m_blinkedOut )
|
if ( !m_blinkedOut )
|
||||||
{
|
{
|
||||||
|
wxClientDC dc(GetWindow());
|
||||||
DoDraw(&dc);
|
DoDraw(&dc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// FIXME can't be less efficient than this... (+1 needed!)
|
// FIXME can't be less efficient than this... we probably should use
|
||||||
|
// backing store for the caret instead of leaving all the burden
|
||||||
|
// of correct refresh logic handling to the user code
|
||||||
|
|
||||||
|
// NB: +1 is needed!
|
||||||
wxRect rect(m_x, m_y, m_width + 1, m_height + 1);
|
wxRect rect(m_x, m_y, m_width + 1, m_height + 1);
|
||||||
GetWindow()->Refresh(FALSE, &rect);
|
GetWindow()->Refresh(FALSE, &rect);
|
||||||
}
|
}
|
||||||
@@ -143,8 +190,18 @@ void wxCaret::Blink()
|
|||||||
void wxCaret::DoDraw(wxDC *dc)
|
void wxCaret::DoDraw(wxDC *dc)
|
||||||
{
|
{
|
||||||
dc->SetPen( *wxBLACK_PEN );
|
dc->SetPen( *wxBLACK_PEN );
|
||||||
|
|
||||||
|
// VZ: Robert's code for I-shaped caret - this is nice but doesn't look
|
||||||
|
// at all the same as the MSW version and I don't know how to indicate
|
||||||
|
// that the window has focus or not with such caret
|
||||||
|
#if 0
|
||||||
dc->DrawLine( m_x, m_y, m_x+m_width, m_y );
|
dc->DrawLine( m_x, m_y, m_x+m_width, m_y );
|
||||||
dc->DrawLine( m_x, m_y+m_height, m_x+m_width, m_y+m_height );
|
dc->DrawLine( m_x, m_y+m_height, m_x+m_width, m_y+m_height );
|
||||||
dc->DrawLine( m_x+(m_width/2), m_y, m_x+(m_width/2), m_y+m_height );
|
dc->DrawLine( m_x+(m_width/2), m_y, m_x+(m_width/2), m_y+m_height );
|
||||||
// dc->DrawLine( m_x+(m_width/2)+1, m_y, m_x+(m_width/2)+1, m_y+m_height );
|
// dc->DrawLine( m_x+(m_width/2)+1, m_y, m_x+(m_width/2)+1, m_y+m_height );
|
||||||
|
#else // 1
|
||||||
|
if ( m_hasFocus )
|
||||||
|
dc->SetBrush( *wxBLACK_BRUSH );
|
||||||
|
dc->DrawRectangle( m_x, m_y, m_width, m_height );
|
||||||
|
#endif // 0/1
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: window.cpp
|
// Name: gtk/window.cpp
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
@@ -30,6 +30,10 @@
|
|||||||
#include "wx/tooltip.h"
|
#include "wx/tooltip.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_CARET
|
||||||
|
#include "wx/caret.h"
|
||||||
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
@@ -298,6 +302,28 @@ extern bool g_isIdle;
|
|||||||
// local code (see below)
|
// local code (see below)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// returns the child of win which currently has focus or NULL if not found
|
||||||
|
static wxWindow *FindFocusedChild(wxWindow *win)
|
||||||
|
{
|
||||||
|
wxWindow *winFocus = wxWindow::FindFocus();
|
||||||
|
if ( !winFocus )
|
||||||
|
return (wxWindow *)NULL;
|
||||||
|
|
||||||
|
if ( winFocus == win )
|
||||||
|
return win;
|
||||||
|
|
||||||
|
for ( wxWindowList::Node *node = win->GetChildren().GetFirst();
|
||||||
|
node;
|
||||||
|
node = node->GetNext() )
|
||||||
|
{
|
||||||
|
wxWindow *child = FindFocusedChild(node->GetData());
|
||||||
|
if ( child )
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (wxWindow *)NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void draw_frame( GtkWidget *widget, wxWindow *win )
|
static void draw_frame( GtkWidget *widget, wxWindow *win )
|
||||||
{
|
{
|
||||||
if (!win->m_hasVMT)
|
if (!win->m_hasVMT)
|
||||||
@@ -1486,6 +1512,15 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
|
|||||||
gdk_im_begin(win->m_ic, win->m_wxwindow->window);
|
gdk_im_begin(win->m_ic, win->m_wxwindow->window);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef wxUSE_CARET
|
||||||
|
// caret needs to be informed about focus change
|
||||||
|
wxCaret *caret = win->GetCaret();
|
||||||
|
if ( caret )
|
||||||
|
{
|
||||||
|
caret->OnSetFocus();
|
||||||
|
}
|
||||||
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
|
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
|
|
||||||
@@ -1517,6 +1552,10 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
|
|||||||
// g_sendActivateEvent to -1
|
// g_sendActivateEvent to -1
|
||||||
g_sendActivateEvent = 0;
|
g_sendActivateEvent = 0;
|
||||||
|
|
||||||
|
wxWindow *winFocus = FindFocusedChild(win);
|
||||||
|
if ( winFocus )
|
||||||
|
win = winFocus;
|
||||||
|
|
||||||
g_focusWindow = (wxWindow *)NULL;
|
g_focusWindow = (wxWindow *)NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1531,6 +1570,15 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
|
|||||||
gdk_im_end();
|
gdk_im_end();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef wxUSE_CARET
|
||||||
|
// caret needs to be informed about focus change
|
||||||
|
wxCaret *caret = win->GetCaret();
|
||||||
|
if ( caret )
|
||||||
|
{
|
||||||
|
caret->OnKillFocus();
|
||||||
|
}
|
||||||
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
|
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: window.cpp
|
// Name: gtk/window.cpp
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
@@ -30,6 +30,10 @@
|
|||||||
#include "wx/tooltip.h"
|
#include "wx/tooltip.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_CARET
|
||||||
|
#include "wx/caret.h"
|
||||||
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
@@ -298,6 +302,28 @@ extern bool g_isIdle;
|
|||||||
// local code (see below)
|
// local code (see below)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// returns the child of win which currently has focus or NULL if not found
|
||||||
|
static wxWindow *FindFocusedChild(wxWindow *win)
|
||||||
|
{
|
||||||
|
wxWindow *winFocus = wxWindow::FindFocus();
|
||||||
|
if ( !winFocus )
|
||||||
|
return (wxWindow *)NULL;
|
||||||
|
|
||||||
|
if ( winFocus == win )
|
||||||
|
return win;
|
||||||
|
|
||||||
|
for ( wxWindowList::Node *node = win->GetChildren().GetFirst();
|
||||||
|
node;
|
||||||
|
node = node->GetNext() )
|
||||||
|
{
|
||||||
|
wxWindow *child = FindFocusedChild(node->GetData());
|
||||||
|
if ( child )
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (wxWindow *)NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void draw_frame( GtkWidget *widget, wxWindow *win )
|
static void draw_frame( GtkWidget *widget, wxWindow *win )
|
||||||
{
|
{
|
||||||
if (!win->m_hasVMT)
|
if (!win->m_hasVMT)
|
||||||
@@ -1486,6 +1512,15 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
|
|||||||
gdk_im_begin(win->m_ic, win->m_wxwindow->window);
|
gdk_im_begin(win->m_ic, win->m_wxwindow->window);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef wxUSE_CARET
|
||||||
|
// caret needs to be informed about focus change
|
||||||
|
wxCaret *caret = win->GetCaret();
|
||||||
|
if ( caret )
|
||||||
|
{
|
||||||
|
caret->OnSetFocus();
|
||||||
|
}
|
||||||
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
|
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
|
|
||||||
@@ -1517,6 +1552,10 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
|
|||||||
// g_sendActivateEvent to -1
|
// g_sendActivateEvent to -1
|
||||||
g_sendActivateEvent = 0;
|
g_sendActivateEvent = 0;
|
||||||
|
|
||||||
|
wxWindow *winFocus = FindFocusedChild(win);
|
||||||
|
if ( winFocus )
|
||||||
|
win = winFocus;
|
||||||
|
|
||||||
g_focusWindow = (wxWindow *)NULL;
|
g_focusWindow = (wxWindow *)NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1531,6 +1570,15 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
|
|||||||
gdk_im_end();
|
gdk_im_end();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef wxUSE_CARET
|
||||||
|
// caret needs to be informed about focus change
|
||||||
|
wxCaret *caret = win->GetCaret();
|
||||||
|
if ( caret )
|
||||||
|
{
|
||||||
|
caret->OnKillFocus();
|
||||||
|
}
|
||||||
|
#endif // wxUSE_CARET
|
||||||
|
|
||||||
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
|
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
|
||||||
event.SetEventObject( win );
|
event.SetEventObject( win );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user