]> git.saurik.com Git - wxWidgets.git/blob - include/wx/stc/private.h
Return correct index from wxGenericListCtrl::InsertColumn().
[wxWidgets.git] / include / wx / stc / private.h
1 ////////////////////////////////////////////////////////////////////////////
2 // Name: wx/stc/private.h
3 // Purpose: Private declarations for wxSTC
4 // Author: Robin Dunn
5 // Created: 2007-07-15
6 // RCS-ID: $Id$
7 // Copyright: (c) 2000 by Total Control Software
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_STC_PRIVATE_H_
12 #define _WX_STC_PRIVATE_H_
13
14 #include "wx/defs.h"
15 #include "wx/string.h"
16
17 //----------------------------------------------------------------------
18 // Utility functions used within wxSTC
19
20 #if wxUSE_UNICODE
21
22 extern wxString stc2wx(const char* str);
23 extern wxString stc2wx(const char* str, size_t len);
24 extern wxCharBuffer wx2stc(const wxString& str);
25
26 // This function takes both wxString and wxCharBuffer because it uses either
27 // one or the other of them depending on the build mode. In Unicode it uses the
28 // length of the already converted buffer to avoid doing the conversion again
29 // just to compute the length.
30 inline size_t wx2stclen(const wxString& WXUNUSED(str), const wxCharBuffer& buf)
31 {
32 return buf.length() - 1;
33 }
34
35 #else // not UNICODE
36
37 inline wxString stc2wx(const char* str) {
38 return wxString(str);
39 }
40 inline wxString stc2wx(const char* str, size_t len) {
41 return wxString(str, len);
42 }
43 inline const char* wx2stc(const wxString& str) {
44 return str.mbc_str();
45 }
46
47 // As explained above, the buffer argument is only used in Unicode build.
48 inline size_t wx2stclen(const wxString& str, const char* WXUNUSED(buf))
49 {
50 return str.length();
51 }
52
53 #endif // UNICODE
54
55 #endif // _WX_STC_PRIVATE_H_