1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: panelg.h
|
|
|
|
// Purpose: wxPanel: similar to wxWindows but is coloured as for a dialog
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c)
|
1999-10-28 01:17:35 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1999-10-28 01:17:35 +00:00
|
|
|
#ifndef _WX_GENERIC_PANEL_H_
|
|
|
|
#define _WX_GENERIC_PANEL_H_
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "panelg.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/window.h"
|
1999-06-18 14:18:47 +00:00
|
|
|
#include "wx/button.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-04-14 11:55:35 +00:00
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-01-31 23:30:33 +00:00
|
|
|
class WXDLLEXPORT wxPanel : public wxWindow
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
|
|
|
public:
|
1999-06-17 21:21:52 +00:00
|
|
|
wxPanel() { Init(); }
|
1999-10-20 04:57:45 +00:00
|
|
|
|
1999-02-04 23:21:27 +00:00
|
|
|
// Old-style constructor (no default values for coordinates to avoid
|
|
|
|
// ambiguity with the new one)
|
|
|
|
wxPanel(wxWindow *parent,
|
|
|
|
int x, int y, int width, int height,
|
|
|
|
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
|
|
|
const wxString& name = wxPanelNameStr)
|
|
|
|
{
|
1999-06-17 21:21:52 +00:00
|
|
|
Init();
|
|
|
|
|
1999-02-04 23:21:27 +00:00
|
|
|
Create(parent, -1, wxPoint(x, y), wxSize(width, height), style, name);
|
|
|
|
}
|
1999-10-20 04:57:45 +00:00
|
|
|
|
1999-02-04 23:21:27 +00:00
|
|
|
// Constructor
|
|
|
|
wxPanel(wxWindow *parent,
|
|
|
|
wxWindowID id = -1,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
|
|
|
const wxString& name = wxPanelNameStr)
|
|
|
|
{
|
1999-06-18 18:04:32 +00:00
|
|
|
Init();
|
|
|
|
|
1999-02-04 23:21:27 +00:00
|
|
|
Create(parent, id, pos, size, style, name);
|
|
|
|
}
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-04 23:21:27 +00:00
|
|
|
// Pseudo ctor
|
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
|
|
|
const wxString& name = wxPanelNameStr);
|
1999-10-20 04:57:45 +00:00
|
|
|
|
1999-02-04 23:21:27 +00:00
|
|
|
// Sends an OnInitDialog event, which in turns transfers data to
|
|
|
|
// to the dialog via validators.
|
|
|
|
virtual void InitDialog();
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-06-17 21:21:52 +00:00
|
|
|
// a default button is activated when Enter is pressed
|
|
|
|
wxButton *GetDefaultItem() const { return m_btnDefault; }
|
|
|
|
void SetDefaultItem(wxButton *btn) { m_btnDefault = btn; }
|
|
|
|
|
|
|
|
// implementation from now on
|
|
|
|
// --------------------------
|
|
|
|
|
1999-02-04 23:21:27 +00:00
|
|
|
// responds to colour changes
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
1999-10-20 04:57:45 +00:00
|
|
|
|
1999-02-04 23:21:27 +00:00
|
|
|
// process a keyboard navigation message (Tab traversal)
|
|
|
|
void OnNavigationKey(wxNavigationKeyEvent& event);
|
1999-10-20 04:57:45 +00:00
|
|
|
|
1999-02-04 23:21:27 +00:00
|
|
|
// set the focus to the first child if we get it
|
|
|
|
void OnFocus(wxFocusEvent& event);
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-10-31 10:22:26 +00:00
|
|
|
// calls layout for layout constraints and sizers
|
1999-10-20 04:57:45 +00:00
|
|
|
void OnSize(wxSizeEvent& event);
|
|
|
|
|
1999-10-31 10:22:26 +00:00
|
|
|
// overridden to tab move focus into first focusable child
|
|
|
|
virtual void SetFocus();
|
|
|
|
|
1999-02-04 23:21:27 +00:00
|
|
|
// called by wxWindow whenever it gets focus
|
1999-06-20 21:51:15 +00:00
|
|
|
void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
|
|
|
|
wxWindow *GetLastFocus() const { return m_winLastFocused; }
|
1998-05-20 14:01:55 +00:00
|
|
|
|
1999-02-04 23:21:27 +00:00
|
|
|
protected:
|
1999-06-17 21:21:52 +00:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
2000-01-22 01:44:16 +00:00
|
|
|
// set the focus to the child which had it the last time
|
|
|
|
bool SetFocusToChild();
|
|
|
|
|
1999-02-04 23:21:27 +00:00
|
|
|
// the child which had the focus last time this panel was activated
|
1999-06-20 21:51:15 +00:00
|
|
|
wxWindow *m_winLastFocused;
|
1999-01-31 23:30:33 +00:00
|
|
|
|
1999-06-17 21:21:52 +00:00
|
|
|
// a default button or NULL
|
|
|
|
wxButton *m_btnDefault;
|
|
|
|
|
1999-01-31 23:30:33 +00:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxPanel)
|
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1999-10-28 01:17:35 +00:00
|
|
|
// _WX_GENERIC_PANEL_H_
|