1. added wxGTK::wxToolBar::SetToolShortHelp() and test for it in sample
2. fix a crash if SetSelection is called too early in wxTextCtrl 3. patch for mouse position in wxTreeCtrl events git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8805 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -52,6 +52,8 @@ public:
|
|||||||
|
|
||||||
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
|
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
|
||||||
|
|
||||||
|
virtual void SetToolShortHelp(int id, const wxString& helpString);
|
||||||
|
|
||||||
// implementation from now on
|
// implementation from now on
|
||||||
// --------------------------
|
// --------------------------
|
||||||
|
|
||||||
|
@@ -52,6 +52,8 @@ public:
|
|||||||
|
|
||||||
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
|
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
|
||||||
|
|
||||||
|
virtual void SetToolShortHelp(int id, const wxString& helpString);
|
||||||
|
|
||||||
// implementation from now on
|
// implementation from now on
|
||||||
// --------------------------
|
// --------------------------
|
||||||
|
|
||||||
|
@@ -35,12 +35,12 @@
|
|||||||
|
|
||||||
// what to test (in alphabetic order)?
|
// what to test (in alphabetic order)?
|
||||||
|
|
||||||
#define TEST_ARRAYS
|
//#define TEST_ARRAYS
|
||||||
//#define TEST_CMDLINE
|
//#define TEST_CMDLINE
|
||||||
//#define TEST_DATETIME
|
//#define TEST_DATETIME
|
||||||
//#define TEST_DIR
|
//#define TEST_DIR
|
||||||
//#define TEST_DLLLOADER
|
//#define TEST_DLLLOADER
|
||||||
//#define TEST_EXECUTE
|
#define TEST_EXECUTE
|
||||||
//#define TEST_FILE
|
//#define TEST_FILE
|
||||||
//#define TEST_FILECONF
|
//#define TEST_FILECONF
|
||||||
//#define TEST_HASH
|
//#define TEST_HASH
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
//#define TEST_LONGLONG
|
//#define TEST_LONGLONG
|
||||||
//#define TEST_MIME
|
//#define TEST_MIME
|
||||||
//#define TEST_INFO_FUNCTIONS
|
//#define TEST_INFO_FUNCTIONS
|
||||||
#define TEST_REGISTRY
|
//#define TEST_REGISTRY
|
||||||
//#define TEST_SOCKETS
|
//#define TEST_SOCKETS
|
||||||
//#define TEST_STREAMS
|
//#define TEST_STREAMS
|
||||||
//#define TEST_STRINGS
|
//#define TEST_STRINGS
|
||||||
@@ -296,9 +296,9 @@ static void TestExecute()
|
|||||||
puts("*** testing wxExecute ***");
|
puts("*** testing wxExecute ***");
|
||||||
|
|
||||||
#ifdef __UNIX__
|
#ifdef __UNIX__
|
||||||
#define COMMAND "echo hi"
|
#define COMMAND "cat -n ../../Makefile" // "echo hi"
|
||||||
#define SHELL_COMMAND "echo hi from shell"
|
#define SHELL_COMMAND "echo hi from shell"
|
||||||
#define REDIRECT_COMMAND "date"
|
#define REDIRECT_COMMAND COMMAND // "date"
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
#define COMMAND "command.com -c 'echo hi'"
|
#define COMMAND "command.com -c 'echo hi'"
|
||||||
#define SHELL_COMMAND "echo hi"
|
#define SHELL_COMMAND "echo hi"
|
||||||
|
@@ -175,8 +175,11 @@ private:
|
|||||||
void UpdateStatusBar(const wxPoint& pos, const wxSize& size)
|
void UpdateStatusBar(const wxPoint& pos, const wxSize& size)
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf(_("pos=(%d, %d), size=%dx%d"),
|
wxSize sizeCl = GetClientSize();
|
||||||
pos.x, pos.y, size.x, size.y);
|
msg.Printf(_("pos=(%d, %d), size=%dx%d (client=%dx%d)"),
|
||||||
|
pos.x, pos.y,
|
||||||
|
size.x, size.y,
|
||||||
|
sizeCl.x, sizeCl.y);
|
||||||
SetStatusText(msg, 1);
|
SetStatusText(msg, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -109,6 +109,7 @@ public:
|
|||||||
void OnEnablePrint(wxCommandEvent& WXUNUSED(event)) { DoEnablePrint(); }
|
void OnEnablePrint(wxCommandEvent& WXUNUSED(event)) { DoEnablePrint(); }
|
||||||
void OnDeletePrint(wxCommandEvent& WXUNUSED(event)) { DoDeletePrint(); }
|
void OnDeletePrint(wxCommandEvent& WXUNUSED(event)) { DoDeletePrint(); }
|
||||||
void OnInsertPrint(wxCommandEvent& event);
|
void OnInsertPrint(wxCommandEvent& event);
|
||||||
|
void OnChangeToolTip(wxCommandEvent& event);
|
||||||
void OnToggleHelp(wxCommandEvent& WXUNUSED(event)) { DoToggleHelp(); }
|
void OnToggleHelp(wxCommandEvent& WXUNUSED(event)) { DoToggleHelp(); }
|
||||||
|
|
||||||
void OnToolLeftClick(wxCommandEvent& event);
|
void OnToolLeftClick(wxCommandEvent& event);
|
||||||
@@ -161,6 +162,7 @@ enum
|
|||||||
IDM_TOOLBAR_TOGGLEHELP,
|
IDM_TOOLBAR_TOGGLEHELP,
|
||||||
IDM_TOOLBAR_TOGGLEFULLSCREEN,
|
IDM_TOOLBAR_TOGGLEFULLSCREEN,
|
||||||
IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR,
|
IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR,
|
||||||
|
IDM_TOOLBAR_CHANGE_TOOLTIP,
|
||||||
|
|
||||||
ID_COMBO = 1000
|
ID_COMBO = 1000
|
||||||
};
|
};
|
||||||
@@ -189,6 +191,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_MENU(IDM_TOOLBAR_INSERTPRINT, MyFrame::OnInsertPrint)
|
EVT_MENU(IDM_TOOLBAR_INSERTPRINT, MyFrame::OnInsertPrint)
|
||||||
EVT_MENU(IDM_TOOLBAR_TOGGLEHELP, MyFrame::OnToggleHelp)
|
EVT_MENU(IDM_TOOLBAR_TOGGLEHELP, MyFrame::OnToggleHelp)
|
||||||
EVT_MENU(IDM_TOOLBAR_TOGGLEFULLSCREEN, MyFrame::OnToggleFullScreen)
|
EVT_MENU(IDM_TOOLBAR_TOGGLEFULLSCREEN, MyFrame::OnToggleFullScreen)
|
||||||
|
EVT_MENU(IDM_TOOLBAR_CHANGE_TOOLTIP, MyFrame::OnChangeToolTip)
|
||||||
|
|
||||||
EVT_MENU(-1, MyFrame::OnToolLeftClick)
|
EVT_MENU(-1, MyFrame::OnToolLeftClick)
|
||||||
|
|
||||||
@@ -378,11 +381,10 @@ MyFrame::MyFrame(wxFrame* parent,
|
|||||||
tbarMenu->Append(IDM_TOOLBAR_DELETEPRINT, "&Delete print button\tCtrl-D", "");
|
tbarMenu->Append(IDM_TOOLBAR_DELETEPRINT, "&Delete print button\tCtrl-D", "");
|
||||||
tbarMenu->Append(IDM_TOOLBAR_INSERTPRINT, "&Insert print button\tCtrl-I", "");
|
tbarMenu->Append(IDM_TOOLBAR_INSERTPRINT, "&Insert print button\tCtrl-I", "");
|
||||||
tbarMenu->Append(IDM_TOOLBAR_TOGGLEHELP, "Toggle &help button\tCtrl-T", "");
|
tbarMenu->Append(IDM_TOOLBAR_TOGGLEHELP, "Toggle &help button\tCtrl-T", "");
|
||||||
|
tbarMenu->AppendSeparator();
|
||||||
#ifdef __WXMSW__
|
tbarMenu->Append(IDM_TOOLBAR_CHANGE_TOOLTIP, "Change tool tip", "");
|
||||||
tbarMenu->AppendSeparator();
|
tbarMenu->AppendSeparator();
|
||||||
tbarMenu->Append(IDM_TOOLBAR_TOGGLEFULLSCREEN, "Toggle &full screen mode\tCtrl-F", "");
|
tbarMenu->Append(IDM_TOOLBAR_TOGGLEFULLSCREEN, "Toggle &full screen mode\tCtrl-F", "");
|
||||||
#endif
|
|
||||||
|
|
||||||
wxMenu *fileMenu = new wxMenu;
|
wxMenu *fileMenu = new wxMenu;
|
||||||
fileMenu->Append(wxID_EXIT, "E&xit", "Quit toolbar sample" );
|
fileMenu->Append(wxID_EXIT, "E&xit", "Quit toolbar sample" );
|
||||||
@@ -567,6 +569,11 @@ void MyFrame::OnUpdateCopyAndCut(wxUpdateUIEvent& event)
|
|||||||
event.Enable( m_textWindow->CanCopy() );
|
event.Enable( m_textWindow->CanCopy() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnChangeToolTip(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
GetToolBar()->SetToolShortHelp(wxID_NEW, _T("New toolbar button"));
|
||||||
|
}
|
||||||
|
|
||||||
void MyFrame::OnInsertPrint(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnInsertPrint(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxBitmap bmp = wxBITMAP(print);
|
wxBitmap bmp = wxBITMAP(print);
|
||||||
|
@@ -506,6 +506,18 @@ void wxToolBar::SetToolSeparation( int separation )
|
|||||||
m_toolSeparation = separation;
|
m_toolSeparation = separation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
|
||||||
|
{
|
||||||
|
wxToolBarTool *tool = (wxToolBarTool *)FindById(id);
|
||||||
|
|
||||||
|
if ( tool )
|
||||||
|
{
|
||||||
|
(void)tool->SetShortHelp(helpString);
|
||||||
|
gtk_tooltips_set_tip(m_toolbar->tooltips, tool->m_item,
|
||||||
|
helpString.mbc_str(), "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxToolBar idle handling
|
// wxToolBar idle handling
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -555,4 +567,4 @@ void wxToolBar::OnInternalIdle()
|
|||||||
UpdateWindowUI();
|
UpdateWindowUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // wxUSE_TOOLBAR_NATIVE
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
|
#include "wx/log.h"
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -646,6 +647,14 @@ void wxTextCtrl::SetSelection( long from, long to )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
||||||
|
|
||||||
|
if ( (m_windowStyle & wxTE_MULTILINE) &&
|
||||||
|
!GTK_TEXT(m_text)->line_start_cache )
|
||||||
|
{
|
||||||
|
// tell the programmer that it didn't work
|
||||||
|
wxLogDebug(_T("Can't call SetSelection() before realizing the control"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
|
gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -506,6 +506,18 @@ void wxToolBar::SetToolSeparation( int separation )
|
|||||||
m_toolSeparation = separation;
|
m_toolSeparation = separation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
|
||||||
|
{
|
||||||
|
wxToolBarTool *tool = (wxToolBarTool *)FindById(id);
|
||||||
|
|
||||||
|
if ( tool )
|
||||||
|
{
|
||||||
|
(void)tool->SetShortHelp(helpString);
|
||||||
|
gtk_tooltips_set_tip(m_toolbar->tooltips, tool->m_item,
|
||||||
|
helpString.mbc_str(), "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxToolBar idle handling
|
// wxToolBar idle handling
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -555,4 +567,4 @@ void wxToolBar::OnInternalIdle()
|
|||||||
UpdateWindowUI();
|
UpdateWindowUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // wxUSE_TOOLBAR_NATIVE
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
|
#include "wx/log.h"
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -646,6 +647,14 @@ void wxTextCtrl::SetSelection( long from, long to )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
||||||
|
|
||||||
|
if ( (m_windowStyle & wxTE_MULTILINE) &&
|
||||||
|
!GTK_TEXT(m_text)->line_start_cache )
|
||||||
|
{
|
||||||
|
// tell the programmer that it didn't work
|
||||||
|
wxLogDebug(_T("Can't call SetSelection() before realizing the control"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
|
gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1540,6 +1540,8 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
|||||||
{
|
{
|
||||||
eventType = wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK;
|
eventType = wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK;
|
||||||
event.m_itemIndex = lvhti.iItem;
|
event.m_itemIndex = lvhti.iItem;
|
||||||
|
event.m_pointDrag.x = lvhti.pt.x;
|
||||||
|
event.m_pointDrag.y = lvhti.pt.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user