git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31557 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
202 lines
6.2 KiB
C++
202 lines
6.2 KiB
C++
/////////////////////////////////////////////////////////////////////////////
|
|
// Name: src/palmos/control.cpp
|
|
// Purpose: wxControl class
|
|
// Author: William Osborne - minimal working wxPalmOS port
|
|
// Modified by:
|
|
// Created: 10/13/04
|
|
// RCS-ID: $Id$
|
|
// Copyright: (c) William Osborne
|
|
// Licence: wxWindows licence
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// ============================================================================
|
|
// declarations
|
|
// ============================================================================
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// headers
|
|
// ----------------------------------------------------------------------------
|
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
|
#pragma implementation "control.h"
|
|
#endif
|
|
|
|
// For compilers that support precompilation, includes "wx.h".
|
|
#include "wx/wxprec.h"
|
|
|
|
#ifdef __BORLANDC__
|
|
#pragma hdrstop
|
|
#endif
|
|
|
|
#if wxUSE_CONTROLS
|
|
|
|
#ifndef WX_PRECOMP
|
|
#include "wx/event.h"
|
|
#include "wx/app.h"
|
|
#include "wx/dcclient.h"
|
|
#include "wx/log.h"
|
|
#include "wx/settings.h"
|
|
#endif
|
|
|
|
#include "wx/control.h"
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// wxWin macros
|
|
// ----------------------------------------------------------------------------
|
|
|
|
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
|
|
|
|
BEGIN_EVENT_TABLE(wxControl, wxWindow)
|
|
EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground)
|
|
END_EVENT_TABLE()
|
|
|
|
// ============================================================================
|
|
// wxControl implementation
|
|
// ============================================================================
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// wxControl ctor/dtor
|
|
// ----------------------------------------------------------------------------
|
|
|
|
wxControl::~wxControl()
|
|
{
|
|
m_isBeingDeleted = TRUE;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// control window creation
|
|
// ----------------------------------------------------------------------------
|
|
|
|
bool wxControl::Create(wxWindow *parent,
|
|
wxWindowID id,
|
|
const wxPoint& pos,
|
|
const wxSize& size,
|
|
long style,
|
|
const wxValidator& wxVALIDATOR_PARAM(validator),
|
|
const wxString& name)
|
|
{
|
|
if ( !wxWindow::Create(parent, id, pos, size, style, name) )
|
|
return FALSE;
|
|
|
|
#if wxUSE_VALIDATORS
|
|
SetValidator(validator);
|
|
#endif
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
bool wxControl::MSWCreateControl(const wxChar *classname,
|
|
const wxString& label,
|
|
const wxPoint& pos,
|
|
const wxSize& size)
|
|
{
|
|
WXDWORD exstyle;
|
|
WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), &exstyle);
|
|
|
|
return MSWCreateControl(classname, msStyle, pos, size, label, exstyle);
|
|
}
|
|
|
|
bool wxControl::MSWCreateControl(const wxChar *classname,
|
|
WXDWORD style,
|
|
const wxPoint& pos,
|
|
const wxSize& size,
|
|
const wxString& label,
|
|
WXDWORD exstyle)
|
|
{
|
|
return TRUE;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// various accessors
|
|
// ----------------------------------------------------------------------------
|
|
|
|
wxBorder wxControl::GetDefaultBorder() const
|
|
{
|
|
// we want to automatically give controls a sunken style (confusingly,
|
|
// it may not really mean sunken at all as we map it to WS_EX_CLIENTEDGE
|
|
// which is not sunken at all under Windows XP -- rather, just the default)
|
|
return wxBORDER_SUNKEN;
|
|
}
|
|
|
|
WXDWORD wxControl::MSWGetStyle(long style, WXDWORD *exstyle) const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
wxSize wxControl::DoGetBestSize() const
|
|
{
|
|
return wxSize(16, 16);
|
|
}
|
|
|
|
/* static */ wxVisualAttributes
|
|
wxControl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
|
{
|
|
wxVisualAttributes attrs;
|
|
|
|
// old school (i.e. not "common") controls use the standard dialog font
|
|
// by default
|
|
attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
|
|
|
// most, or at least many, of the controls use the same colours as the
|
|
// buttons -- others will have to override this (and possibly simply call
|
|
// GetCompositeControlsDefaultAttributes() from their versions)
|
|
attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT);
|
|
attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
|
|
|
|
return attrs;
|
|
}
|
|
|
|
// another version for the "composite", i.e. non simple controls
|
|
/* static */ wxVisualAttributes
|
|
wxControl::GetCompositeControlsDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
|
{
|
|
wxVisualAttributes attrs;
|
|
attrs.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
|
attrs.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
|
|
attrs.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
|
|
|
return attrs;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// message handling
|
|
// ----------------------------------------------------------------------------
|
|
|
|
bool wxControl::ProcessCommand(wxCommandEvent& event)
|
|
{
|
|
return GetEventHandler()->ProcessEvent(event);
|
|
}
|
|
|
|
#ifdef __WIN95__
|
|
bool wxControl::MSWOnNotify(int idCtrl,
|
|
WXLPARAM lParam,
|
|
WXLPARAM* result)
|
|
{
|
|
}
|
|
#endif // Win95
|
|
|
|
void wxControl::OnEraseBackground(wxEraseEvent& event)
|
|
{
|
|
}
|
|
|
|
WXHBRUSH wxControl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
|
|
#if wxUSE_CTL3D
|
|
WXUINT message,
|
|
WXWPARAM wParam,
|
|
WXLPARAM lParam
|
|
#else
|
|
WXUINT WXUNUSED(message),
|
|
WXWPARAM WXUNUSED(wParam),
|
|
WXLPARAM WXUNUSED(lParam)
|
|
#endif
|
|
)
|
|
{
|
|
return (WXHBRUSH)0;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// global functions
|
|
// ---------------------------------------------------------------------------
|
|
|
|
#endif // wxUSE_CONTROLS
|