- Added wxDC::GradientFillLinear/Concentric().
- Added wxHyperlinkCtrl (Francesco Montorsi).
- Added clipboard events (wxEVT_COMMAND_TEXT_COPY/CUT/PASTE).
+- Added wxTE_FILENAME and wxCB_FILENAME (MSW-only for now)
- Allow to reorder wxGrid columns by drag-and-drop (Santiago Palacios).
- Added wxRadioBox::SetItemToolTip().
- Added support for CMYK JPEG images loading (Robert Wruck).
the event wxEVT\_COMMAND\_TEXT\_ENTER (otherwise pressing Enter key
is either processed internally by the control or used for navigation between
dialog controls). Windows only.}
+\twocolitem{\windowstyle{wxTE\_FILENAME}}{Should be used for the controls
+containing file names. This currently just enables file names auto-completion
+(and only under Windows for now) but can have other effects in the future.}
\end{twocollist}
See also \helpref{window styles overview}{windowstyles}.
\twocolitem{\windowstyle{wxTE\_WORDWRAP}}{Wrap the lines too long to be shown entirely at word boundaries (wxUniv and wxGTK2 only).}
\twocolitem{\windowstyle{wxTE\_BESTWRAP}}{Wrap the lines at word boundaries or at any other character if there are words longer than the window width (this is the default).}
\twocolitem{\windowstyle{wxTE\_CAPITALIZE}}{On PocketPC and Smartphone, causes the first letter to be capitalized.}
+\twocolitem{\windowstyle{wxTE\_FILENAME}}{Should be used for the text controls
+containing file names. This currently just enables file names auto-completion
+(and only under Windows for now) but can have other effects in the future.}
\end{twocollist}
See also \helpref{window styles overview}{windowstyles} and \helpref{wxTextCtrl::wxTextCtrl}{wxtextctrlctor}.
#if wxUSE_COMBOBOX
+/*
+ * wxComboBox style flags
+ */
+#define wxCB_SIMPLE 0x0004
+#define wxCB_SORT 0x0008
+#define wxCB_READONLY 0x0010
+#define wxCB_DROPDOWN 0x0020
+#define wxCB_FILENAME 0x0040
+
extern WXDLLEXPORT_DATA(const wxChar) wxComboBoxNameStr[];
// ----------------------------------------------------------------------------
#define wxPASSWORD 0x0800 /* wxTE_PASSWORD */
#endif
-/*
- * wxComboBox style flags
- */
-#define wxCB_SIMPLE 0x0004
-#define wxCB_SORT 0x0008
-#define wxCB_READONLY 0x0010
-#define wxCB_DROPDOWN 0x0020
-
/*
* wxRadioBox style flags
*/
#include <shlobj.h>
+#include "wx/msw/winundef.h"
+
// ----------------------------------------------------------------------------
// wxItemIdList implements RAII on top of ITEMIDLIST
// ----------------------------------------------------------------------------
DECLARE_NO_COPY_CLASS(wxItemIdList)
};
+// enable autocompleting filenames in the text control with given HWND
+//
+// this only works on systems with shlwapi.dll 5.0 or later
+//
+// implemented in src/msw/utilsgui.cpp
+extern bool wxEnableFileNameAutoComplete(HWND hwnd);
+
#endif // _WX_MSW_WRAPSHL_H_
// if present, intercepts wxPB_USE_TEXTCTRL style and creates the text control
// The 3rd argument is the initial wxString to display in the text control
- bool CreateBase(wxWindow *parent, wxWindowID id,
- const wxString& text = wxEmptyString,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = 0,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxButtonNameStr);
+ bool CreateBase(wxWindow *parent,
+ wxWindowID id,
+ const wxString& text = wxEmptyString,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxValidator& validator = wxDefaultValidator,
+ const wxString& name = wxButtonNameStr,
+ long textstyle = 0);
public: // public API
// wxTextCtrl style flags
// ----------------------------------------------------------------------------
-// the flag bit 0x0001 s free but should be used only for the things which
-// don't make sense for a text control used by wxTextEntryDialog because they
-// would otherwise conflict with wxOK, wxCANCEL, wxCENTRE
-
+#define wxTE_FILENAME 0x0001
#define wxTE_NO_VSCROLL 0x0002
#define wxTE_AUTO_SCROLL 0x0008
// the checkboxes for styles
wxCheckBox *m_chkSort,
- *m_chkReadonly;
+ *m_chkReadonly,
+ *m_chkFilename;
// the combobox itself and the sizer it is in
wxComboBox *m_combobox;
{
// init everything
m_chkSort =
- m_chkReadonly = (wxCheckBox *)NULL;
+ m_chkReadonly =
+ m_chkFilename = (wxCheckBox *)NULL;
m_combobox = (wxComboBox *)NULL;
m_sizerCombo = (wxSizer *)NULL;
m_chkSort = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Sort items"));
m_chkReadonly = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Read only"));
+ m_chkFilename = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&File name"));
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
sizerLeft->Add(m_radioKind, 0, wxGROW | wxALL, 5);
{
m_chkSort->SetValue(false);
m_chkReadonly->SetValue(false);
+ m_chkFilename->SetValue(false);
}
void ComboboxWidgetsPage::CreateCombo()
flags |= wxCB_SORT;
if ( m_chkReadonly->GetValue() )
flags |= wxCB_READONLY;
+ if ( m_chkFilename->GetValue() )
+ flags |= wxCB_FILENAME;
switch ( m_radioKind->GetSelection() )
{
void ComboboxWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
{
- if (m_combobox)
- event.Enable( m_chkSort->GetValue() || m_chkReadonly->GetValue() );
+ event.Enable( m_chkSort->GetValue() ||
+ m_chkReadonly->GetValue() ||
+ m_chkFilename->GetValue() );
}
void ComboboxWidgetsPage::OnUpdateUIInsert(wxUpdateUIEvent& event)
bool password;
bool readonly;
+ bool filename;
WrapStyle wrapStyle;
TextLines_Multi, // multiline
false, // not password
false, // not readonly
+ false, // not filename
WrapStyle_Word, // wrap on word boundaries
#ifdef __WXMSW__
TextKind_Plain // plain EDIT control
// the checkboxes controlling text ctrl styles
wxCheckBox *m_chkPassword,
- *m_chkReadonly;
+ *m_chkReadonly,
+ *m_chkFilename;
// under MSW we test rich edit controls as well here
#ifdef __WXMSW__
m_radioTextLines = (wxRadioBox *)NULL;
m_chkPassword =
- m_chkReadonly = (wxCheckBox *)NULL;
+ m_chkReadonly =
+ m_chkFilename = (wxCheckBox *)NULL;
m_text =
m_textPosCur =
m_chkReadonly = CreateCheckBoxAndAddToSizer(
sizerLeft, _T("&Read-only mode")
);
+ m_chkFilename = CreateCheckBoxAndAddToSizer(
+ sizerLeft, _T("&Filename control")
+ );
sizerLeft->AddSpacer(5);
static const wxString wrap[] =
m_chkPassword->SetValue(DEFAULTS.password);
m_chkReadonly->SetValue(DEFAULTS.readonly);
+ m_chkFilename->SetValue(DEFAULTS.filename);
m_radioWrap->SetSelection(DEFAULTS.wrapStyle);
flags |= wxTE_PASSWORD;
if ( m_chkReadonly->GetValue() )
flags |= wxTE_READONLY;
+ if ( m_chkFilename->GetValue() )
+ flags |= wxTE_FILENAME;
switch ( m_radioWrap->GetSelection() )
{
#ifdef __WXMSW__
(m_radioKind->GetSelection() != DEFAULTS.textKind) ||
#endif // __WXMSW__
- (m_chkReadonly->GetValue() != DEFAULTS.readonly) ||
(m_chkPassword->GetValue() != DEFAULTS.password) ||
+ (m_chkReadonly->GetValue() != DEFAULTS.readonly) ||
+ (m_chkFilename->GetValue() != DEFAULTS.filename) ||
(m_radioWrap->GetSelection() != DEFAULTS.wrapStyle) );
}
// wxFileDirPickerCtrlBase
// ----------------------------------------------------------------------------
-bool wxFileDirPickerCtrlBase::CreateBase( wxWindow *parent, wxWindowID id,
- const wxString &path, const wxString &message,
- const wxString &wildcard,
- const wxPoint &pos, const wxSize &size,
- long style, const wxValidator& validator,
- const wxString &name )
+bool wxFileDirPickerCtrlBase::CreateBase(wxWindow *parent,
+ wxWindowID id,
+ const wxString &path,
+ const wxString &message,
+ const wxString &wildcard,
+ const wxPoint &pos,
+ const wxSize &size,
+ long style,
+ const wxValidator& validator,
+ const wxString &name )
{
wxASSERT_MSG(path.empty() || CheckPath(path), wxT("Invalid initial path!"));
if (!wxPickerBase::CreateBase(parent, id, path, pos, size,
- style, validator, name))
+ style, validator, name, wxTE_FILENAME))
return false;
if (!HasFlag(wxFLP_OPEN) && !HasFlag(wxFLP_SAVE))
const wxSize& size,
long style,
const wxValidator& validator,
- const wxString& name)
+ const wxString& name,
+ long textstyle)
{
// remove any border style from our style as wxPickerBase's window must be
// invisible (user styles must be set on the textctrl or the platform-dependent picker)
// NOTE: the style of this class (wxPickerBase) and the style of the
// attached text control are different: GetTextCtrlStyle() extracts
// the styles related to the textctrl from the styles passed here
- m_text = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition,
- wxDefaultSize, GetTextCtrlStyle(style));
+ m_text = new wxTextCtrl(this, wxID_ANY, wxEmptyString,
+ wxDefaultPosition, wxDefaultSize,
+ GetTextCtrlStyle(style) | textstyle);
if (!m_text)
{
wxFAIL_MSG( wxT("wxPickerBase's textctrl creation failed") );
// include <commctrl.h> "properly"
#include "wx/msw/wrapcctl.h"
+#include "wx/msw/wrapshl.h"
#if wxUSE_TOOLTIPS
#include "wx/tooltip.h"
// edit control, we must subclass it as well
if ( !(style & wxCB_READONLY) )
{
- gs_wndprocEdit = wxSetWindowProc((HWND)GetEditHWND(),
- wxComboEditWndProc);
+ const HWND hwndEdit = (HWND)GetEditHWND();
+
+ gs_wndprocEdit = wxSetWindowProc(hwndEdit, wxComboEditWndProc);
+
+ if ( style & wxCB_FILENAME )
+ {
+ wxEnableFileNameAutoComplete(hwndEdit);
+ }
}
// and finally, show the control
#include <windowsx.h>
#include "wx/msw/private.h"
-#include "wx/msw/winundef.h"
+#include "wx/msw/wrapshl.h"
#include <string.h>
#include <stdlib.h>
}
#endif // wxUSE_RICHEDIT
+ if ( style & wxTE_FILENAME )
+ wxEnableFileNameAutoComplete(GetHwnd());
+
gs_wndprocEdit = wxSetWindowProc((HWND)GetHwnd(),
wxTextCtrlWndProc);
#include "wx/utils.h"
#endif //WX_PRECOMP
+#include "wx/dynlib.h"
+
#include "wx/msw/private.h" // includes <windows.h>
// ============================================================================
}
+// ----------------------------------------------------------------------------
+// Shell API wrappers
+// ----------------------------------------------------------------------------
+
+extern bool wxEnableFileNameAutoComplete(HWND hwnd)
+{
+ typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD);
+
+ static SHAutoComplete_t s_pfnSHAutoComplete = NULL;
+ static bool s_initialized = false;
+
+ if ( !s_initialized )
+ {
+ s_initialized = true;
+
+ wxLogNull nolog;
+ wxDynamicLibrary dll(_T("shlwapi.dll"));
+ if ( dll.IsLoaded() )
+ {
+ s_pfnSHAutoComplete =
+ (SHAutoComplete_t)dll.GetSymbol(_T("SHAutoComplete"));
+ if ( s_pfnSHAutoComplete )
+ {
+ // won't be unloaded until the process termination, no big deal
+ dll.Detach();
+ }
+ }
+ }
+
+ if ( !s_pfnSHAutoComplete )
+ return false;
+
+ HRESULT hr = s_pfnSHAutoComplete(hwnd, 0x10 /* SHACF_FILESYS_ONLY */);
+ if ( FAILED(hr) )
+ {
+ wxLogApiError(_T("SHAutoComplete"), hr);
+ return false;
+ }
+
+ return true;
+}
+
/////////////////////////////////////////////////////////////////////////////
// Name: src/xrc/xh_combo.cpp
-// Purpose: XRC resource for wxRadioBox
+// Purpose: XRC resource for wxComboBox
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
XRC_ADD_STYLE(wxCB_SORT);
XRC_ADD_STYLE(wxCB_READONLY);
XRC_ADD_STYLE(wxCB_DROPDOWN);
+ XRC_ADD_STYLE(wxCB_FILENAME);
AddWindowStyles();
}
wxTextCtrlXmlHandler::wxTextCtrlXmlHandler() : wxXmlResourceHandler()
{
+ XRC_ADD_STYLE(wxTE_FILENAME);
XRC_ADD_STYLE(wxTE_NO_VSCROLL);
XRC_ADD_STYLE(wxTE_AUTO_SCROLL);
XRC_ADD_STYLE(wxTE_PROCESS_ENTER);