1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: control.h
|
|
|
|
// Purpose: wxControl class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
1999-05-18 20:53:27 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_CONTROL_H_
|
|
|
|
#define _WX_CONTROL_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-02-04 18:21:27 -05:00
|
|
|
#pragma interface "control.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// General item class
|
1999-07-26 19:02:32 -04:00
|
|
|
class WXDLLEXPORT wxControl : public wxControlBase
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
1999-02-04 18:21:27 -05:00
|
|
|
DECLARE_ABSTRACT_CLASS(wxControl)
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
public:
|
1999-02-04 18:21:27 -05:00
|
|
|
wxControl();
|
|
|
|
virtual ~wxControl();
|
|
|
|
|
|
|
|
// Simulates an event
|
1999-07-26 19:02:32 -04:00
|
|
|
virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
|
|
|
|
|
|
|
|
// implementation from now on
|
|
|
|
// --------------------------
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-18 20:53:27 -04:00
|
|
|
// Calls the callback and appropriate event handlers
|
|
|
|
bool ProcessCommand(wxCommandEvent& event);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// MSW-specific
|
1999-05-13 17:21:04 -04:00
|
|
|
#ifdef __WIN95__
|
|
|
|
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
|
|
|
#endif // Win95
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// For ownerdraw items
|
|
|
|
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
|
|
|
|
virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
|
|
|
|
|
1999-11-25 18:28:41 -05:00
|
|
|
wxArrayLong GetSubcontrols() { return m_subControls; }
|
1999-02-04 18:21:27 -05:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
void OnEraseBackground(wxEraseEvent& event);
|
|
|
|
|
1999-11-25 18:28:41 -05:00
|
|
|
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
|
|
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
|
1999-05-18 20:53:27 -04:00
|
|
|
#if WXWIN_COMPATIBILITY
|
|
|
|
virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
|
|
|
|
wxColour* GetButtonColour() const { return NULL; }
|
|
|
|
|
|
|
|
inline virtual void SetLabelFont(const wxFont& font);
|
|
|
|
inline virtual void SetButtonFont(const wxFont& font);
|
|
|
|
inline wxFont& GetLabelFont() const;
|
|
|
|
inline wxFont& GetButtonFont() const;
|
|
|
|
|
|
|
|
// Adds callback
|
|
|
|
inline void Callback(const wxFunction function);
|
|
|
|
|
|
|
|
wxFunction GetCallback() { return m_callback; }
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
protected:
|
|
|
|
wxFunction m_callback; // Callback associated with the window
|
1999-05-18 20:53:27 -04:00
|
|
|
#endif // WXWIN_COMPATIBILITY
|
|
|
|
|
|
|
|
protected:
|
1999-11-25 18:28:41 -05:00
|
|
|
// for controls like radiobuttons which are really composite this array
|
|
|
|
// holds the ids (not HWNDs!) of the sub controls
|
|
|
|
wxArrayLong m_subControls;
|
1999-07-26 19:02:32 -04:00
|
|
|
|
1999-11-19 16:01:20 -05:00
|
|
|
virtual wxSize DoGetBestSize() const;
|
1999-07-26 19:02:32 -04:00
|
|
|
|
|
|
|
// create the control of the given class with the given style, returns FALSE
|
|
|
|
// if creation failed
|
1999-11-14 20:19:46 -05:00
|
|
|
//
|
|
|
|
// All parameters except classname and style are optional, if the
|
|
|
|
// size/position are not given, they should be set later with SetSize() and,
|
|
|
|
// label (the title of the window), of course, is left empty. The extended
|
|
|
|
// style is determined from the style and the app 3D settings automatically
|
|
|
|
// if it's not specified explicitly.
|
|
|
|
bool MSWCreateControl(const wxChar *classname,
|
|
|
|
WXDWORD style,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
const wxString& label = wxEmptyString,
|
|
|
|
WXDWORD exstyle = (WXDWORD)-1);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-07-26 19:02:32 -04:00
|
|
|
// determine the extended styles combination for this window (may slightly
|
1999-11-10 19:25:57 -05:00
|
|
|
// modify style parameter, this is why it's non const)
|
|
|
|
WXDWORD GetExStyle(WXDWORD& style, bool *want3D) const;
|
1999-07-02 18:02:05 -04:00
|
|
|
|
1999-02-04 18:21:27 -05:00
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#if WXWIN_COMPATIBILITY
|
1999-05-18 20:53:27 -04:00
|
|
|
inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
|
1999-07-26 19:02:32 -04:00
|
|
|
inline wxFont& wxControl::GetLabelFont() const { return GetFont(); }
|
|
|
|
inline wxFont& wxControl::GetButtonFont() const { return GetFont(); }
|
1999-02-04 18:21:27 -05:00
|
|
|
inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
|
|
|
|
inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
|
1999-05-18 20:53:27 -04:00
|
|
|
#endif // WXWIN_COMPATIBILITY
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_CONTROL_H_
|