virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
+ virtual void SetToolShortHelp(int id, const wxString& helpString);
+
// implementation from now on
// --------------------------
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
+ virtual void SetToolShortHelp(int id, const wxString& helpString);
+
// implementation from now on
// --------------------------
// what to test (in alphabetic order)?
-#define TEST_ARRAYS
+//#define TEST_ARRAYS
//#define TEST_CMDLINE
//#define TEST_DATETIME
//#define TEST_DIR
//#define TEST_DLLLOADER
-//#define TEST_EXECUTE
+#define TEST_EXECUTE
//#define TEST_FILE
//#define TEST_FILECONF
//#define TEST_HASH
//#define TEST_LONGLONG
//#define TEST_MIME
//#define TEST_INFO_FUNCTIONS
-#define TEST_REGISTRY
+//#define TEST_REGISTRY
//#define TEST_SOCKETS
//#define TEST_STREAMS
//#define TEST_STRINGS
puts("*** testing wxExecute ***");
#ifdef __UNIX__
- #define COMMAND "echo hi"
+ #define COMMAND "cat -n ../../Makefile" // "echo hi"
#define SHELL_COMMAND "echo hi from shell"
- #define REDIRECT_COMMAND "date"
+ #define REDIRECT_COMMAND COMMAND // "date"
#elif defined(__WXMSW__)
#define COMMAND "command.com -c 'echo hi'"
#define SHELL_COMMAND "echo hi"
void UpdateStatusBar(const wxPoint& pos, const wxSize& size)
{
wxString msg;
- msg.Printf(_("pos=(%d, %d), size=%dx%d"),
- pos.x, pos.y, size.x, size.y);
+ wxSize sizeCl = GetClientSize();
+ 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);
}
void OnEnablePrint(wxCommandEvent& WXUNUSED(event)) { DoEnablePrint(); }
void OnDeletePrint(wxCommandEvent& WXUNUSED(event)) { DoDeletePrint(); }
void OnInsertPrint(wxCommandEvent& event);
+ void OnChangeToolTip(wxCommandEvent& event);
void OnToggleHelp(wxCommandEvent& WXUNUSED(event)) { DoToggleHelp(); }
void OnToolLeftClick(wxCommandEvent& event);
IDM_TOOLBAR_TOGGLEHELP,
IDM_TOOLBAR_TOGGLEFULLSCREEN,
IDM_TOOLBAR_TOGGLE_ANOTHER_TOOLBAR,
+ IDM_TOOLBAR_CHANGE_TOOLTIP,
ID_COMBO = 1000
};
EVT_MENU(IDM_TOOLBAR_INSERTPRINT, MyFrame::OnInsertPrint)
EVT_MENU(IDM_TOOLBAR_TOGGLEHELP, MyFrame::OnToggleHelp)
EVT_MENU(IDM_TOOLBAR_TOGGLEFULLSCREEN, MyFrame::OnToggleFullScreen)
+ EVT_MENU(IDM_TOOLBAR_CHANGE_TOOLTIP, MyFrame::OnChangeToolTip)
EVT_MENU(-1, MyFrame::OnToolLeftClick)
tbarMenu->Append(IDM_TOOLBAR_DELETEPRINT, "&Delete print button\tCtrl-D", "");
tbarMenu->Append(IDM_TOOLBAR_INSERTPRINT, "&Insert print button\tCtrl-I", "");
tbarMenu->Append(IDM_TOOLBAR_TOGGLEHELP, "Toggle &help button\tCtrl-T", "");
-
-#ifdef __WXMSW__
+ tbarMenu->AppendSeparator();
+ tbarMenu->Append(IDM_TOOLBAR_CHANGE_TOOLTIP, "Change tool tip", "");
tbarMenu->AppendSeparator();
tbarMenu->Append(IDM_TOOLBAR_TOGGLEFULLSCREEN, "Toggle &full screen mode\tCtrl-F", "");
-#endif
wxMenu *fileMenu = new wxMenu;
fileMenu->Append(wxID_EXIT, "E&xit", "Quit toolbar sample" );
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))
{
wxBitmap bmp = wxBITMAP(print);
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
// ----------------------------------------------------------------------------
UpdateWindowUI();
}
-#endif
+#endif // wxUSE_TOOLBAR_NATIVE
#include "wx/textctrl.h"
#include "wx/utils.h"
#include "wx/intl.h"
+#include "wx/log.h"
#include "wx/settings.h"
#include <sys/types.h>
{
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 );
}
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
// ----------------------------------------------------------------------------
UpdateWindowUI();
}
-#endif
+#endif // wxUSE_TOOLBAR_NATIVE
#include "wx/textctrl.h"
#include "wx/utils.h"
#include "wx/intl.h"
+#include "wx/log.h"
#include "wx/settings.h"
#include <sys/types.h>
{
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 );
}
{
eventType = wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK;
event.m_itemIndex = lvhti.iItem;
+ event.m_pointDrag.x = lvhti.pt.x;
+ event.m_pointDrag.y = lvhti.pt.y;
}
}
}