]> git.saurik.com Git - wxWidgets.git/blame - src/msw/statline.cpp
fix memory leak (coverity checker CID 53)
[wxWidgets.git] / src / msw / statline.cpp
CommitLineData
c50f1fb9
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: msw/statline.cpp
3// Purpose: MSW version of wxStaticLine class
4// Author: Vadim Zeitlin
5// Created: 28.06.99
6// Version: $Id$
7// Copyright: (c) 1998 Vadim Zeitlin
65571936 8// Licence: wxWindows licence
c50f1fb9
VZ
9/////////////////////////////////////////////////////////////////////////////
10
11// ============================================================================
12// declarations
13// ============================================================================
14
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
c50f1fb9
VZ
19// For compilers that support precompilation, includes "wx.h".
20#include "wx/wxprec.h"
21
22#ifdef __BORLANDC__
23 #pragma hdrstop
24#endif
25
26#include "wx/statline.h"
27
f3c0f9e7
JS
28#if wxUSE_STATLINE
29
c50f1fb9 30#include "wx/msw/private.h"
48beac4c 31#include "wx/msw/missing.h"
cc4f5ad8 32
c50f1fb9
VZ
33// ============================================================================
34// implementation
35// ============================================================================
36
bc9fb572
JS
37#if wxUSE_EXTENDED_RTTI
38WX_DEFINE_FLAGS( wxStaticLineStyle )
39
3ff066a4 40wxBEGIN_FLAGS( wxStaticLineStyle )
bc9fb572
JS
41 // new style border flags, we put them first to
42 // use them for streaming out
3ff066a4
SC
43 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
44 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
45 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
46 wxFLAGS_MEMBER(wxBORDER_RAISED)
47 wxFLAGS_MEMBER(wxBORDER_STATIC)
48 wxFLAGS_MEMBER(wxBORDER_NONE)
57f4f925 49
bc9fb572 50 // old style border flags
3ff066a4
SC
51 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
52 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
53 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
54 wxFLAGS_MEMBER(wxRAISED_BORDER)
55 wxFLAGS_MEMBER(wxSTATIC_BORDER)
cb0afb26 56 wxFLAGS_MEMBER(wxBORDER)
bc9fb572
JS
57
58 // standard window styles
3ff066a4
SC
59 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
60 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
61 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
62 wxFLAGS_MEMBER(wxWANTS_CHARS)
cb0afb26 63 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
3ff066a4
SC
64 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
65 wxFLAGS_MEMBER(wxVSCROLL)
66 wxFLAGS_MEMBER(wxHSCROLL)
bc9fb572 67
3ff066a4
SC
68 wxFLAGS_MEMBER(wxLI_HORIZONTAL)
69 wxFLAGS_MEMBER(wxLI_VERTICAL)
bc9fb572 70
3ff066a4 71wxEND_FLAGS( wxStaticLineStyle )
bc9fb572
JS
72
73IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticLine, wxControl,"wx/statline.h")
74
3ff066a4 75wxBEGIN_PROPERTIES_TABLE(wxStaticLine)
af498247 76 wxPROPERTY_FLAGS( WindowStyle , wxStaticLineStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
3ff066a4 77wxEND_PROPERTIES_TABLE()
bc9fb572 78
3ff066a4
SC
79wxBEGIN_HANDLERS_TABLE(wxStaticLine)
80wxEND_HANDLERS_TABLE()
bc9fb572 81
3ff066a4 82wxCONSTRUCTOR_5( wxStaticLine, wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle)
bc9fb572
JS
83
84#else
c50f1fb9 85IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
bc9fb572
JS
86#endif
87
066f1b7a 88/*
57f4f925
WS
89 TODO PROPERTIES :
90 style (wxLI_HORIZONTAL)
066f1b7a 91*/
c50f1fb9
VZ
92
93// ----------------------------------------------------------------------------
94// wxStaticLine
95// ----------------------------------------------------------------------------
96
cfa822b8
VZ
97bool wxStaticLine::Create(wxWindow *parent,
98 wxWindowID id,
99 const wxPoint& pos,
100 const wxSize& sizeOrig,
101 long style,
102 const wxString &name)
c50f1fb9 103{
cfa822b8 104 wxSize size = AdjustSize(sizeOrig);
f6bcfd97 105
cfa822b8 106 if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) )
57f4f925 107 return false;
c50f1fb9 108
fda7962d 109 return MSWCreateControl(_T("STATIC"), wxEmptyString, pos, size);
cfa822b8
VZ
110}
111
112WXDWORD wxStaticLine::MSWGetStyle(long style, WXDWORD *exstyle) const
113{
3a01bb1b
VZ
114 // we never have border
115 style &= ~wxBORDER_MASK;
116 style |= wxBORDER_NONE;
117
cfa822b8 118 WXDWORD msStyle = wxControl::MSWGetStyle(style, exstyle);
c50f1fb9 119
cfa822b8 120 // add our default styles
4676948b
JS
121 msStyle |= SS_SUNKEN | SS_NOTIFY | WS_CLIPSIBLINGS;
122#ifndef __WXWINCE__
123 msStyle |= SS_GRAYRECT ;
124#endif
125
126 return msStyle ;
c50f1fb9 127}
f6bcfd97
BP
128
129#endif // wxUSE_STATLINE
c50f1fb9 130