Added wxAccelerators (sort of)

Moved configure (once again)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@649 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-09-02 22:23:57 +00:00
parent 8429bec1e8
commit bcf1fa6bb4
93 changed files with 12757 additions and 152 deletions

View File

@@ -1 +1 @@
include ../install/unix/setup/general/makeapp
include ../setup/general/makeapp

View File

@@ -22,7 +22,7 @@
#ifndef WX_PRECOMP
#include "wx/hash.h"
#ifdef USE_STORABLE_CLASSES
#ifdef USE_SERIAL
#include "wx/objstrm.h"
#include "wx/serbase.h"
#endif
@@ -53,7 +53,7 @@ wxHashTable wxClassInfo::classTable(wxKEY_STRING);
wxObject::wxObject(void)
{
m_refData = (wxObjectRefData *) NULL;
#ifdef USE_STORABLE_CLASSES
#ifdef USE_SERIAL
m_serialObj = (wxObject_Serialize *)NULL;
#endif
}
@@ -61,7 +61,7 @@ wxObject::wxObject(void)
wxObject::~wxObject(void)
{
UnRef();
#ifdef USE_STORABLE_CLASSES
#ifdef USE_SERIAL
if (m_serialObj)
delete m_serialObj;
#endif

View File

@@ -54,6 +54,7 @@ LIB_CPP_SRC=\
common/valtext.cpp \
common/wxexpr.cpp \
\
gtk/accel.cpp \
gtk/app.cpp \
gtk/bitmap.cpp \
gtk/bmpbuttn.cpp \

80
src/gtk/accel.cpp Normal file
View File

@@ -0,0 +1,80 @@
/////////////////////////////////////////////////////////////////////////////
// Name: accel.cpp
// Purpose:
// Author: Robert Roebling
// Id:
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "accel.h"
#endif
#include "wx/accel.h"
//-----------------------------------------------------------------------------
// wxAcceleratorTable
//-----------------------------------------------------------------------------
class wxAccelRefData: public wxObjectRefData
{
public:
wxAccelRefData(void);
wxList m_accels;
};
wxAccelRefData::wxAccelRefData(void)
{
m_accels.DeleteContents( TRUE );
}
//-----------------------------------------------------------------------------
#define M_ACCELDATA ((wxAccelRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable,wxObject)
wxAcceleratorTable::wxAcceleratorTable()
{
m_refData = new wxAccelRefData();
}
wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] )
{
m_refData = new wxAccelRefData();
for (int i = 0; i < n; i++)
{
M_ACCELDATA->m_accels.Append( (wxObject*)
new wxAcceleratorEntry( entries[n].GetFlags(), entries[n].GetKeyCode(), entries[n].GetCommand() ) );
}
}
wxAcceleratorTable::~wxAcceleratorTable()
{
}
bool wxAcceleratorTable::Ok() const
{
return (m_refData != NULL);
}
int wxAcceleratorTable::GetCommand( wxKeyEvent &event )
{
wxNode *node = M_ACCELDATA->m_accels.First();
while (node)
{
wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data();
if ((event.m_keyCode == entry->GetKeyCode()) &&
(((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) &&
(((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) &&
(((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown() || event.MetaDown()))
return entry->GetCommand();
node = node->Next();
}
return -1;
}

View File

@@ -13,7 +13,12 @@
// #pragma implementation
#endif
#include "wx/wx.h"
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/window.h"
#include "wx/dc.h"
#include "wx/accel.h"
#include "wx/postscrp.h"
#define _MAXPATHLEN 500
@@ -108,14 +113,15 @@ wxCursor *wxHOURGLASS_CURSOR = (wxCursor *) NULL;
wxCursor *wxCROSS_CURSOR = (wxCursor *) NULL;
// 'Null' objects
wxBitmap wxNullBitmap;
wxIcon wxNullIcon;
wxCursor wxNullCursor;
wxPen wxNullPen;
wxBrush wxNullBrush;
wxFont wxNullFont;
wxColour wxNullColour;
wxPalette wxNullPalette;
wxAcceleratorTable wxNullAcceleratorTable;
wxBitmap wxNullBitmap;
wxIcon wxNullIcon;
wxCursor wxNullCursor;
wxPen wxNullPen;
wxBrush wxNullBrush;
wxFont wxNullFont;
wxColour wxNullColour;
wxPalette wxNullPalette;
// Default window names
const char *wxButtonNameStr = "button";

View File

@@ -191,6 +191,16 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
bool ret = win->GetEventHandler()->ProcessEvent( event );
if (!ret)
{
int command = win->GetAcceleratorTable()->GetCommand( event );
if (command != -1)
{
wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
ret = win->GetEventHandler()->ProcessEvent( command_event );
}
}
if (ret)
{
if ((gdk_event->keyval >= 0x20) && (gdk_event->keyval <= 0xFF))
@@ -1754,6 +1764,11 @@ bool wxWindow::TransferDataFromWindow(void)
return TRUE;
}
void wxWindow::SetAcceleratorTable( const wxAcceleratorTable& accel )
{
m_acceleratorTable = accel;
}
void wxWindow::OnInitDialog( wxInitDialogEvent &WXUNUSED(event) )
{
TransferDataToWindow();

80
src/gtk1/accel.cpp Normal file
View File

@@ -0,0 +1,80 @@
/////////////////////////////////////////////////////////////////////////////
// Name: accel.cpp
// Purpose:
// Author: Robert Roebling
// Id:
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "accel.h"
#endif
#include "wx/accel.h"
//-----------------------------------------------------------------------------
// wxAcceleratorTable
//-----------------------------------------------------------------------------
class wxAccelRefData: public wxObjectRefData
{
public:
wxAccelRefData(void);
wxList m_accels;
};
wxAccelRefData::wxAccelRefData(void)
{
m_accels.DeleteContents( TRUE );
}
//-----------------------------------------------------------------------------
#define M_ACCELDATA ((wxAccelRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable,wxObject)
wxAcceleratorTable::wxAcceleratorTable()
{
m_refData = new wxAccelRefData();
}
wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] )
{
m_refData = new wxAccelRefData();
for (int i = 0; i < n; i++)
{
M_ACCELDATA->m_accels.Append( (wxObject*)
new wxAcceleratorEntry( entries[n].GetFlags(), entries[n].GetKeyCode(), entries[n].GetCommand() ) );
}
}
wxAcceleratorTable::~wxAcceleratorTable()
{
}
bool wxAcceleratorTable::Ok() const
{
return (m_refData != NULL);
}
int wxAcceleratorTable::GetCommand( wxKeyEvent &event )
{
wxNode *node = M_ACCELDATA->m_accels.First();
while (node)
{
wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data();
if ((event.m_keyCode == entry->GetKeyCode()) &&
(((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) &&
(((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) &&
(((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown() || event.MetaDown()))
return entry->GetCommand();
node = node->Next();
}
return -1;
}

View File

@@ -13,7 +13,12 @@
// #pragma implementation
#endif
#include "wx/wx.h"
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/window.h"
#include "wx/dc.h"
#include "wx/accel.h"
#include "wx/postscrp.h"
#define _MAXPATHLEN 500
@@ -108,14 +113,15 @@ wxCursor *wxHOURGLASS_CURSOR = (wxCursor *) NULL;
wxCursor *wxCROSS_CURSOR = (wxCursor *) NULL;
// 'Null' objects
wxBitmap wxNullBitmap;
wxIcon wxNullIcon;
wxCursor wxNullCursor;
wxPen wxNullPen;
wxBrush wxNullBrush;
wxFont wxNullFont;
wxColour wxNullColour;
wxPalette wxNullPalette;
wxAcceleratorTable wxNullAcceleratorTable;
wxBitmap wxNullBitmap;
wxIcon wxNullIcon;
wxCursor wxNullCursor;
wxPen wxNullPen;
wxBrush wxNullBrush;
wxFont wxNullFont;
wxColour wxNullColour;
wxPalette wxNullPalette;
// Default window names
const char *wxButtonNameStr = "button";

View File

@@ -191,6 +191,16 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
bool ret = win->GetEventHandler()->ProcessEvent( event );
if (!ret)
{
int command = win->GetAcceleratorTable()->GetCommand( event );
if (command != -1)
{
wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command );
ret = win->GetEventHandler()->ProcessEvent( command_event );
}
}
if (ret)
{
if ((gdk_event->keyval >= 0x20) && (gdk_event->keyval <= 0xFF))
@@ -1754,6 +1764,11 @@ bool wxWindow::TransferDataFromWindow(void)
return TRUE;
}
void wxWindow::SetAcceleratorTable( const wxAcceleratorTable& accel )
{
m_acceleratorTable = accel;
}
void wxWindow::OnInitDialog( wxInitDialogEvent &WXUNUSED(event) )
{
TransferDataToWindow();