]> git.saurik.com Git - wxWidgets.git/blame - include/wx/stc/private.h
avoid creating and immediately destroying a wxGraphicsContext when creating a wxDC...
[wxWidgets.git] / include / wx / stc / private.h
CommitLineData
ea88e9bc
VS
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
526954c5 8// Licence: wxWindows licence
ea88e9bc
VS
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
22extern wxString stc2wx(const char* str);
23extern wxString stc2wx(const char* str, size_t len);
2ed48ef8 24extern wxCharBuffer wx2stc(const wxString& str);
ea88e9bc 25
d7b46878
VZ
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.
30inline size_t wx2stclen(const wxString& WXUNUSED(str), const wxCharBuffer& buf)
31{
32 return buf.length() - 1;
33}
34
ea88e9bc
VS
35#else // not UNICODE
36
37inline wxString stc2wx(const char* str) {
38 return wxString(str);
39}
40inline wxString stc2wx(const char* str, size_t len) {
41 return wxString(str, len);
42}
2ed48ef8 43inline const char* wx2stc(const wxString& str) {
ea88e9bc
VS
44 return str.mbc_str();
45}
46
d7b46878
VZ
47// As explained above, the buffer argument is only used in Unicode build.
48inline size_t wx2stclen(const wxString& str, const char* WXUNUSED(buf))
49{
50 return str.length();
51}
52
ea88e9bc
VS
53#endif // UNICODE
54
55#endif // _WX_STC_PRIVATE_H_