*** empty log message ***
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3976 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,25 +1,50 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: checkbox.cpp
|
||||
// Purpose: wxCheckBox
|
||||
// Author: AUTHOR
|
||||
// Author: David Webster
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// Created: 10/13/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
// Copyright: (c) David Webster
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "checkbox.h"
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/brush.h"
|
||||
#endif
|
||||
|
||||
#include "wx/checkbox.h"
|
||||
#include "wx/os2/private.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxCheckBox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxCheckBox::OS2Command(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id))
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId);
|
||||
event.SetInt(GetValue());
|
||||
event.SetEventObject(this);
|
||||
ProcessCommand(event);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Single check box item
|
||||
bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
||||
const wxPoint& pos,
|
||||
@@ -29,17 +54,36 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
||||
{
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
SetBackgroundColour(parent->GetBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
||||
|
||||
m_windowStyle = style;
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
wxString Label = label;
|
||||
if (Label == wxT(""))
|
||||
Label = wxT(" "); // Apparently needed or checkbox won't show
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
int x = pos.x;
|
||||
int y = pos.y;
|
||||
int width = size.x;
|
||||
int height = size.y;
|
||||
|
||||
// TODO: create checkbox
|
||||
|
||||
// Subclass again for purposes of dialog editing mode
|
||||
SubclassWin(m_hWnd);
|
||||
|
||||
SetFont(parent->GetFont());
|
||||
|
||||
SetSize(x, y, width, height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -48,9 +92,27 @@ void wxCheckBox::SetLabel(const wxString& label)
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
wxSize wxCheckBox::DoGetBestSize()
|
||||
{
|
||||
// TODO
|
||||
int wCheckbox, hCheckbox;
|
||||
|
||||
wxString str = wxGetWindowText(GetHWND());
|
||||
|
||||
if ( !str.IsEmpty() )
|
||||
{
|
||||
GetTextExtent(str, &wCheckbox, &hCheckbox);
|
||||
wCheckbox += RADIO_SIZE;
|
||||
|
||||
if ( hCheckbox < RADIO_SIZE )
|
||||
hCheckbox = RADIO_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
wCheckbox = RADIO_SIZE;
|
||||
hCheckbox = RADIO_SIZE;
|
||||
}
|
||||
|
||||
return wxSize(wCheckbox, hCheckbox);
|
||||
}
|
||||
|
||||
void wxCheckBox::SetValue(bool val)
|
||||
@@ -58,19 +120,59 @@ void wxCheckBox::SetValue(bool val)
|
||||
// TODO
|
||||
}
|
||||
|
||||
#ifndef BST_CHECKED
|
||||
#define BST_CHECKED 0x0001
|
||||
#endif
|
||||
|
||||
bool wxCheckBox::GetValue() const
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WXHBRUSH wxCheckBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
// TODO:
|
||||
/*
|
||||
#if wxUSE_CTL3D
|
||||
if ( m_useCtl3D )
|
||||
{
|
||||
HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
|
||||
|
||||
return (WXHBRUSH) hbrush;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (GetParent()->GetTransparentBackground())
|
||||
SetBkMode((HDC) pDC, TRANSPARENT);
|
||||
else
|
||||
SetBkMode((HDC) pDC, OPAQUE);
|
||||
|
||||
::SetBkColor((HDC) pDC, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
|
||||
::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
|
||||
|
||||
*/
|
||||
|
||||
wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID);
|
||||
|
||||
|
||||
// Note that this will be cleaned up in wxApp::OnIdle, if backgroundBrush
|
||||
// has a zero usage count.
|
||||
// backgroundBrush->RealizeResource();
|
||||
return (WXHBRUSH) backgroundBrush->GetResourceHandle();
|
||||
}
|
||||
|
||||
void wxCheckBox::Command (wxCommandEvent & event)
|
||||
{
|
||||
SetValue ((event.GetInt() != 0));
|
||||
ProcessCommand (event);
|
||||
}
|
||||
|
||||
// Bitmap checkbox
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBitmapCheckBox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *label,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
@@ -79,39 +181,42 @@ bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *l
|
||||
{
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
m_windowStyle = style;
|
||||
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
SetBackgroundColour(parent->GetBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
||||
m_windowStyle = style;
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
|
||||
// TODO: Create the bitmap checkbox
|
||||
int x = pos.x;
|
||||
int y = pos.y;
|
||||
int width = size.x;
|
||||
int height = size.y;
|
||||
|
||||
return FALSE;
|
||||
checkWidth = -1 ;
|
||||
checkHeight = -1 ;
|
||||
long msStyle = CHECK_FLAGS;
|
||||
|
||||
HWND wx_button = 0; // TODO: Create the bitmap checkbox
|
||||
|
||||
m_hWnd = (WXHWND)wx_button;
|
||||
|
||||
// Subclass again for purposes of dialog editing mode
|
||||
SubclassWin((WXHWND)wx_button);
|
||||
|
||||
SetSize(x, y, width, height);
|
||||
|
||||
// TODO: ShowWindow(wx_button, SW_SHOW);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxBitmapCheckBox::SetLabel(const wxBitmap& bitmap)
|
||||
{
|
||||
// TODO
|
||||
wxFAIL_MSG(wxT("not implemented"));
|
||||
}
|
||||
|
||||
void wxBitmapCheckBox::SetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void wxBitmapCheckBox::SetValue(bool val)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool wxBitmapCheckBox::GetValue() const
|
||||
{
|
||||
// TODOD
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user