]> git.saurik.com Git - wxWidgets.git/blame - src/common/ipcbase.cpp
generate key events for Space/Enter in addition to the activate events, as wxMSW...
[wxWidgets.git] / src / common / ipcbase.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: ipcbase.cpp
3// Purpose: IPC base classes
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "ipcbase.h"
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20#pragma hdrstop
21#endif
22
23#ifndef WX_PRECOMP
24#include "wx/defs.h"
25#endif
26
27#include "wx/ipcbase.h"
28
c801d85f
KB
29IMPLEMENT_CLASS(wxServerBase, wxObject)
30IMPLEMENT_CLASS(wxClientBase, wxObject)
31IMPLEMENT_CLASS(wxConnectionBase, wxObject)
c801d85f 32
44379ce6 33wxConnectionBase::wxConnectionBase(wxChar *buffer, int size)
bbcd408a
JS
34 : m_connected(true),
35 m_buffer(buffer),
36 m_buffersize(size),
37 m_deletebufferwhendone(false)
44379ce6
JS
38{
39 if ( buffer == (wxChar *)NULL )
40 { // behave like next constructor
41 m_buffersize = 0;
42 m_deletebufferwhendone = true;
43 }
44}
45
46wxConnectionBase::wxConnectionBase()
bbcd408a
JS
47 : m_connected(true),
48 m_buffer(NULL),
49 m_buffersize(0),
50 m_deletebufferwhendone(true)
44379ce6
JS
51{
52}
53
54wxConnectionBase::wxConnectionBase(wxConnectionBase& copy)
bbcd408a
JS
55 : m_connected(copy.m_connected),
56 m_buffer(copy.m_buffer),
57 m_buffersize(copy.m_buffersize),
58 m_deletebufferwhendone(false)
59
44379ce6
JS
60{
61 // copy constructor would require ref-counted pointer to buffer
62 wxFAIL_MSG( _T("Copy constructor of wxConnectionBase not implemented") );
63}
64
65
66wxConnectionBase::~wxConnectionBase(void)
67{
68 if ( m_deletebufferwhendone && m_buffer )
69 delete m_buffer;
70}
71
72wxChar *wxConnectionBase::GetBufferAtLeast( size_t bytes )
73{
74 if ( m_buffersize >= bytes )
75 return m_buffer;
76 else
77 { // need to resize buffer
78 if ( m_deletebufferwhendone )
79 { // we're in charge of buffer, increase it
80 if ( !m_buffer )
81 delete m_buffer;
82 m_buffer = new wxChar[bytes];
83 m_buffersize = bytes;
84 return m_buffer;
85 } // user-supplied buffer, fail
86 else
87 return NULL;
88 }
89}
c801d85f 90