add wxGenericStaticText (#9656)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56242 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-10-12 13:04:00 +00:00
parent aa163cb549
commit 916eabe60e
19 changed files with 518 additions and 189 deletions

View File

@@ -73,6 +73,11 @@ public:
// removes the mnemonics characters
static wxString RemoveMnemonics(const wxString& str);
// return the accel index in the string or -1 if none and puts the modified
// string into second parameter if non NULL
static int FindAccelIndex(const wxString& label,
wxString *labelOnly = NULL);
// controls by default inherit the colours of their parents, if a
// particular control class doesn't want to do it, it can override

View File

@@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/generic/stattextg.h
// Purpose: wxGenericStaticText header
// Author: Marcin Wojdyr
// Created: 2008-06-26
// Id: $Id:$
// Copyright: Marcin Wojdyr
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GENERIC_STATTEXTG_H_
#define _WX_GENERIC_STATTEXTG_H_
#include "wx/stattext.h"
class WXDLLIMPEXP_CORE wxGenericStaticText : public wxStaticTextBase
{
public:
wxGenericStaticText() { }
wxGenericStaticText(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxStaticTextNameStr)
{
Create(parent, id, label, pos, size, style, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxStaticTextNameStr);
virtual wxSize DoGetBestClientSize() const;
virtual wxSize DoGetBestSize() const;
virtual void SetLabel(const wxString& label);
virtual bool SetFont(const wxFont &font);
virtual wxString DoGetLabel() const { return m_label; }
virtual void DoSetLabel(const wxString& label);
protected:
void OnPaint(wxPaintEvent& event);
void DoSetSize(int x, int y, int width, int height, int sizeFlags);
private:
wxString m_label;
int m_mnemonic;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericStaticText)
};
#endif // _WX_GENERIC_STATTEXTG_H_

View File

@@ -71,11 +71,6 @@ public:
// wxUniversal-specific methods
// return the accel index in the string or -1 if none and puts the modified
// string into second parameter if non NULL
static int FindAccelIndex(const wxString& label,
wxString *labelOnly = NULL);
// return the index of the accel char in the label or -1 if none
int GetAccelIndex() const { return m_indexAccel; }

View File

@@ -12,7 +12,9 @@
#ifndef _WX_UNIV_STATTEXT_H_
#define _WX_UNIV_STATTEXT_H_
class WXDLLIMPEXP_CORE wxStaticText : public wxStaticTextBase
#include "wx/generic/stattextg.h"
class WXDLLIMPEXP_CORE wxStaticText : public wxGenericStaticText
{
public:
wxStaticText() { }
@@ -54,9 +56,6 @@ public:
virtual bool IsFocused() const { return false; }
protected:
// calculate the optimal size for the label
virtual wxSize DoGetBestClientSize() const;
// draw the control
virtual void DoDraw(wxControlRenderer *renderer);