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
|
|
|
|
// 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
|
|
|
|
|
|
|
|
#include "wx/window.h"
|
|
|
|
#include "wx/list.h"
|
|
|
|
|
|
|
|
// General item class
|
1999-02-04 18:21:27 -05:00
|
|
|
class WXDLLEXPORT wxControl : public wxWindow
|
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
|
|
|
|
virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
|
|
|
|
// Calls the callback and appropriate event handlers
|
|
|
|
virtual void ProcessCommand(wxCommandEvent& event);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1998-07-04 11:17:59 -04:00
|
|
|
virtual void SetClientSize(int width, int height);
|
1998-11-28 08:38:40 -05:00
|
|
|
virtual void SetClientSize(const wxSize& sz) { wxWindow::SetClientSize(sz); }
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
virtual void SetLabel(const wxString& label);
|
1999-02-04 18:21:27 -05:00
|
|
|
virtual wxString GetLabel() const;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#if WXWIN_COMPATIBILITY
|
1999-02-04 18:21:27 -05:00
|
|
|
virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
|
|
|
|
wxColour* GetButtonColour() const { return NULL; }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
inline virtual void SetLabelFont(const wxFont& font);
|
|
|
|
inline virtual void SetButtonFont(const wxFont& font);
|
1999-02-04 18:21:27 -05:00
|
|
|
inline wxFont& GetLabelFont() const;
|
|
|
|
inline wxFont& GetButtonFont() const;
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// Places item in centre of panel - so can't be used BEFORE panel->Fit()
|
1998-07-04 11:17:59 -04:00
|
|
|
void Centre(int direction = wxHORIZONTAL);
|
1999-02-04 18:21:27 -05:00
|
|
|
|
|
|
|
// Adds callback
|
|
|
|
inline void Callback(const wxFunction function);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// MSW-specific
|
|
|
|
|
|
|
|
// Window procedure
|
1998-07-04 11:17:59 -04:00
|
|
|
virtual void MSWOnMouseMove(int x, int y, WXUINT flags);
|
1998-11-24 18:30:50 -05:00
|
|
|
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
void OnEraseBackground(wxEraseEvent& event);
|
|
|
|
|
|
|
|
// For ownerdraw items
|
|
|
|
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
|
|
|
|
virtual bool MSWOnMeasure(WXMEASUREITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
|
|
|
|
|
1999-02-04 18:21:27 -05:00
|
|
|
wxFunction GetCallback() { return m_callback; }
|
|
|
|
wxList& GetSubcontrols() { return m_subControls; }
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
protected:
|
|
|
|
wxFunction m_callback; // Callback associated with the window
|
|
|
|
|
|
|
|
// MSW implementation
|
|
|
|
wxList m_subControls; // For controls like radiobuttons which are really composite
|
|
|
|
|
1999-02-04 18:21:27 -05:00
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
1999-02-04 18:21:27 -05:00
|
|
|
// Adds callback
|
|
|
|
inline void wxControl::Callback(const wxFunction function)
|
|
|
|
{
|
|
|
|
m_callback = function;
|
|
|
|
};
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#if WXWIN_COMPATIBILITY
|
1999-02-04 18:21:27 -05:00
|
|
|
inline wxFont& wxControl::GetLabelFont() const { return GetFont() ; }
|
|
|
|
inline wxFont& wxControl::GetButtonFont() const { return GetFont() ; }
|
|
|
|
inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
|
|
|
|
inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_CONTROL_H_
|