1. more keyboard navigation fixes - seems to work now
2. wxPanel now remembers the last control which had focus, so it's restored to it when the focus returns to the panel (very handy IMHO) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1604 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -26,8 +26,8 @@ class WXDLLEXPORT wxPanel : public wxWindow
|
|||||||
public:
|
public:
|
||||||
wxPanel();
|
wxPanel();
|
||||||
|
|
||||||
// Old-style constructor (no default values for coordinates to avoid ambiguity
|
// Old-style constructor (no default values for coordinates to avoid
|
||||||
// with the new one)
|
// ambiguity with the new one)
|
||||||
wxPanel(wxWindow *parent,
|
wxPanel(wxWindow *parent,
|
||||||
int x, int y, int width, int height,
|
int x, int y, int width, int height,
|
||||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||||
@@ -47,6 +47,7 @@ public:
|
|||||||
Create(parent, id, pos, size, style, name);
|
Create(parent, id, pos, size, style, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pseudo ctor
|
||||||
bool Create(wxWindow *parent, wxWindowID id,
|
bool Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
@@ -57,15 +58,22 @@ public:
|
|||||||
// to the dialog via validators.
|
// to the dialog via validators.
|
||||||
virtual void InitDialog();
|
virtual void InitDialog();
|
||||||
|
|
||||||
// Responds to colour changes
|
// implementation
|
||||||
|
// responds to colour changes
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
|
|
||||||
// Process a keyboard navigation message (Tab traversal)
|
// process a keyboard navigation message (Tab traversal)
|
||||||
void OnNavigationKey(wxNavigationKeyEvent& event);
|
void OnNavigationKey(wxNavigationKeyEvent& event);
|
||||||
|
|
||||||
// override base class virtuals
|
// set the focus to the first child if we get it
|
||||||
// we don't want focus for ourselves
|
void OnFocus(wxFocusEvent& event);
|
||||||
virtual bool AcceptsFocus() const { return FALSE; }
|
|
||||||
|
// called by wxWindow whenever it gets focus
|
||||||
|
void SetLastFocus(wxWindow *focus) { m_lastFocus = focus; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// the child which had the focus last time this panel was activated
|
||||||
|
wxWindow *m_lastFocus;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxPanel)
|
DECLARE_DYNAMIC_CLASS(wxPanel)
|
||||||
|
@@ -18,43 +18,46 @@
|
|||||||
|
|
||||||
#include "wx/window.h"
|
#include "wx/window.h"
|
||||||
#include "wx/list.h"
|
#include "wx/list.h"
|
||||||
#include "wx/validate.h"
|
|
||||||
|
|
||||||
// General item class
|
// General item class
|
||||||
class WXDLLEXPORT wxControl : public wxWindow
|
class WXDLLEXPORT wxControl : public wxWindow
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(wxControl)
|
DECLARE_ABSTRACT_CLASS(wxControl)
|
||||||
public:
|
|
||||||
wxControl(void);
|
|
||||||
~wxControl(void);
|
|
||||||
|
|
||||||
virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; // Simulates an event
|
public:
|
||||||
virtual void ProcessCommand(wxCommandEvent& event); // Calls the callback and
|
wxControl();
|
||||||
// appropriate event handlers
|
virtual ~wxControl();
|
||||||
|
|
||||||
|
// Simulates an event
|
||||||
|
virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
|
||||||
|
// Calls the callback and appropriate event handlers
|
||||||
|
virtual void ProcessCommand(wxCommandEvent& event);
|
||||||
|
|
||||||
virtual void SetClientSize(int width, int height);
|
virtual void SetClientSize(int width, int height);
|
||||||
virtual void SetClientSize(const wxSize& sz) { wxWindow::SetClientSize(sz); }
|
virtual void SetClientSize(const wxSize& sz) { wxWindow::SetClientSize(sz); }
|
||||||
|
|
||||||
virtual void SetLabel(const wxString& label);
|
virtual void SetLabel(const wxString& label);
|
||||||
virtual wxString GetLabel(void) const ;
|
virtual wxString GetLabel() const;
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
#if WXWIN_COMPATIBILITY
|
||||||
inline virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
|
virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
|
||||||
inline wxColour*GetButtonColour(void) const { return NULL; }
|
wxColour* GetButtonColour() const { return NULL; }
|
||||||
|
|
||||||
inline virtual void SetLabelFont(const wxFont& font);
|
inline virtual void SetLabelFont(const wxFont& font);
|
||||||
inline virtual void SetButtonFont(const wxFont& font);
|
inline virtual void SetButtonFont(const wxFont& font);
|
||||||
inline wxFont& GetLabelFont(void) const ;
|
inline wxFont& GetLabelFont() const;
|
||||||
inline wxFont& GetButtonFont(void) const ;
|
inline wxFont& GetButtonFont() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Places item in centre of panel - so can't be used BEFORE panel->Fit()
|
// Places item in centre of panel - so can't be used BEFORE panel->Fit()
|
||||||
void Centre(int direction = wxHORIZONTAL);
|
void Centre(int direction = wxHORIZONTAL);
|
||||||
inline void Callback(const wxFunction function); // Adds callback
|
|
||||||
|
// Adds callback
|
||||||
|
inline void Callback(const wxFunction function);
|
||||||
|
|
||||||
// MSW-specific
|
// MSW-specific
|
||||||
|
|
||||||
// Window procedure
|
// Window procedure
|
||||||
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
|
||||||
virtual void MSWOnMouseMove(int x, int y, WXUINT flags);
|
virtual void MSWOnMouseMove(int x, int y, WXUINT flags);
|
||||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||||
|
|
||||||
@@ -64,22 +67,28 @@ public:
|
|||||||
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
|
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
|
||||||
virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
|
virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
|
||||||
|
|
||||||
inline wxFunction GetCallback(void) { return m_callback; }
|
wxFunction GetCallback() { return m_callback; }
|
||||||
inline wxList& GetSubcontrols(void) { return m_subControls; }
|
wxList& GetSubcontrols() { return m_subControls; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxFunction m_callback; // Callback associated with the window
|
wxFunction m_callback; // Callback associated with the window
|
||||||
|
|
||||||
// MSW implementation
|
// MSW implementation
|
||||||
wxList m_subControls; // For controls like radiobuttons which are really composite
|
wxList m_subControls; // For controls like radiobuttons which are really composite
|
||||||
|
|
||||||
|
private:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void wxControl::Callback(const wxFunction function) { m_callback = function; }; // Adds callback
|
// Adds callback
|
||||||
|
inline void wxControl::Callback(const wxFunction function)
|
||||||
|
{
|
||||||
|
m_callback = function;
|
||||||
|
};
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
#if WXWIN_COMPATIBILITY
|
||||||
inline wxFont& wxControl::GetLabelFont(void) const { return GetFont() ; }
|
inline wxFont& wxControl::GetLabelFont() const { return GetFont() ; }
|
||||||
inline wxFont& wxControl::GetButtonFont(void) const { return GetFont() ; }
|
inline wxFont& wxControl::GetButtonFont() const { return GetFont() ; }
|
||||||
inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
|
inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
|
||||||
inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
|
inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
|
||||||
#endif
|
#endif
|
||||||
|
@@ -433,9 +433,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
|||||||
|
|
||||||
panel = new wxPanel(m_notebook);
|
panel = new wxPanel(m_notebook);
|
||||||
m_textentry = new MyTextCtrl( panel, -1, "Write text here.", wxPoint(10,10), wxSize(320,28),
|
m_textentry = new MyTextCtrl( panel, -1, "Write text here.", wxPoint(10,10), wxSize(320,28),
|
||||||
// wxTE_PROCESS_ENTER);
|
0);//wxTE_PROCESS_ENTER);
|
||||||
0);
|
|
||||||
|
|
||||||
(*m_textentry) << " More text."; // this text is appended
|
(*m_textentry) << " More text."; // this text is appended
|
||||||
m_textentry->SetInsertionPoint(0);
|
m_textentry->SetInsertionPoint(0);
|
||||||
m_textentry->WriteText("Less text."); // this text is prepended
|
m_textentry->WriteText("Less text."); // this text is prepended
|
||||||
@@ -451,7 +449,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
|||||||
(void)new wxButton( panel, ID_MOVE_END_ZONE, "Text &zone", wxPoint(370, 60), wxSize(110, 30) );
|
(void)new wxButton( panel, ID_MOVE_END_ZONE, "Text &zone", wxPoint(370, 60), wxSize(110, 30) );
|
||||||
(void)new wxStaticBox( panel, -1, "wx&Clipboard", wxPoint(345,110), wxSize(160,100) );
|
(void)new wxStaticBox( panel, -1, "wx&Clipboard", wxPoint(345,110), wxSize(160,100) );
|
||||||
(void)new wxButton( panel, ID_COPY_TEXT, "C&opy line 1", wxPoint(375,130), wxSize(110,30) );
|
(void)new wxButton( panel, ID_COPY_TEXT, "C&opy line 1", wxPoint(375,130), wxSize(110,30) );
|
||||||
(void)new wxButton( panel, ID_PASTE_TEXT, "&Paste text", wxPoint(375,170), wxSize(110,30) );
|
(new wxButton( panel, ID_PASTE_TEXT, "&Paste text", wxPoint(375,170), wxSize(110,30) ))
|
||||||
|
->SetDefault();
|
||||||
m_notebook->AddPage( panel, "wxTextCtrl" , FALSE, Image_Text );
|
m_notebook->AddPage( panel, "wxTextCtrl" , FALSE, Image_Text );
|
||||||
|
|
||||||
wxString choices2[] =
|
wxString choices2[] =
|
||||||
@@ -542,7 +541,8 @@ void MyPanel::OnPasteFromClipboard( wxCommandEvent &WXUNUSED(event) )
|
|||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
|
|
||||||
*m_text << "Closed the clipboard." << "\n";
|
*m_text << "Closed the clipboard." << "\n";
|
||||||
|
#else
|
||||||
|
wxLogError("Clipboard API is not yet implemented for this platform.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -337,8 +337,8 @@ wxString wxFileType::ExpandCommand(const wxString& command,
|
|||||||
case 's':
|
case 's':
|
||||||
// '%s' expands into file name (quoted because it might
|
// '%s' expands into file name (quoted because it might
|
||||||
// contain spaces) - except if there are already quotes
|
// contain spaces) - except if there are already quotes
|
||||||
// there because otherwise some programs may get confused by
|
// there because otherwise some programs may get confused
|
||||||
// double double quotes
|
// by double double quotes
|
||||||
#if 0
|
#if 0
|
||||||
if ( *(pc - 2) == '"' )
|
if ( *(pc - 2) == '"' )
|
||||||
str << params.GetFileName();
|
str << params.GetFileName();
|
||||||
|
@@ -34,6 +34,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow)
|
|||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxPanel, wxWindow)
|
BEGIN_EVENT_TABLE(wxPanel, wxWindow)
|
||||||
EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged)
|
EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged)
|
||||||
|
EVT_SET_FOCUS(wxPanel::OnFocus)
|
||||||
EVT_NAVIGATION_KEY(wxPanel::OnNavigationKey)
|
EVT_NAVIGATION_KEY(wxPanel::OnNavigationKey)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
@@ -41,6 +42,7 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
wxPanel::wxPanel()
|
wxPanel::wxPanel()
|
||||||
{
|
{
|
||||||
|
m_lastFocus = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPanel::Create(wxWindow *parent, wxWindowID id,
|
bool wxPanel::Create(wxWindow *parent, wxWindowID id,
|
||||||
@@ -49,6 +51,8 @@ bool wxPanel::Create(wxWindow *parent, wxWindowID id,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
|
m_lastFocus = NULL;
|
||||||
|
|
||||||
bool ret = wxWindow::Create(parent, id, pos, size, style, name);
|
bool ret = wxWindow::Create(parent, id, pos, size, style, name);
|
||||||
|
|
||||||
if ( ret )
|
if ( ret )
|
||||||
@@ -116,7 +120,10 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
|
|||||||
{
|
{
|
||||||
if (!node)
|
if (!node)
|
||||||
{
|
{
|
||||||
#if 0
|
//#if 0 // FIXME seems to enter in an infinite loop - how is this possible?
|
||||||
|
// we arrived at the last/first of our children - but may be this
|
||||||
|
// panel is inside another panel, so make focus go to the next/prev
|
||||||
|
// control in the parent (if we have one)
|
||||||
if (GetParent() != NULL)
|
if (GetParent() != NULL)
|
||||||
{
|
{
|
||||||
wxNavigationKeyEvent new_event;
|
wxNavigationKeyEvent new_event;
|
||||||
@@ -129,10 +136,12 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // 0
|
//#endif // 0
|
||||||
|
|
||||||
node = event.GetDirection() ? GetChildren().First()
|
node = event.GetDirection() ? GetChildren().First()
|
||||||
: GetChildren().Last();
|
: GetChildren().Last();
|
||||||
|
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWindow *child = (wxWindow *)node->Data();
|
wxWindow *child = (wxWindow *)node->Data();
|
||||||
@@ -152,3 +161,10 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxPanel::OnFocus(wxFocusEvent& event)
|
||||||
|
{
|
||||||
|
if ( m_lastFocus )
|
||||||
|
m_lastFocus->SetFocus();
|
||||||
|
else
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
@@ -183,11 +183,6 @@ void wxControl::MSWOnMouseMove(int x, int y, WXUINT flags)
|
|||||||
Default();
|
Default();
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxControl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
|
||||||
{
|
|
||||||
return wxWindow::MSWWindowProc(nMsg, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxControl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam,
|
bool wxControl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam,
|
||||||
WXLPARAM* result)
|
WXLPARAM* result)
|
||||||
{
|
{
|
||||||
|
@@ -709,11 +709,6 @@ void wxTextCtrl::ShowPosition(long pos)
|
|||||||
|
|
||||||
int linesToScroll = specifiedLineLineNo - currentLineLineNo;
|
int linesToScroll = specifiedLineLineNo - currentLineLineNo;
|
||||||
|
|
||||||
/*
|
|
||||||
wxDebugMsg("Caret line: %d; Current visible line: %d; Specified line: %d; lines to scroll: %d\n",
|
|
||||||
currentLineLineNo1, currentLineLineNo, specifiedLineLineNo, linesToScroll);
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (linesToScroll != 0)
|
if (linesToScroll != 0)
|
||||||
(void)SendMessage(hWnd, EM_LINESCROLL, (WPARAM)0, (LPARAM)MAKELPARAM(linesToScroll, 0));
|
(void)SendMessage(hWnd, EM_LINESCROLL, (WPARAM)0, (LPARAM)MAKELPARAM(linesToScroll, 0));
|
||||||
}
|
}
|
||||||
@@ -1006,12 +1001,14 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
if ( GetEventHandler()->ProcessEvent(eventNav) )
|
if ( GetEventHandler()->ProcessEvent(eventNav) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't just call event.Skip() because this will cause TABs and ENTERs
|
// don't just call event.Skip() because this will cause TABs and ENTERs
|
||||||
// be passed upwards and we don't always want this - instead process it
|
// be passed upwards and we don't always want this - instead process it
|
||||||
// right here
|
// right here
|
||||||
Default();
|
//Default();
|
||||||
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxTextCtrl::MSWGetDlgCode()
|
long wxTextCtrl::MSWGetDlgCode()
|
||||||
|
@@ -21,7 +21,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include <stdio.h>
|
|
||||||
#include "wx/setup.h"
|
#include "wx/setup.h"
|
||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
@@ -36,6 +35,8 @@
|
|||||||
#include "wx/button.h"
|
#include "wx/button.h"
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#include "wx/msgdlg.h"
|
#include "wx/msgdlg.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
@@ -887,10 +888,8 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
|
|||||||
wnd->m_hWnd = (WXHWND) hWnd;
|
wnd->m_hWnd = (WXHWND) hWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop right here if we don't have a valid handle
|
// Stop right here if we don't have a valid handle in our wxWindow object.
|
||||||
// in our wxWnd object.
|
|
||||||
if (wnd && !wnd->m_hWnd) {
|
if (wnd && !wnd->m_hWnd) {
|
||||||
// wxDebugMsg("Warning: could not find a valid handle, wx_win.cc/wxWndProc.\n");
|
|
||||||
wnd->m_hWnd = (WXHWND) hWnd;
|
wnd->m_hWnd = (WXHWND) hWnd;
|
||||||
long res = wnd->MSWDefWindowProc(message, wParam, lParam );
|
long res = wnd->MSWDefWindowProc(message, wParam, lParam );
|
||||||
wnd->m_hWnd = 0;
|
wnd->m_hWnd = 0;
|
||||||
@@ -1206,28 +1205,36 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
{
|
|
||||||
MSWOnKeyDown((WORD) wParam, lParam);
|
MSWOnKeyDown((WORD) wParam, lParam);
|
||||||
// we consider these message "not interesting"
|
// we consider these message "not interesting"
|
||||||
if ( wParam == VK_SHIFT || wParam == VK_CONTROL )
|
if ( wParam == VK_SHIFT || wParam == VK_CONTROL )
|
||||||
return Default();
|
return Default();
|
||||||
|
|
||||||
// Avoid duplicate messages to OnChar
|
// Avoid duplicate messages to OnChar for these special keys
|
||||||
if ( (wParam != VK_ESCAPE) && (wParam != VK_SPACE) &&
|
switch ( wParam )
|
||||||
(wParam != VK_RETURN) && (wParam != VK_BACK) &&
|
|
||||||
(wParam != VK_TAB) )
|
|
||||||
{
|
{
|
||||||
|
case VK_ESCAPE:
|
||||||
|
case VK_SPACE:
|
||||||
|
case VK_RETURN:
|
||||||
|
case VK_BACK:
|
||||||
|
case VK_TAB:
|
||||||
|
case VK_LEFT:
|
||||||
|
case VK_RIGHT:
|
||||||
|
case VK_DOWN:
|
||||||
|
case VK_UP:
|
||||||
|
if ( ::GetKeyState(VK_CONTROL) & 0x100 )
|
||||||
|
MSWOnChar((WORD)wParam, lParam);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
MSWOnChar((WORD)wParam, lParam);
|
MSWOnChar((WORD)wParam, lParam);
|
||||||
if ( ::GetKeyState(VK_CONTROL) & 0x100 )
|
if ( ::GetKeyState(VK_CONTROL) & 0x100 )
|
||||||
return Default();
|
return Default();
|
||||||
}
|
|
||||||
else if ( ::GetKeyState(VK_CONTROL) & 0x100 )
|
|
||||||
MSWOnChar((WORD)wParam, lParam);
|
|
||||||
else
|
|
||||||
return Default();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_KEYUP:
|
case WM_KEYUP:
|
||||||
{
|
{
|
||||||
MSWOnKeyUp((WORD) wParam, lParam);
|
MSWOnKeyUp((WORD) wParam, lParam);
|
||||||
@@ -1438,6 +1445,7 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
default:
|
default:
|
||||||
return MSWDefWindowProc(message, wParam, lParam );
|
return MSWDefWindowProc(message, wParam, lParam );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0; // Success: we processed this command.
|
return 0; // Success: we processed this command.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1704,6 +1712,13 @@ bool wxWindow::MSWOnSetFocus(WXHWND WXUNUSED(hwnd))
|
|||||||
::ShowCaret((HWND) GetHWND());
|
::ShowCaret((HWND) GetHWND());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// panel wants to track the window which was the last to have focus in it
|
||||||
|
wxWindow *parent = GetParent();
|
||||||
|
if ( parent && parent->IsKindOf(CLASSINFO(wxPanel)) )
|
||||||
|
{
|
||||||
|
((wxPanel *)parent)->SetLastFocus(this);
|
||||||
|
}
|
||||||
|
|
||||||
wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId);
|
wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
if (!GetEventHandler()->ProcessEvent(event))
|
if (!GetEventHandler()->ProcessEvent(event))
|
||||||
@@ -1929,22 +1944,27 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
|
|||||||
if ( msg->message != WM_KEYDOWN )
|
if ( msg->message != WM_KEYDOWN )
|
||||||
bProcess = FALSE;
|
bProcess = FALSE;
|
||||||
|
|
||||||
if ( (HIWORD(msg->lParam) & KF_ALTDOWN) == KF_ALTDOWN )
|
if ( bProcess && (HIWORD(msg->lParam) & KF_ALTDOWN) == KF_ALTDOWN )
|
||||||
bProcess = FALSE;
|
bProcess = FALSE;
|
||||||
|
|
||||||
|
if ( bProcess )
|
||||||
|
{
|
||||||
bool bCtrlDown = (::GetKeyState(VK_CONTROL) & 0x100) != 0;
|
bool bCtrlDown = (::GetKeyState(VK_CONTROL) & 0x100) != 0;
|
||||||
|
|
||||||
// WM_GETDLGCODE: if the control wants it for itself, don't process it
|
// WM_GETDLGCODE: ask the control if it wants the key for itself,
|
||||||
// (except for Ctrl-Tab/Enter combinations which are always processed)
|
// don't process it if it's the case (except for Ctrl-Tab/Enter
|
||||||
|
// combinations which are always processed)
|
||||||
LONG lDlgCode = 0;
|
LONG lDlgCode = 0;
|
||||||
if ( bProcess && !bCtrlDown ) {
|
if ( !bCtrlDown )
|
||||||
|
{
|
||||||
lDlgCode = ::SendMessage(msg->hwnd, WM_GETDLGCODE, 0, 0);
|
lDlgCode = ::SendMessage(msg->hwnd, WM_GETDLGCODE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bForward = TRUE,
|
bool bForward = TRUE,
|
||||||
bWindowChange = FALSE;
|
bWindowChange = FALSE;
|
||||||
if ( bProcess ) {
|
|
||||||
switch ( msg->wParam ) {
|
switch ( msg->wParam )
|
||||||
|
{
|
||||||
case VK_TAB:
|
case VK_TAB:
|
||||||
if ( lDlgCode & DLGC_WANTTAB ) {
|
if ( lDlgCode & DLGC_WANTTAB ) {
|
||||||
bProcess = FALSE;
|
bProcess = FALSE;
|
||||||
@@ -1971,32 +1991,36 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VK_RETURN:
|
case VK_RETURN:
|
||||||
// if there is a default button, Enter should press it
|
|
||||||
if ( !GetDefaultItem() ) {
|
|
||||||
// but if there is not it makes sense to make it work
|
|
||||||
// like a TAB
|
|
||||||
if ( bCtrlDown || (lDlgCode & DLGC_WANTMESSAGE == 0) )
|
|
||||||
{
|
{
|
||||||
// nothing to do - all variables are already set
|
if ( lDlgCode & DLGC_WANTMESSAGE )
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// control wants to process Enter itself, don't
|
// control wants to process Enter itself, don't
|
||||||
// call IsDialogMessage() which would interpret
|
// call IsDialogMessage() which would interpret
|
||||||
// it
|
// it
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxButton *btnDefault = GetDefaultItem();
|
||||||
|
if ( btnDefault && !bCtrlDown )
|
||||||
|
{
|
||||||
|
// if there is a default button, Enter should
|
||||||
|
// press it
|
||||||
|
(void)::SendMessage((HWND)btnDefault->GetHWND(),
|
||||||
|
BM_CLICK, 0, 0);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
//else: fall through and don't process the message
|
// else: but if there is not it makes sense to make it
|
||||||
|
// work like a TAB - and that's what we do.
|
||||||
|
// Note that Ctrl-Enter always works this way.
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
bProcess = FALSE;
|
bProcess = FALSE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( bProcess ) {
|
if ( bProcess )
|
||||||
|
{
|
||||||
wxNavigationKeyEvent event;
|
wxNavigationKeyEvent event;
|
||||||
event.SetDirection(bForward);
|
event.SetDirection(bForward);
|
||||||
event.SetWindowChange(bWindowChange);
|
event.SetWindowChange(bWindowChange);
|
||||||
@@ -2005,11 +2029,14 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
|
|||||||
if ( GetEventHandler()->ProcessEvent(event) )
|
if ( GetEventHandler()->ProcessEvent(event) )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ::IsDialogMessage((HWND)GetHWND(), msg) != 0;
|
if ( ::IsDialogMessage((HWND)GetHWND(), msg) )
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
else if ( m_tooltip ) {
|
if ( m_tooltip )
|
||||||
|
{
|
||||||
// relay mouse move events to the tooltip control
|
// relay mouse move events to the tooltip control
|
||||||
MSG *msg = (MSG *)pMsg;
|
MSG *msg = (MSG *)pMsg;
|
||||||
if ( msg->message == WM_MOUSEMOVE )
|
if ( msg->message == WM_MOUSEMOVE )
|
||||||
@@ -2232,7 +2259,6 @@ void wxWindow::MSWOnMButtonDown(int x, int y, WXUINT flags)
|
|||||||
|
|
||||||
void wxWindow::MSWOnMButtonUp(int x, int y, WXUINT flags)
|
void wxWindow::MSWOnMButtonUp(int x, int y, WXUINT flags)
|
||||||
{
|
{
|
||||||
//wxDebugMsg("MButtonUp\n") ;
|
|
||||||
wxMouseEvent event(wxEVT_MIDDLE_UP);
|
wxMouseEvent event(wxEVT_MIDDLE_UP);
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
event.m_x = x; event.m_y = y;
|
||||||
@@ -3616,18 +3642,6 @@ WXDWORD wxWindow::Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D)
|
|||||||
|
|
||||||
void wxWindow::OnChar(wxKeyEvent& event)
|
void wxWindow::OnChar(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
if ( event.KeyCode() == WXK_TAB ) {
|
|
||||||
// propagate the TABs to the parent - it's up to it to decide what
|
|
||||||
// to do with it
|
|
||||||
wxWindow *parent = GetParent();
|
|
||||||
if ( parent ) {
|
|
||||||
if ( parent->GetEventHandler()->ProcessEvent(event) )
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // 0
|
|
||||||
|
|
||||||
bool isVirtual;
|
bool isVirtual;
|
||||||
int id = wxCharCodeWXToMSW((int)event.KeyCode(), &isVirtual);
|
int id = wxCharCodeWXToMSW((int)event.KeyCode(), &isVirtual);
|
||||||
|
|
||||||
@@ -3661,7 +3675,7 @@ bool wxWindow::TransferDataToWindow()
|
|||||||
if ( child->GetValidator() && /* child->GetValidator()->Ok() && */
|
if ( child->GetValidator() && /* child->GetValidator()->Ok() && */
|
||||||
!child->GetValidator()->TransferToWindow() )
|
!child->GetValidator()->TransferToWindow() )
|
||||||
{
|
{
|
||||||
wxMessageBox("Application Error", "Could not transfer data to window", wxOK|wxICON_EXCLAMATION);
|
wxLogError(_("Could not transfer data to window"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4043,16 +4057,17 @@ void wxWindow::SetConstraintSizes(bool recurse)
|
|||||||
winName = "unnamed";
|
winName = "unnamed";
|
||||||
else
|
else
|
||||||
winName = GetName();
|
winName = GetName();
|
||||||
wxDebugMsg("Constraint(s) not satisfied for window of type %s, name %s:\n", (const char *)windowClass, (const char *)winName);
|
wxLogDebug("Constraint(s) not satisfied for window of type %s, name %s:",
|
||||||
|
(const char *)windowClass, (const char *)winName);
|
||||||
if (!constr->left.GetDone())
|
if (!constr->left.GetDone())
|
||||||
wxDebugMsg(" unsatisfied 'left' constraint.\n");
|
wxLogDebug(" unsatisfied 'left' constraint.");
|
||||||
if (!constr->right.GetDone())
|
if (!constr->right.GetDone())
|
||||||
wxDebugMsg(" unsatisfied 'right' constraint.\n");
|
wxLogDebug(" unsatisfied 'right' constraint.");
|
||||||
if (!constr->width.GetDone())
|
if (!constr->width.GetDone())
|
||||||
wxDebugMsg(" unsatisfied 'width' constraint.\n");
|
wxLogDebug(" unsatisfied 'width' constraint.");
|
||||||
if (!constr->height.GetDone())
|
if (!constr->height.GetDone())
|
||||||
wxDebugMsg(" unsatisfied 'height' constraint.\n");
|
wxLogDebug(" unsatisfied 'height' constraint.");
|
||||||
wxDebugMsg("Please check constraints: try adding AsIs() constraints.\n");
|
wxLogDebug("Please check constraints: try adding AsIs() constraints.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recurse)
|
if (recurse)
|
||||||
|
68
src/png/makefile.nt
Normal file
68
src/png/makefile.nt
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.nt
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1993
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds winpng.lib library for Windows 3.1
|
||||||
|
|
||||||
|
# Change WXDIR or WXWIN to wherever wxWindows is found
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
WXLIB = $(WXDIR)\lib\wx.lib
|
||||||
|
WXINC = $(WXDIR)\include
|
||||||
|
|
||||||
|
WINPNGDIR = ..\png
|
||||||
|
WINPNGINC = $(WINPNGDIR)
|
||||||
|
WINPNGLIB = ..\..\lib\winpng.lib
|
||||||
|
|
||||||
|
INC = /I..\zlib
|
||||||
|
|
||||||
|
FINAL=1
|
||||||
|
|
||||||
|
# Set this to nothing if your compiler is MS C++ 7
|
||||||
|
ZOPTION=
|
||||||
|
|
||||||
|
!ifndef FINAL
|
||||||
|
FINAL=0
|
||||||
|
!endif
|
||||||
|
|
||||||
|
PRECOMP=/YuWX.H
|
||||||
|
|
||||||
|
!if "$(FINAL)" == "0"
|
||||||
|
OPT = /Od
|
||||||
|
CPPFLAGS= /W4 /Zi /MD /GX- $(ZOPTION) $(OPT) /Dwx_msw $(INC) # $(PRECOMP) /Fp$(WXDIR)\src\msw\wx.pch
|
||||||
|
CFLAGS= /W4 /Zi /MD /GX- /Od /Dwx_msw $(INC)
|
||||||
|
LINKFLAGS=/NOD /CO /ONERROR:NOEXE
|
||||||
|
!else
|
||||||
|
# /Ox for real FINAL version
|
||||||
|
OPT = /O2
|
||||||
|
CPPFLAGS= /W4 /MD /GX- /Dwx_msw $(INC) # $(PRECOMP) /Fp$(WXDIR)\src\msw\wx.pch
|
||||||
|
CFLAGS= /W4 /MD /GX- /Dwx_msw $(INC)
|
||||||
|
LINKFLAGS=/NOD /ONERROR:NOEXE
|
||||||
|
!endif
|
||||||
|
|
||||||
|
OBJECTS = png.obj pngread.obj pngrtran.obj pngrutil.obj \
|
||||||
|
pngpread.obj pngtrans.obj pngwrite.obj pngwtran.obj pngwutil.obj \
|
||||||
|
pngerror.obj pngmem.obj pngwio.obj pngrio.obj pngget.obj pngset.obj
|
||||||
|
|
||||||
|
all: $(WINPNGLIB)
|
||||||
|
|
||||||
|
$(WINPNGLIB): $(OBJECTS)
|
||||||
|
erase $(WINPNGLIB)
|
||||||
|
lib @<<
|
||||||
|
-out:$(WINPNGLIB)
|
||||||
|
$(OBJECTS)
|
||||||
|
<<
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
cl -DWIN32 $(OPT) $(CFLAGS) /c $*.c
|
||||||
|
|
||||||
|
clean:
|
||||||
|
erase *.obj
|
||||||
|
erase *.exe
|
||||||
|
erase *.lib
|
||||||
|
|
||||||
|
cleanall: clean
|
Reference in New Issue
Block a user