m_windowStyle |= wxTE_READONLY;
if (style & ES_WANTRETURN)
m_windowStyle |= wxTE_PROCESS_ENTER;
+ if (style & ES_CENTER)
+ m_windowStyle |= wxTE_CENTRE;
+ if (style & ES_RIGHT)
+ m_windowStyle |= wxTE_RIGHT;
}
WXDWORD wxTextCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
if ( style & wxTE_NOHIDESEL )
msStyle |= ES_NOHIDESEL;
+ if ( style & wxTE_CENTRE )
+ msStyle |= ES_CENTER;
+
+ if ( style & wxTE_RIGHT )
+ msStyle |= ES_RIGHT;
+
return msStyle;
}
extern long wxEncodingToCodepage(wxFontEncoding encoding); // from utils.cpp
+#ifdef __WXWINE__
+bool wxTextCtrl::StreamIn(const wxString& value,
+ wxFontEncoding WXUNUSED(encoding),
+ bool selectionOnly)
+{
+ return FALSE;
+}
+#else
+
#if wxUSE_UNICODE_MSLU
bool wxTextCtrl::StreamIn(const wxString& value,
wxFontEncoding WXUNUSED(encoding),
return TRUE;
}
+#endif
+ // __WXWINE__
+
#endif // wxUSE_RICHEDIT
void wxTextCtrl::WriteText(const wxString& value)
}
#endif // wxUSE_UNICODE_MSLU
-#if !wxUSE_UNICODE
+#if !wxUSE_UNICODE && !defined(__WXWINE__)
// next check if the text we're inserting must be shown in a non
// default charset -- this only works for RichEdit > 1.0
if ( GetRichVersion() > 1 )
}
else // no Alt
{
- if ( wxIsCtrlDown() )
- {
- switch ( vkey )
- {
- case 'C':
- case 'V':
- case 'X':
- case VK_INSERT:
- case VK_DELETE:
- case VK_HOME:
- case VK_END:
- return FALSE;
- }
- }
- else if ( wxIsShiftDown() )
+ // we want to process some Ctrl-foo and Shift-bar but no key
+ // combinations without either Ctrl or Shift nor with both of them
+ // pressed
+ const int ctrl = wxIsCtrlDown(),
+ shift = wxIsShiftDown();
+ switch ( ctrl + shift )
{
- if ( vkey == VK_INSERT || vkey == VK_DELETE )
- return FALSE;
+ default:
+ wxFAIL_MSG( _T("how many modifiers have we got?") );
+ // fall through
+
+ case 0:
+ case 2:
+ break;
+
+ case 1:
+ // either Ctrl or Shift pressed
+ if ( ctrl )
+ {
+ switch ( vkey )
+ {
+ case 'C':
+ case 'V':
+ case 'X':
+ case VK_INSERT:
+ case VK_DELETE:
+ case VK_HOME:
+ case VK_END:
+ return FALSE;
+ }
+ }
+ else // Shift is pressed
+ {
+ if ( vkey == VK_INSERT || vkey == VK_DELETE )
+ return FALSE;
+ }
}
}
}
if ( nMsg == WM_GETDLGCODE )
{
- // we always want the chars and the arrows
- long lDlgCode = DLGC_WANTCHARS | DLGC_WANTARROWS;
-
- // we may have several different cases:
- // 1. normal case: both TAB and ENTER are used for dialog navigation
- // 2. ctrl which wants TAB for itself: ENTER is used to pass to the
- // next control in the dialog
- // 3. ctrl which wants ENTER for itself: TAB is used for dialog
- // navigation
- // 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to pass
- // to the next control
-
- // the multiline edit control should always get <Return> for itself
- if ( HasFlag(wxTE_PROCESS_ENTER) || HasFlag(wxTE_MULTILINE) )
- lDlgCode |= DLGC_WANTMESSAGE;
-
- if ( HasFlag(wxTE_PROCESS_TAB) )
- lDlgCode |= DLGC_WANTTAB;
-
- lRc |= lDlgCode;
+ if ( IsEditable() )
+ {
+ // we always want the chars and the arrows
+ long lDlgCode = DLGC_WANTCHARS | DLGC_WANTARROWS;
+
+ // we may have several different cases:
+ // 1. normal case: both TAB and ENTER are used for dlg navigation
+ // 2. ctrl which wants TAB for itself: ENTER is used to pass to the
+ // next control in the dialog
+ // 3. ctrl which wants ENTER for itself: TAB is used for dialog
+ // navigation
+ // 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to go
+ // to the next control
+
+ // the multiline edit control should always get <Return> for itself
+ if ( HasFlag(wxTE_PROCESS_ENTER) || HasFlag(wxTE_MULTILINE) )
+ lDlgCode |= DLGC_WANTMESSAGE;
+
+ if ( HasFlag(wxTE_PROCESS_TAB) )
+ lDlgCode |= DLGC_WANTTAB;
+
+ lRc |= lDlgCode;
+ }
+ else // !editable
+ {
+ // when the control can't be edited by user, it doesn't need any
+ // extra keys changing its contents at all -- but it still needs
+ // the arrows to allow navigating in it
+ //
+ // NB: use "=", not "|=" as the base class version returns the
+ // same flags is this state as usual (i.e. including
+ // DLGC_WANTMESSAGE). This is strange (how does it work in the
+ // native Win32 apps?) but for now live with it.
+ lRc = DLGC_WANTARROWS;
+ }
}
return lRc;
bool wxTextCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
+#ifndef __WXWINE__
NMHDR *hdr = (NMHDR* )lParam;
switch ( hdr->code )
{
- case EN_MSGFILTER:
+ case EN_MSGFILTER:
{
const MSGFILTER *msgf = (MSGFILTER *)lParam;
UINT msg = msgf->msg;
}
return TRUE;
}
-
+#endif
+
// not processed, leave it to the base class
return wxTextCtrlBase::MSWOnNotify(idCtrl, lParam, result);
}
bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
{
+#ifdef __WXWINE__
+ return FALSE;
+#else
if ( !IsRich() )
{
// can't do it with normal text control
}
return ok;
+#endif
}
bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style)