1. wxStaticLine implemented (generic (ugly) and MSW versions)

2. wxTextDialog looks fine under MSW again
3. startup tips added: code, sample, docs
4. read-only text controls don't participate in TAB traversal


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2919 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-06-28 21:39:49 +00:00
parent b6bff3019e
commit c50f1fb922
61 changed files with 5596 additions and 1092 deletions

View File

@@ -28,21 +28,19 @@
#include "wx/listbox.h"
#include "wx/stattext.h"
#include "wx/intl.h"
#include "wx/dcclient.h"
#include "wx/settings.h"
#endif
#if wxUSE_STATLINE
#include "wx/statline.h"
#include "wx/statline.h"
#endif
#include "wx/generic/choicdgg.h"
#define wxID_LISTBOX 3000
wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n,
wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n,
const wxString *choices, wxWindow *parent,
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
int WXUNUSED(width), int WXUNUSED(height) )
{
wxSingleChoiceDialog dialog(parent, message, caption, n, choices);
@@ -53,9 +51,9 @@ wxString wxGetSingleChoice( const wxString& message, const wxString& caption, in
}
// Overloaded for backward compatibility
wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n,
wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n,
char *choices[], wxWindow *parent,
int x, int y, bool centre,
int x, int y, bool centre,
int width, int height )
{
wxString *strings = new wxString[n];
@@ -70,9 +68,9 @@ wxString wxGetSingleChoice( const wxString& message, const wxString& caption, in
return ans;
}
int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n,
int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n,
const wxString *choices, wxWindow *parent,
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
int WXUNUSED(width), int WXUNUSED(height) )
{
wxSingleChoiceDialog dialog(parent, message, caption, n, choices);
@@ -83,9 +81,9 @@ int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, in
}
// Overloaded for backward compatibility
int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n,
int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, int n,
wxChar *choices[], wxWindow *parent,
int x, int y, bool centre,
int x, int y, bool centre,
int width, int height )
{
wxString *strings = new wxString[n];
@@ -99,7 +97,7 @@ int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, in
wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n,
const wxString *choices, wxChar **client_data, wxWindow *parent,
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
int WXUNUSED(width), int WXUNUSED(height) )
{
wxSingleChoiceDialog dialog(parent, message, caption, n, choices, client_data);
@@ -110,9 +108,9 @@ wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption,
}
// Overloaded for backward compatibility
wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n,
wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n,
wxChar *choices[], wxChar **client_data, wxWindow *parent,
int x, int y, bool centre,
int x, int y, bool centre,
int width, int height )
{
wxString *strings = new wxString[n];
@@ -173,7 +171,7 @@ IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog)
wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
const wxString& message,
const wxString& caption,
int n,
int n,
const wxString *choices,
char **clientData,
long style,
@@ -187,9 +185,9 @@ wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
const wxString& message,
const wxString& caption,
const wxStringList& choices,
wxChar **clientData,
long style,
const wxStringList& choices,
wxChar **clientData,
long style,
const wxPoint& pos)
: wxDialog(parent, -1, caption, pos, wxDefaultSize,
wxCHOICEDLG_DIALOG_STYLE)
@@ -217,92 +215,41 @@ bool wxSingleChoiceDialog::Create(wxWindow *parent,
}
bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent),
const wxString& message,
const wxString& message,
const wxString& WXUNUSED(caption),
int n,
int n,
const wxString *choices,
char **clientData,
long style,
const wxPoint& WXUNUSED(pos) )
{
m_dialogStyle = style;
m_selection = 0;
m_clientData = NULL;
// dialog layout constants
static const int LAYOUT_X_MARGIN = 5;
static const int LAYOUT_Y_MARGIN = 5;
static const int MARGIN_BETWEEN_BUTTONS = 3*LAYOUT_X_MARGIN;
// calc the message size
// ---------------------
// TODO this should be factored out to a common function (also used in
// msgdlgg.cpp)
wxClientDC dc(this);
dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
wxArrayString lines;
wxString curLine;
long height, width, heightTextMax = 0, widthTextMax = 0;
for ( const char *pc = message; ; pc++ ) {
if ( *pc == '\n' || *pc == '\0' ) {
dc.GetTextExtent(curLine, &width, &height);
if ( width > widthTextMax )
widthTextMax = width;
if ( height > heightTextMax )
heightTextMax = height;
lines.Add(curLine);
if ( *pc == '\n' ) {
curLine.Empty();
}
else {
// the end of string
break;
}
}
else {
curLine += *pc;
}
}
wxSize sizeText = SplitTextMessage(message, &lines);
long heightTextMax = sizeText.GetHeight(),
widthTextMax = sizeText.GetWidth();
size_t nLineCount = lines.Count();
long hTotalMsg = heightTextMax*nLineCount;
// calc the button size
// --------------------
bool hasCancel = FALSE;
// always create the OK button - the code below supposes we do have buttons
// and besides the user should have some way to close this dialog
wxASSERT_MSG( style & wxOK, _T("this dialog should have OK button") );
wxString labelOk(_("OK"));
long wButton = 0;
dc.GetTextExtent(labelOk, &width, NULL);
if ( width > wButton )
wButton = width;
bool hasCancel = (style & wxCANCEL) != 0;
wxString labelCancel;
if ( style & wxCANCEL )
{
labelCancel = _("Cancel");
dc.GetTextExtent(labelCancel, &width, NULL);
if ( width > wButton )
wButton = width;
wxSize sizeButtons = GetStandardButtonSize(hasCancel);
hasCancel = TRUE;
}
long wButton = sizeButtons.GetWidth(),
hButton = sizeButtons.GetHeight();
if ( wButton < 75 )
wButton = 75;
else
wButton += 10;
long hButton = wButton*23/75;
long wTotalButtons = wButton;
if ( hasCancel )
{
@@ -321,8 +268,7 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent),
wListbox = wxMax(300, wxMax(wTotalButtons, widthTextMax));
#if wxUSE_STATLINE
// arbitrary...
long hStatLine = 5;
long hStatLine = wxStaticLine::GetDefaultSize();
#endif
// now the complete dialog size
@@ -362,7 +308,7 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent),
// listbox
m_listbox = new wxListBox( this, wxID_LISTBOX,
wxPoint(2*LAYOUT_X_MARGIN, y),
wxSize(wListbox, hListbox),
wxSize(wListbox, hListbox),
n, choices,
wxLB_HSCROLL);
y += hListbox;
@@ -376,41 +322,17 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent),
// separator line
#if wxUSE_STATLINE
(void) new wxStaticLine( this, -1,
wxPoint(0, y + LAYOUT_Y_MARGIN),
wxSize(wDialog, hStatLine) );
wxPoint(2*LAYOUT_X_MARGIN, y + LAYOUT_Y_MARGIN),
wxSize(wDialog - 4*LAYOUT_X_MARGIN, hStatLine) );
y += LAYOUT_Y_MARGIN + hStatLine;
#endif
// buttons
y += 2*LAYOUT_X_MARGIN;
// NB: create [Ok] first to get the right tab order
wxButton *ok = (wxButton *) NULL;
wxButton *cancel = (wxButton *) NULL;
long x = wDialog / 2;
if ( hasCancel )
x -= MARGIN_BETWEEN_BUTTONS / 2 + wButton;
else
x -= wButton / 2;
ok = new wxButton( this, wxID_OK, labelOk,
wxPoint(x, y),
wxSize(wButton, hButton) );
if ( hasCancel )
{
x += MARGIN_BETWEEN_BUTTONS + wButton;
cancel = new wxButton( this, wxID_CANCEL, labelCancel,
wxPoint(x, y),
wxSize(wButton, hButton) );
}
ok->SetDefault();
ok->SetFocus();
CreateStandardButtons(wDialog, y, wButton, hButton, hasCancel);
SetClientSize( wDialog, hDialog );

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart, Markus Holzem, Robert Roebling
// Licence: wxWindows license
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -21,15 +21,15 @@
#endif
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/button.h"
#include "wx/stattext.h"
#include "wx/statbmp.h"
#include "wx/layout.h"
#include "wx/intl.h"
#include "wx/dcclient.h"
#include "wx/settings.h"
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/button.h"
#include "wx/stattext.h"
#include "wx/statbmp.h"
#include "wx/layout.h"
#include "wx/intl.h"
#include "wx/dcclient.h"
#include "wx/settings.h"
#endif
#include <stdio.h>
@@ -71,9 +71,6 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
const wxPoint& pos)
: wxDialog( parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE )
{
static const int LAYOUT_X_MARGIN = 5;
static const int LAYOUT_Y_MARGIN = 5;
m_dialogStyle = style;
wxBeginBusyCursor();
@@ -122,34 +119,12 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
// split the message in lines
// --------------------------
wxClientDC dc(this);
dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
wxArrayString lines;
wxString curLine;
long height, width, heightTextMax = 0, widthTextMax = 0;
for ( const char *pc = message; ; pc++ ) {
if ( *pc == '\n' || *pc == '\0' ) {
dc.GetTextExtent(curLine, &width, &height);
if ( width > widthTextMax )
widthTextMax = width;
if ( height > heightTextMax )
heightTextMax = height;
lines.Add(curLine);
if ( *pc == '\n' ) {
curLine.Empty();
}
else {
// the end of string
break;
}
}
else {
curLine += *pc;
}
}
wxSize sizeText = SplitTextMessage(message, &lines);
long widthTextMax = sizeText.GetWidth(),
heightTextMax = sizeText.GetHeight();
size_t nLineCount = lines.GetCount();
// calculate the total dialog size
enum
@@ -194,7 +169,7 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
// get the longest caption and also calc the number of buttons
size_t nBtn, nButtons = 0;
long widthBtnMax = 0;
long width, widthBtnMax = 0;
for ( nBtn = 0; nBtn < Btn_Max; nBtn++ ) {
if ( buttons[nBtn] ) {
nButtons++;
@@ -215,8 +190,6 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
heightTextMax *= 12;
heightTextMax /= 10;
size_t nLineCount = lines.Count();
long widthButtonsTotal = nButtons * (widthBtnMax + LAYOUT_X_MARGIN) -
LAYOUT_X_MARGIN;

View File

@@ -174,10 +174,7 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
m_btnAbort = new wxButton(this, -1, _("Cancel"));
c = new wxLayoutConstraints;
c->centreX.SameAs(this, wxCentreX);
if(lastWindow)
c->top.Below(lastWindow, 2*LAYOUT_Y_MARGIN);
else
c->top.Below(m_btnAbort, 2*LAYOUT_Y_MARGIN);
c->top.Below(lastWindow, 2*LAYOUT_Y_MARGIN);
c->width.AsIs();
c->height.AsIs();
m_btnAbort->SetConstraints(c);
@@ -194,9 +191,8 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
// wide under Windows, so try to find a reasonable value for the width, not
// too big and not too small
wxSize size = GetClientSize();
size.x = 2*widthText;
if ( size.x < 2*size.y )
SetClientSize(2*size.y, size.y);
size.x = wxMax(3*widthText/2, 2*size.y);
SetClientSize(size);
Show(TRUE);
Centre(wxCENTER_FRAME | wxBOTH);
@@ -235,18 +231,18 @@ wxProgressDialog::Update(int value, const wxString& newmsg)
if (m_elapsed)
{
s.Printf("%i:%02i:%02i", diff.GetHour(), diff.GetMinute(), diff.GetSecond());
if (s != m_elapsed->GetLabel()) m_elapsed->SetLabel(s);
s.Printf("%i:%02i:%02i", diff.GetHour(), diff.GetMinute(), diff.GetSecond());
if (s != m_elapsed->GetLabel()) m_elapsed->SetLabel(s);
}
if (m_estimated)
{
s.Printf("%i:%02i:%02i", estim / (60 * 60), (estim / 60) % 60, estim % 60);
if (s != m_estimated->GetLabel()) m_estimated->SetLabel(s);
s.Printf("%i:%02i:%02i", estim / (60 * 60), (estim / 60) % 60, estim % 60);
if (s != m_estimated->GetLabel()) m_estimated->SetLabel(s);
}
if (m_remaining)
{
s.Printf("%i:%02i:%02i", remai / (60 * 60), (remai / 60) % 60, remai % 60);
if (s != m_remaining->GetLabel()) m_remaining->SetLabel(s);
s.Printf("%i:%02i:%02i", remai / (60 * 60), (remai / 60) % 60, remai % 60);
if (s != m_remaining->GetLabel()) m_remaining->SetLabel(s);
}
}

61
src/generic/statline.cpp Normal file
View File

@@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////
// Name: generic/statline.cpp
// Purpose: a generic wxStaticLine class
// Author: Vadim Zeitlin
// Created: 28.06.99
// Version: $Id$
// Copyright: (c) 1998 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation "statline.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/statline.h"
#include "wx/statbox.h"
// ============================================================================
// implementation
// ============================================================================
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
// ----------------------------------------------------------------------------
// wxStaticLine
// ----------------------------------------------------------------------------
bool wxStaticLine::Create( wxWindow *parent,
wxWindowID id,
const wxPoint &pos,
const wxSize &size,
long style,
const wxString &name)
{
if ( !CreateBase(parent, id, pos, size, style, name) )
return FALSE;
// ok, this is ugly but it's better than nothing: use a thin static box to
// emulate static line
wxSize sizeReal = AdjustSize(size);
m_statbox = new wxStaticBox(parent, id, _T(""), pos, sizeReal, style, name);
return TRUE;
}

View File

@@ -6,157 +6,132 @@
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows license
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation "textdlgg.h"
#pragma implementation "textdlgg.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include <stdio.h>
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/button.h"
#include "wx/stattext.h"
#include "wx/textctrl.h"
#include "wx/intl.h"
#include <stdio.h>
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/button.h"
#include "wx/stattext.h"
#include "wx/textctrl.h"
#include "wx/intl.h"
#endif
#if wxUSE_STATLINE
#include "wx/statline.h"
#include "wx/statline.h"
#endif
#include "wx/generic/textdlgg.h"
/* Split message, using constraints to position controls */
static wxSize wxSplitMessage2( const wxString &message, wxWindow *parent )
{
int y = 10;
int w = 50;
wxString line( _T("") );
for (size_t pos = 0; pos < message.Len(); pos++)
{
if (message[pos] == _T('\n'))
{
if (!line.IsEmpty())
{
wxStaticText *s1 = new wxStaticText( parent, -1, line, wxPoint(15,y) );
wxSize size1( s1->GetSize() );
if (size1.x > w) w = size1.x;
line = _T("");
}
y += 18;
}
else
{
line += message[pos];
}
}
if (!line.IsEmpty())
{
wxStaticText *s2 = new wxStaticText( parent, -1, line, wxPoint(15,y) );
wxSize size2( s2->GetSize() );
if (size2.x > w) w = size2.x;
}
y += 18;
return wxSize(w+30,y);
}
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
#define wxID_TEXT 3000
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// wxTextEntryDialog
// ----------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY
BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
END_EVENT_TABLE()
IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog)
#endif
wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent, const wxString& message, const wxString& caption,
const wxString& value, long style, const wxPoint& pos):
wxDialog(parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL)
wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent,
const wxString& message,
const wxString& caption,
const wxString& value,
long style,
const wxPoint& pos)
: wxDialog(parent, -1, caption, pos, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL),
m_value(value)
{
m_dialogStyle = style;
m_value = value;
// calculate the sizes
// -------------------
wxBeginBusyCursor();
wxArrayString lines;
wxSize sizeText = SplitTextMessage(message, &lines);
wxSize message_size( wxSplitMessage2( message, this ) );
wxSize sizeBtn = GetStandardButtonSize();
wxButton *ok = (wxButton *) NULL;
wxButton *cancel = (wxButton *) NULL;
wxList m_buttons;
int y = message_size.y + 15;
wxTextCtrl *textCtrl = new wxTextCtrl(this, wxID_TEXT, value, wxPoint(-1, y), wxSize(350, -1));
y += 65;
long wText = wxMax(4*sizeBtn.GetWidth(), sizeText.GetWidth());
long hText = GetStandardTextHeight();
if (style & wxOK)
long wDialog = 4*LAYOUT_X_MARGIN + wText;
long hDialog = 2*LAYOUT_Y_MARGIN +
sizeText.GetHeight() * lines.GetCount() +
2*LAYOUT_Y_MARGIN +
hText +
2*LAYOUT_Y_MARGIN +
sizeBtn.GetHeight() +
2*LAYOUT_Y_MARGIN;
// create the controls
// -------------------
// message
long x = 2*LAYOUT_X_MARGIN;
long y = CreateTextMessage(lines,
wxPoint(x, 2*LAYOUT_Y_MARGIN),
sizeText);
y += 2*LAYOUT_X_MARGIN;
// text ctrl
m_textctrl = new wxTextCtrl(this, wxID_TEXT, m_value,
wxPoint(x, y),
wxSize(wText, hText));
y += hText + 2*LAYOUT_X_MARGIN;
// and buttons
CreateStandardButtons(wDialog, y, sizeBtn.GetWidth(), sizeBtn.GetHeight());
// set the dialog size and position
SetClientSize(wDialog, hDialog);
if ( pos == wxDefaultPosition )
{
ok = new wxButton( this, wxID_OK, _("OK"), wxPoint(-1,y), wxSize(80,-1) );
m_buttons.Append( ok );
// centre the dialog if no explicit position given
Centre(wxBOTH | wxCENTER_FRAME);
}
if (style & wxCANCEL)
{
cancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxPoint(-1,y), wxSize(80,-1) );
m_buttons.Append( cancel );
}
if (ok)
{
ok->SetDefault();
ok->SetFocus();
}
int w = wxMax( 350, m_buttons.GetCount() * 100 );
w = wxMax( w, message_size.x );
int space = w / (m_buttons.GetCount()*2);
textCtrl->SetSize( 20, -1, w-10, -1 );
int m = 0;
wxNode *node = m_buttons.First();
while (node)
{
wxWindow *win = (wxWindow*)node->Data();
int x = (m*2+1)*space - 40 + 15;
win->Move( x, -1 );
node = node->Next();
m++;
}
#if wxUSE_STATLINE
(void) new wxStaticLine( this, -1, wxPoint(0,y-20), wxSize(w+30, 5) );
#endif
SetSize( w+30, y+40 );
Centre( wxBOTH );
wxEndBusyCursor();
m_textctrl->SetFocus();
}
void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
{
wxTextCtrl *textCtrl = (wxTextCtrl *)FindWindow(wxID_TEXT);
if ( textCtrl )
m_value = textCtrl->GetValue();
m_value = m_textctrl->GetValue();
EndModal(wxID_OK);
EndModal(wxID_OK);
}

260
src/generic/tipdlg.cpp Normal file
View File

@@ -0,0 +1,260 @@
///////////////////////////////////////////////////////////////////////////////
// Name: tipdlg.cpp
// Purpose: implementation of wxTipDialog
// Author: Vadim Zeitlin
// Modified by:
// Created: 28.06.99
// RCS-ID: $Id$
// Copyright: (c) Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation "windowbase.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_STARTUP_TIPS
#ifndef WX_PRECOMP
#include "wx/button.h"
#include "wx/checkbox.h"
#include "wx/statbox.h"
#include "wx/statbmp.h"
#include "wx/dialog.h"
#endif // WX_PRECOMP
#include "wx/statline.h"
#include "wx/tipdlg.h"
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
static const int wxID_NEXT_TIP = -100; // whatever
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
// an implementation which takes the tips from the text file - each line
// represents a tip
class WXDLLEXPORT wxFileTipProvider : public wxTipProvider
{
public:
wxFileTipProvider(const wxString& filename, size_t currentTip);
virtual wxString GetTip();
private:
wxTextFile m_textfile;
};
#ifdef __WIN32__
// TODO an implementation which takes the tips from the given registry key
class WXDLLEXPORT wxRegTipProvider : public wxTipProvider
{
public:
wxRegTipProvider(const wxString& keyname);
virtual wxString GetTip();
};
#endif // __WIN32__
// the dialog we show in wxShowTip()
class WXDLLEXPORT wxTipDialog : public wxDialog
{
public:
wxTipDialog(wxWindow *parent,
wxTipProvider *tipProvider,
bool showAtStartup);
// the tip dialog has "Show tips on startup" checkbox - return TRUE if it
// was checked (or wasn't unchecked)
bool ShowTipsOnStartup() const { return m_checkbox->GetValue(); }
// sets the (next) tip text
void SetTipText() { m_text->SetValue(m_tipProvider->GetTip()); }
// "Next" button handler
void OnNextTip(wxCommandEvent& WXUNUSED(event)) { SetTipText(); }
private:
wxTipProvider *m_tipProvider;
wxTextCtrl *m_text;
wxCheckBox *m_checkbox;
DECLARE_EVENT_TABLE()
};
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// wxFileTipProvider
// ----------------------------------------------------------------------------
wxFileTipProvider::wxFileTipProvider(const wxString& filename,
size_t currentTip)
: wxTipProvider(currentTip), m_textfile(filename)
{
m_textfile.Open();
}
wxString wxFileTipProvider::GetTip()
{
size_t count = m_textfile.GetLineCount();
if ( !count )
return _("Tips not available, sorry!");
// notice that it may be greater, actually, if we remembered it from the
// last time and the number of tips changed
if ( m_currentTip == count )
{
// wrap
m_currentTip = 0;
}
return m_textfile.GetLine(m_currentTip++);
}
// ----------------------------------------------------------------------------
// wxTipDialog
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxTipDialog, wxDialog)
EVT_BUTTON(wxID_NEXT_TIP, OnNextTip)
END_EVENT_TABLE()
wxTipDialog::wxTipDialog(wxWindow *parent,
wxTipProvider *tipProvider,
bool showAtStartup)
: wxDialog(parent, -1, _("Tip of the Day"),
wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
m_tipProvider = tipProvider;
wxSize sizeBtn = GetStandardButtonSize();
wxLayoutConstraints *c;
// create the controls in the right order, then set the constraints
wxButton *btnClose = new wxButton(this, wxID_CANCEL, _("&Close"));
m_checkbox = new wxCheckBox(this, -1, _("&Show tips at startup"));
wxButton *btnNext = new wxButton(this, wxID_NEXT_TIP, _("&Next"));
wxTextCtrl *text = new wxTextCtrl(this, -1, _("Did you know..."),
wxDefaultPosition, wxDefaultSize,
wxTE_READONLY | wxNO_BORDER);
text->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxBOLD));
text->SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE));
m_text = new wxTextCtrl(this, -1, _T(""),
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxTE_READONLY | wxSUNKEN_BORDER);
m_text->SetFont(wxFont(14, wxROMAN, wxNORMAL, wxNORMAL));
#ifdef __WXMSW__
wxIcon icon("wxICON_TIP");
#else
#include "wx/generic/tip.xpm"
wxIcon icon(info);
#endif
wxStaticBitmap *bmp = new wxStaticBitmap(this, -1, icon);
const int iconSize = icon.GetWidth();
c = new wxLayoutConstraints;
c->top.SameAs(this, wxTop, 2*LAYOUT_Y_MARGIN);
c->left.RightOf(bmp, 2*LAYOUT_X_MARGIN);
c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN);
c->height.Absolute(2*text->GetSize().GetHeight());
text->SetConstraints(c);
c = new wxLayoutConstraints;
c->centreY.SameAs(text, wxCentreY);
c->left.SameAs(this, wxLeft, 2*LAYOUT_X_MARGIN);
c->width.Absolute(iconSize);
c->height.Absolute(iconSize);
bmp->SetConstraints(c);
c = new wxLayoutConstraints;
c->bottom.SameAs(this, wxBottom, 2*LAYOUT_X_MARGIN);
c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN);
c->width.Absolute(sizeBtn.GetWidth());
c->height.Absolute(sizeBtn.GetHeight());
btnClose->SetConstraints(c);
c = new wxLayoutConstraints;
c->bottom.SameAs(this, wxBottom, 2*LAYOUT_X_MARGIN);
c->right.LeftOf(btnClose, 2*LAYOUT_X_MARGIN);
c->width.Absolute(sizeBtn.GetWidth());
c->height.Absolute(sizeBtn.GetHeight());
btnNext->SetConstraints(c);
c = new wxLayoutConstraints;
c->bottom.SameAs(this, wxBottom, 2*LAYOUT_X_MARGIN);
c->left.SameAs(this, wxLeft, 2*LAYOUT_X_MARGIN);
c->width.AsIs();
c->height.AsIs();
m_checkbox->SetConstraints(c);
m_checkbox->SetValue(showAtStartup);
c = new wxLayoutConstraints;
c->top.Below(text);
c->left.SameAs(this, wxLeft, 2*LAYOUT_X_MARGIN);
c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN);
c->bottom.Above(btnClose, -2*LAYOUT_Y_MARGIN);
m_text->SetConstraints(c);
SetTipText();
Centre(wxBOTH | wxCENTER_FRAME);
wxSize size(5*sizeBtn.GetWidth(), 10*sizeBtn.GetHeight());
SetSize(size);
SetSizeHints(size.x, size.y);
SetAutoLayout(TRUE);
}
// ----------------------------------------------------------------------------
// our public interface
// ----------------------------------------------------------------------------
wxTipProvider *wxCreateFileTipProvider(const wxString& filename,
size_t currentTip)
{
return new wxFileTipProvider(filename, currentTip);
}
bool wxShowTip(wxWindow *parent,
wxTipProvider *tipProvider,
bool showAtStartup)
{
wxTipDialog dlg(parent, tipProvider, showAtStartup);
dlg.ShowModal();
return dlg.ShowTipsOnStartup();
}
#endif // wxUSE_STARTUP_TIPS

View File

@@ -37,6 +37,7 @@ libwx_gtk_la_SOURCES = \
date.cpp \
datstrm.cpp \
dcbase.cpp \
dlgcmn.cpp \
docmdi.cpp \
docview.cpp \
dynarray.cpp \
@@ -186,6 +187,7 @@ libwx_gtk_la_SOURCES = \
textctrl.cpp \
textdlg.cpp \
timer.cpp \
tipdlg.cpp \
tooltip.cpp \
utilsgtk.cpp \
utilsres.cpp \

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -22,39 +22,39 @@
// wxStaticLine
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine,wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
wxStaticLine::wxStaticLine(void)
wxStaticLine::wxStaticLine()
{
}
wxStaticLine::wxStaticLine( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, pos, size, style, name );
}
bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
if (style & wxVERTICAL)
if ( IsVertical() )
m_widget = gtk_vseparator_new();
else
m_widget = gtk_hseparator_new();
m_parent->DoAddChild( this );
PostCreation();
Show( TRUE );
return TRUE;
}
#endif
#endif

View File

@@ -183,23 +183,23 @@ void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window
void
gdk_window_warp_pointer (GdkWindow *window,
gint x,
gint y)
gint x,
gint y)
{
GdkWindowPrivate *priv;
if (!window)
window = (GdkWindow*) &gdk_root_parent;
priv = (GdkWindowPrivate*) window;
if (!priv->destroyed)
{
XWarpPointer (priv->xdisplay,
XWarpPointer (priv->xdisplay,
None, /* not source window -> move from anywhere */
priv->xwindow, /* dest window */
priv->xwindow, /* dest window */
0, 0, 0, 0, /* not source window -> move from anywhere */
x, y );
x, y );
}
}
@@ -218,139 +218,139 @@ extern bool g_isIdle;
/* these functions are copied verbatim from GTK 1.2 */
static void
gdkx_XConvertCase (KeySym symbol,
KeySym *lower,
KeySym *upper)
KeySym *lower,
KeySym *upper)
{
register KeySym sym = symbol;
g_return_if_fail (lower != NULL);
g_return_if_fail (upper != NULL);
*lower = sym;
*upper = sym;
switch (sym >> 8)
{
#if defined (GDK_A) && defined (GDK_Ooblique)
#if defined (GDK_A) && defined (GDK_Ooblique)
case 0: /* Latin 1 */
if ((sym >= GDK_A) && (sym <= GDK_Z))
*lower += (GDK_a - GDK_A);
*lower += (GDK_a - GDK_A);
else if ((sym >= GDK_a) && (sym <= GDK_z))
*upper -= (GDK_a - GDK_A);
*upper -= (GDK_a - GDK_A);
else if ((sym >= GDK_Agrave) && (sym <= GDK_Odiaeresis))
*lower += (GDK_agrave - GDK_Agrave);
*lower += (GDK_agrave - GDK_Agrave);
else if ((sym >= GDK_agrave) && (sym <= GDK_odiaeresis))
*upper -= (GDK_agrave - GDK_Agrave);
*upper -= (GDK_agrave - GDK_Agrave);
else if ((sym >= GDK_Ooblique) && (sym <= GDK_Thorn))
*lower += (GDK_oslash - GDK_Ooblique);
*lower += (GDK_oslash - GDK_Ooblique);
else if ((sym >= GDK_oslash) && (sym <= GDK_thorn))
*upper -= (GDK_oslash - GDK_Ooblique);
*upper -= (GDK_oslash - GDK_Ooblique);
break;
#endif /* LATIN1 */
#if defined (GDK_Aogonek) && defined (GDK_tcedilla)
#endif /* LATIN1 */
#if defined (GDK_Aogonek) && defined (GDK_tcedilla)
case 1: /* Latin 2 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym == GDK_Aogonek)
*lower = GDK_aogonek;
*lower = GDK_aogonek;
else if (sym >= GDK_Lstroke && sym <= GDK_Sacute)
*lower += (GDK_lstroke - GDK_Lstroke);
*lower += (GDK_lstroke - GDK_Lstroke);
else if (sym >= GDK_Scaron && sym <= GDK_Zacute)
*lower += (GDK_scaron - GDK_Scaron);
*lower += (GDK_scaron - GDK_Scaron);
else if (sym >= GDK_Zcaron && sym <= GDK_Zabovedot)
*lower += (GDK_zcaron - GDK_Zcaron);
*lower += (GDK_zcaron - GDK_Zcaron);
else if (sym == GDK_aogonek)
*upper = GDK_Aogonek;
*upper = GDK_Aogonek;
else if (sym >= GDK_lstroke && sym <= GDK_sacute)
*upper -= (GDK_lstroke - GDK_Lstroke);
*upper -= (GDK_lstroke - GDK_Lstroke);
else if (sym >= GDK_scaron && sym <= GDK_zacute)
*upper -= (GDK_scaron - GDK_Scaron);
*upper -= (GDK_scaron - GDK_Scaron);
else if (sym >= GDK_zcaron && sym <= GDK_zabovedot)
*upper -= (GDK_zcaron - GDK_Zcaron);
*upper -= (GDK_zcaron - GDK_Zcaron);
else if (sym >= GDK_Racute && sym <= GDK_Tcedilla)
*lower += (GDK_racute - GDK_Racute);
*lower += (GDK_racute - GDK_Racute);
else if (sym >= GDK_racute && sym <= GDK_tcedilla)
*upper -= (GDK_racute - GDK_Racute);
*upper -= (GDK_racute - GDK_Racute);
break;
#endif /* LATIN2 */
#if defined (GDK_Hstroke) && defined (GDK_Cabovedot)
#endif /* LATIN2 */
#if defined (GDK_Hstroke) && defined (GDK_Cabovedot)
case 2: /* Latin 3 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Hstroke && sym <= GDK_Hcircumflex)
*lower += (GDK_hstroke - GDK_Hstroke);
*lower += (GDK_hstroke - GDK_Hstroke);
else if (sym >= GDK_Gbreve && sym <= GDK_Jcircumflex)
*lower += (GDK_gbreve - GDK_Gbreve);
*lower += (GDK_gbreve - GDK_Gbreve);
else if (sym >= GDK_hstroke && sym <= GDK_hcircumflex)
*upper -= (GDK_hstroke - GDK_Hstroke);
*upper -= (GDK_hstroke - GDK_Hstroke);
else if (sym >= GDK_gbreve && sym <= GDK_jcircumflex)
*upper -= (GDK_gbreve - GDK_Gbreve);
*upper -= (GDK_gbreve - GDK_Gbreve);
else if (sym >= GDK_Cabovedot && sym <= GDK_Scircumflex)
*lower += (GDK_cabovedot - GDK_Cabovedot);
*lower += (GDK_cabovedot - GDK_Cabovedot);
else if (sym >= GDK_cabovedot && sym <= GDK_scircumflex)
*upper -= (GDK_cabovedot - GDK_Cabovedot);
*upper -= (GDK_cabovedot - GDK_Cabovedot);
break;
#endif /* LATIN3 */
#if defined (GDK_Rcedilla) && defined (GDK_Amacron)
#endif /* LATIN3 */
#if defined (GDK_Rcedilla) && defined (GDK_Amacron)
case 3: /* Latin 4 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Rcedilla && sym <= GDK_Tslash)
*lower += (GDK_rcedilla - GDK_Rcedilla);
*lower += (GDK_rcedilla - GDK_Rcedilla);
else if (sym >= GDK_rcedilla && sym <= GDK_tslash)
*upper -= (GDK_rcedilla - GDK_Rcedilla);
*upper -= (GDK_rcedilla - GDK_Rcedilla);
else if (sym == GDK_ENG)
*lower = GDK_eng;
*lower = GDK_eng;
else if (sym == GDK_eng)
*upper = GDK_ENG;
*upper = GDK_ENG;
else if (sym >= GDK_Amacron && sym <= GDK_Umacron)
*lower += (GDK_amacron - GDK_Amacron);
*lower += (GDK_amacron - GDK_Amacron);
else if (sym >= GDK_amacron && sym <= GDK_umacron)
*upper -= (GDK_amacron - GDK_Amacron);
*upper -= (GDK_amacron - GDK_Amacron);
break;
#endif /* LATIN4 */
#if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu)
#endif /* LATIN4 */
#if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu)
case 6: /* Cyrillic */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Serbian_DJE && sym <= GDK_Serbian_DZE)
*lower -= (GDK_Serbian_DJE - GDK_Serbian_dje);
*lower -= (GDK_Serbian_DJE - GDK_Serbian_dje);
else if (sym >= GDK_Serbian_dje && sym <= GDK_Serbian_dze)
*upper += (GDK_Serbian_DJE - GDK_Serbian_dje);
*upper += (GDK_Serbian_DJE - GDK_Serbian_dje);
else if (sym >= GDK_Cyrillic_YU && sym <= GDK_Cyrillic_HARDSIGN)
*lower -= (GDK_Cyrillic_YU - GDK_Cyrillic_yu);
*lower -= (GDK_Cyrillic_YU - GDK_Cyrillic_yu);
else if (sym >= GDK_Cyrillic_yu && sym <= GDK_Cyrillic_hardsign)
*upper += (GDK_Cyrillic_YU - GDK_Cyrillic_yu);
*upper += (GDK_Cyrillic_YU - GDK_Cyrillic_yu);
break;
#endif /* CYRILLIC */
#if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma)
#endif /* CYRILLIC */
#if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma)
case 7: /* Greek */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Greek_ALPHAaccent && sym <= GDK_Greek_OMEGAaccent)
*lower += (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent);
*lower += (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent);
else if (sym >= GDK_Greek_alphaaccent && sym <= GDK_Greek_omegaaccent &&
sym != GDK_Greek_iotaaccentdieresis &&
sym != GDK_Greek_upsilonaccentdieresis)
*upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent);
sym != GDK_Greek_iotaaccentdieresis &&
sym != GDK_Greek_upsilonaccentdieresis)
*upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent);
else if (sym >= GDK_Greek_ALPHA && sym <= GDK_Greek_OMEGA)
*lower += (GDK_Greek_alpha - GDK_Greek_ALPHA);
*lower += (GDK_Greek_alpha - GDK_Greek_ALPHA);
else if (sym >= GDK_Greek_alpha && sym <= GDK_Greek_omega &&
sym != GDK_Greek_finalsmallsigma)
*upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA);
sym != GDK_Greek_finalsmallsigma)
*upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA);
break;
#endif /* GREEK */
#endif /* GREEK */
}
}
static guint
gdk_keyval_to_upper (guint keyval)
gdk_keyval_to_upper (guint keyval)
{
if (keyval)
{
KeySym lower_val = 0;
KeySym upper_val = 0;
gdkx_XConvertCase (keyval, &lower_val, &upper_val);
return upper_val;
}
@@ -368,12 +368,12 @@ static long map_to_unmodified_wx_keysym( KeySym keysym )
case GDK_Shift_R: key_code = WXK_SHIFT; break;
case GDK_Control_L:
case GDK_Control_R: key_code = WXK_CONTROL; break;
case GDK_Meta_L:
case GDK_Meta_R:
case GDK_Alt_L:
case GDK_Alt_R:
case GDK_Super_L:
case GDK_Super_R: key_code = WXK_ALT; break;
case GDK_Meta_L:
case GDK_Meta_R:
case GDK_Alt_L:
case GDK_Alt_R:
case GDK_Super_L:
case GDK_Super_R: key_code = WXK_ALT; break;
case GDK_Menu: key_code = WXK_MENU; break;
case GDK_Help: key_code = WXK_HELP; break;
case GDK_BackSpace: key_code = WXK_BACK; break;
@@ -440,7 +440,7 @@ static long map_to_unmodified_wx_keysym( KeySym keysym )
case GDK_KP_Subtract: key_code = WXK_NUMPAD_SUBTRACT; break;
case GDK_KP_Decimal: key_code = WXK_NUMPAD_DECIMAL; break;
case GDK_KP_Divide: key_code = WXK_NUMPAD_DIVIDE; break;
case GDK_F1: key_code = WXK_F1; break;
case GDK_F2: key_code = WXK_F2; break;
case GDK_F3: key_code = WXK_F3; break;
@@ -539,7 +539,7 @@ static long map_to_wx_keysym( KeySym keysym )
case GDK_KP_Subtract: key_code = '-'; break;
case GDK_KP_Decimal: key_code = '.'; break;
case GDK_KP_Divide: key_code = '/'; break;
case GDK_F1: key_code = WXK_F1; break;
case GDK_F2: key_code = WXK_F2; break;
case GDK_F3: key_code = WXK_F3; break;
@@ -692,7 +692,7 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT)
@@ -714,7 +714,7 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle
static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -738,13 +738,13 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
if (gdk_event->window) gdk_window_get_pointer(gdk_event->window, &x, &y, &state);
long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
/* sending unknown key events doesn't really make sense */
if (key_code == 0) return FALSE;
bool ret = FALSE;
wxKeyEvent event( wxEVT_KEY_DOWN );
wxKeyEvent event( wxEVT_KEY_DOWN );
event.SetTimestamp( gdk_event->time );
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
@@ -756,7 +756,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
event.m_y = y;
event.SetEventObject( win );
ret = win->GetEventHandler()->ProcessEvent( event );
key_code = map_to_wx_keysym( gdk_event->keyval );
#if wxUSE_ACCEL
@@ -781,7 +781,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
will only be sent if it is not a menu accelerator. */
if ((key_code != 0) && ! ret )
{
wxKeyEvent event2( wxEVT_CHAR );
wxKeyEvent event2( wxEVT_CHAR );
event2.SetTimestamp( gdk_event->time );
event2.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
event2.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
@@ -818,7 +818,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
new_event.SetEventObject( win );
ret = win->GetEventHandler()->ProcessEvent( new_event );
}
#if (GTK_MINOR_VERSION > 0)
/* pressing F10 will activate the menu bar of the top frame */
if ( (!ret) &&
@@ -828,22 +828,22 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
while (ancestor)
{
if (wxIsKindOf(ancestor,wxFrame))
{
wxFrame *frame = (wxFrame*) ancestor;
{
wxFrame *frame = (wxFrame*) ancestor;
wxMenuBar *menubar = frame->GetMenuBar();
if (menubar)
{
if (menubar)
{
wxNode *node = menubar->GetMenus().First();
if (node)
{
// doesn't work correctly
if (node)
{
// doesn't work correctly
// wxMenu *firstMenu = (wxMenu*) node->Data();
// gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) );
// ret = TRUE;
break;
}
}
}
// gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) );
// ret = TRUE;
break;
}
}
}
ancestor = ancestor->GetParent();
}
}
@@ -887,7 +887,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -907,7 +907,7 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk
*/
long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
/* sending unknown key events doesn't really make sense */
if (key_code == 0) return FALSE;
@@ -943,7 +943,7 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
/*
@@ -1097,7 +1097,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -1205,7 +1205,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -1316,7 +1316,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -1366,7 +1366,7 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -1403,7 +1403,7 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -1449,14 +1449,14 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
wxMouseEvent event( wxEVT_LEAVE_WINDOW );
#if (GTK_MINOR_VERSION > 0)
event.SetTimestamp( gdk_event->time );
@@ -1495,7 +1495,7 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_
static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
@@ -1539,7 +1539,7 @@ static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
@@ -1582,7 +1582,7 @@ static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
@@ -1602,7 +1602,7 @@ static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW
static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
@@ -1624,7 +1624,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
// don't test here as we can release the mouse while being over
@@ -1683,7 +1683,7 @@ wxWindow *wxWindowBase::FindFocus()
static gint
gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (win->m_delayedFont)
@@ -1696,7 +1696,7 @@ gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
win->SetForegroundColour( win->GetForegroundColour() );
win->SetCursor( win->GetCursor() );
wxWindowCreateEvent event( win );
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
@@ -1962,25 +1962,25 @@ wxWindow::~wxWindow()
if (m_widgetStyle)
{
gtk_style_unref( m_widgetStyle );
m_widgetStyle = (GtkStyle*) NULL;
m_widgetStyle = (GtkStyle*) NULL;
}
if (m_scrollGC)
{
gdk_gc_unref( m_scrollGC );
m_scrollGC = (GdkGC*) NULL;
m_scrollGC = (GdkGC*) NULL;
}
if (m_wxwindow)
{
gtk_widget_destroy( m_wxwindow );
m_wxwindow = (GtkWidget*) NULL;
m_wxwindow = (GtkWidget*) NULL;
}
if (m_widget)
{
gtk_widget_destroy( m_widget );
m_widget = (GtkWidget*) NULL;
m_widget = (GtkWidget*) NULL;
}
}
@@ -2049,7 +2049,7 @@ void wxWindow::PostCreation()
/* we cannot set colours, fonts and cursors before the widget has
been realized, so we do this directly after realization */
gtk_signal_connect( GTK_OBJECT(connect_widget), "realize",
GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this );
GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this );
m_hasVMT = TRUE;
}
@@ -2142,42 +2142,42 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
int border = 0;
int bottom_border = 0;
int bottom_border = 0;
if (GTK_WIDGET_CAN_DEFAULT(m_widget))
{
/* the default button has a border around it */
border = 6;
bottom_border = 5;
}
{
/* the default button has a border around it */
border = 6;
bottom_border = 5;
}
/* this is the result of hours of debugging: the following code
means that if we have a m_wxwindow and we set the size of
m_widget, m_widget (which is a GtkScrolledWindow) does NOT
automatically propagate its size down to its m_wxwindow,
which is its client area. therefore, we have to tell the
client area directly that it has to resize itself.
this will lead to that m_widget (GtkScrolledWindow) will
calculate how much size it needs for scrollbars etc and
it will then call XXX_size_allocate of its child, which
is m_wxwindow. m_wxwindow in turn will do the same with its
children and so on. problems can arise if this happens
before all the children have been realized as some widgets
stupidy need to be realized during XXX_size_allocate (e.g.
GtkNotebook) and they will segv if called otherwise. this
emergency is tested in gtk_myfixed_size_allocate. Normally
this shouldn't be needed and only gtk_widget_queue_resize()
should be enough to provoke a resize at the next appropriate
moment, but this seems to fail, e.g. when a wxNotebook contains
a wxSplitterWindow: the splitter window's children won't
show up properly resized then. */
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow),
m_widget,
m_x-border,
m_y-border,
m_width+2*border,
m_height+border+bottom_border );
/* this is the result of hours of debugging: the following code
means that if we have a m_wxwindow and we set the size of
m_widget, m_widget (which is a GtkScrolledWindow) does NOT
automatically propagate its size down to its m_wxwindow,
which is its client area. therefore, we have to tell the
client area directly that it has to resize itself.
this will lead to that m_widget (GtkScrolledWindow) will
calculate how much size it needs for scrollbars etc and
it will then call XXX_size_allocate of its child, which
is m_wxwindow. m_wxwindow in turn will do the same with its
children and so on. problems can arise if this happens
before all the children have been realized as some widgets
stupidy need to be realized during XXX_size_allocate (e.g.
GtkNotebook) and they will segv if called otherwise. this
emergency is tested in gtk_myfixed_size_allocate. Normally
this shouldn't be needed and only gtk_widget_queue_resize()
should be enough to provoke a resize at the next appropriate
moment, but this seems to fail, e.g. when a wxNotebook contains
a wxSplitterWindow: the splitter window's children won't
show up properly resized then. */
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow),
m_widget,
m_x-border,
m_y-border,
m_width+2*border,
m_height+border+bottom_border );
}
m_sizeSet = TRUE;
@@ -2196,13 +2196,13 @@ void wxWindow::OnInternalIdle()
{
wxCursor cursor = m_cursor;
if (g_globalCursor.Ok()) cursor = g_globalCursor;
if (cursor.Ok() && m_currentGdkCursor != cursor)
{
gdk_window_set_cursor( window, cursor.GetCursor() );
m_currentGdkCursor = cursor;
}
}
if (cursor.Ok() && m_currentGdkCursor != cursor)
{
gdk_window_set_cursor( window, cursor.GetCursor() );
m_currentGdkCursor = cursor;
}
}
UpdateWindowUI();
}
@@ -2513,7 +2513,7 @@ bool wxWindow::AcceptsFocus() const
bool wxWindow::Reparent( wxWindow *newParent )
{
wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") );
wxWindow *oldParent = m_parent;
if ( !wxWindowBase::Reparent(newParent) )
@@ -2523,27 +2523,27 @@ bool wxWindow::Reparent( wxWindow *newParent )
{
gtk_container_remove( GTK_CONTAINER(oldParent->m_wxwindow), m_widget );
}
if (newParent)
{
/* insert GTK representation */
(*(newParent->m_insertCallback))(newParent, this);
}
return TRUE;
}
void wxWindow::DoAddChild(wxWindow *child)
void wxWindow::DoAddChild(wxWindow *child)
{
wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
wxASSERT_MSG( (child != NULL), _T("invalid child window") );
wxASSERT_MSG( (m_insertCallback != NULL), _T("invalid child insertion function") );
/* add to list */
AddChild( child );
/* insert GTK representation */
(*m_insertCallback)(this, child);
}
@@ -2576,16 +2576,16 @@ bool wxWindow::SetCursor( const wxCursor &cursor )
// been realized
if (!m_delayedCursor) return FALSE;
}
GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window)
{
// indicate that a new style has been set
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedCursor = TRUE;
// pretend we have done something
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedCursor = TRUE;
// pretend we have done something
return TRUE;
}
@@ -2603,7 +2603,7 @@ void wxWindow::WarpPointer( int x, int y )
if (connect_widget->window)
{
/* we provide this function ourselves as it is
missing in GDK */
missing in GDK */
gdk_window_warp_pointer( connect_widget->window, x, y );
}
}
@@ -2687,16 +2687,16 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour )
// been realized
if (!m_delayedBackgroundColour) return FALSE;
}
GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window)
{
// indicate that a new style has been set
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedBackgroundColour = TRUE;
// pretend we have done something
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedBackgroundColour = TRUE;
// pretend we have done something
return TRUE;
}
@@ -2734,16 +2734,16 @@ bool wxWindow::SetForegroundColour( const wxColour &colour )
// been realized
if (!m_delayedForegroundColour) return FALSE;
}
GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window)
{
// indicate that a new style has been set
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedForegroundColour = TRUE;
// pretend we have done something
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedForegroundColour = TRUE;
// pretend we have done something
return TRUE;
}
@@ -2890,7 +2890,7 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
bool wxWindow::SetFont( const wxFont &font )
{
wxCHECK_MSG( m_widget != NULL, FALSE, _T( "invalid window") );
wxCHECK_MSG( m_widget != NULL, FALSE, _T( "invalid window") );
if (!wxWindowBase::SetFont(font))
{
@@ -2898,16 +2898,16 @@ bool wxWindow::SetFont( const wxFont &font )
// been realized
if (!m_delayedFont) return FALSE;
}
GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window)
{
// indicate that a new style has been set
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedFont = TRUE;
// pretend we have done something
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedFont = TRUE;
// pretend we have done something
return TRUE;
}
@@ -2934,7 +2934,7 @@ void wxWindow::CaptureMouse()
GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) return;
gdk_pointer_grab( connect_widget->window, FALSE,
(GdkEventMask)
(GDK_BUTTON_PRESS_MASK |
@@ -2954,7 +2954,7 @@ void wxWindow::ReleaseMouse()
GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) return;
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
g_captureWindow = (wxWindow*) NULL;
}
@@ -3114,16 +3114,16 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
m_scrollGC = gdk_gc_new( m_wxwindow->window );
gdk_gc_set_exposures( m_scrollGC, TRUE );
}
wxNode *node = m_children.First();
while (node)
{
wxWindow *child = (wxWindow*) node->Data();
int sx = 0;
int sy = 0;
child->GetSize( &sx, &sy );
child->SetSize( child->m_x + dx, child->m_y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE );
node = node->Next();
int sx = 0;
int sy = 0;
child->GetSize( &sx, &sy );
child->SetSize( child->m_x + dx, child->m_y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE );
node = node->Next();
}
int cw = 0;
@@ -3131,7 +3131,7 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
GetClientSize( &cw, &ch );
int w = cw - abs(dx);
int h = ch - abs(dy);
if ((h < 0) || (w < 0))
{
Refresh();

View File

@@ -37,6 +37,7 @@ libwx_gtk_la_SOURCES = \
date.cpp \
datstrm.cpp \
dcbase.cpp \
dlgcmn.cpp \
docmdi.cpp \
docview.cpp \
dynarray.cpp \
@@ -186,6 +187,7 @@ libwx_gtk_la_SOURCES = \
textctrl.cpp \
textdlg.cpp \
timer.cpp \
tipdlg.cpp \
tooltip.cpp \
utilsgtk.cpp \
utilsres.cpp \

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -22,39 +22,39 @@
// wxStaticLine
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine,wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
wxStaticLine::wxStaticLine(void)
wxStaticLine::wxStaticLine()
{
}
wxStaticLine::wxStaticLine( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, pos, size, style, name );
}
bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
if (style & wxVERTICAL)
if ( IsVertical() )
m_widget = gtk_vseparator_new();
else
m_widget = gtk_hseparator_new();
m_parent->DoAddChild( this );
PostCreation();
Show( TRUE );
return TRUE;
}
#endif
#endif

View File

@@ -183,23 +183,23 @@ void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window
void
gdk_window_warp_pointer (GdkWindow *window,
gint x,
gint y)
gint x,
gint y)
{
GdkWindowPrivate *priv;
if (!window)
window = (GdkWindow*) &gdk_root_parent;
priv = (GdkWindowPrivate*) window;
if (!priv->destroyed)
{
XWarpPointer (priv->xdisplay,
XWarpPointer (priv->xdisplay,
None, /* not source window -> move from anywhere */
priv->xwindow, /* dest window */
priv->xwindow, /* dest window */
0, 0, 0, 0, /* not source window -> move from anywhere */
x, y );
x, y );
}
}
@@ -218,139 +218,139 @@ extern bool g_isIdle;
/* these functions are copied verbatim from GTK 1.2 */
static void
gdkx_XConvertCase (KeySym symbol,
KeySym *lower,
KeySym *upper)
KeySym *lower,
KeySym *upper)
{
register KeySym sym = symbol;
g_return_if_fail (lower != NULL);
g_return_if_fail (upper != NULL);
*lower = sym;
*upper = sym;
switch (sym >> 8)
{
#if defined (GDK_A) && defined (GDK_Ooblique)
#if defined (GDK_A) && defined (GDK_Ooblique)
case 0: /* Latin 1 */
if ((sym >= GDK_A) && (sym <= GDK_Z))
*lower += (GDK_a - GDK_A);
*lower += (GDK_a - GDK_A);
else if ((sym >= GDK_a) && (sym <= GDK_z))
*upper -= (GDK_a - GDK_A);
*upper -= (GDK_a - GDK_A);
else if ((sym >= GDK_Agrave) && (sym <= GDK_Odiaeresis))
*lower += (GDK_agrave - GDK_Agrave);
*lower += (GDK_agrave - GDK_Agrave);
else if ((sym >= GDK_agrave) && (sym <= GDK_odiaeresis))
*upper -= (GDK_agrave - GDK_Agrave);
*upper -= (GDK_agrave - GDK_Agrave);
else if ((sym >= GDK_Ooblique) && (sym <= GDK_Thorn))
*lower += (GDK_oslash - GDK_Ooblique);
*lower += (GDK_oslash - GDK_Ooblique);
else if ((sym >= GDK_oslash) && (sym <= GDK_thorn))
*upper -= (GDK_oslash - GDK_Ooblique);
*upper -= (GDK_oslash - GDK_Ooblique);
break;
#endif /* LATIN1 */
#if defined (GDK_Aogonek) && defined (GDK_tcedilla)
#endif /* LATIN1 */
#if defined (GDK_Aogonek) && defined (GDK_tcedilla)
case 1: /* Latin 2 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym == GDK_Aogonek)
*lower = GDK_aogonek;
*lower = GDK_aogonek;
else if (sym >= GDK_Lstroke && sym <= GDK_Sacute)
*lower += (GDK_lstroke - GDK_Lstroke);
*lower += (GDK_lstroke - GDK_Lstroke);
else if (sym >= GDK_Scaron && sym <= GDK_Zacute)
*lower += (GDK_scaron - GDK_Scaron);
*lower += (GDK_scaron - GDK_Scaron);
else if (sym >= GDK_Zcaron && sym <= GDK_Zabovedot)
*lower += (GDK_zcaron - GDK_Zcaron);
*lower += (GDK_zcaron - GDK_Zcaron);
else if (sym == GDK_aogonek)
*upper = GDK_Aogonek;
*upper = GDK_Aogonek;
else if (sym >= GDK_lstroke && sym <= GDK_sacute)
*upper -= (GDK_lstroke - GDK_Lstroke);
*upper -= (GDK_lstroke - GDK_Lstroke);
else if (sym >= GDK_scaron && sym <= GDK_zacute)
*upper -= (GDK_scaron - GDK_Scaron);
*upper -= (GDK_scaron - GDK_Scaron);
else if (sym >= GDK_zcaron && sym <= GDK_zabovedot)
*upper -= (GDK_zcaron - GDK_Zcaron);
*upper -= (GDK_zcaron - GDK_Zcaron);
else if (sym >= GDK_Racute && sym <= GDK_Tcedilla)
*lower += (GDK_racute - GDK_Racute);
*lower += (GDK_racute - GDK_Racute);
else if (sym >= GDK_racute && sym <= GDK_tcedilla)
*upper -= (GDK_racute - GDK_Racute);
*upper -= (GDK_racute - GDK_Racute);
break;
#endif /* LATIN2 */
#if defined (GDK_Hstroke) && defined (GDK_Cabovedot)
#endif /* LATIN2 */
#if defined (GDK_Hstroke) && defined (GDK_Cabovedot)
case 2: /* Latin 3 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Hstroke && sym <= GDK_Hcircumflex)
*lower += (GDK_hstroke - GDK_Hstroke);
*lower += (GDK_hstroke - GDK_Hstroke);
else if (sym >= GDK_Gbreve && sym <= GDK_Jcircumflex)
*lower += (GDK_gbreve - GDK_Gbreve);
*lower += (GDK_gbreve - GDK_Gbreve);
else if (sym >= GDK_hstroke && sym <= GDK_hcircumflex)
*upper -= (GDK_hstroke - GDK_Hstroke);
*upper -= (GDK_hstroke - GDK_Hstroke);
else if (sym >= GDK_gbreve && sym <= GDK_jcircumflex)
*upper -= (GDK_gbreve - GDK_Gbreve);
*upper -= (GDK_gbreve - GDK_Gbreve);
else if (sym >= GDK_Cabovedot && sym <= GDK_Scircumflex)
*lower += (GDK_cabovedot - GDK_Cabovedot);
*lower += (GDK_cabovedot - GDK_Cabovedot);
else if (sym >= GDK_cabovedot && sym <= GDK_scircumflex)
*upper -= (GDK_cabovedot - GDK_Cabovedot);
*upper -= (GDK_cabovedot - GDK_Cabovedot);
break;
#endif /* LATIN3 */
#if defined (GDK_Rcedilla) && defined (GDK_Amacron)
#endif /* LATIN3 */
#if defined (GDK_Rcedilla) && defined (GDK_Amacron)
case 3: /* Latin 4 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Rcedilla && sym <= GDK_Tslash)
*lower += (GDK_rcedilla - GDK_Rcedilla);
*lower += (GDK_rcedilla - GDK_Rcedilla);
else if (sym >= GDK_rcedilla && sym <= GDK_tslash)
*upper -= (GDK_rcedilla - GDK_Rcedilla);
*upper -= (GDK_rcedilla - GDK_Rcedilla);
else if (sym == GDK_ENG)
*lower = GDK_eng;
*lower = GDK_eng;
else if (sym == GDK_eng)
*upper = GDK_ENG;
*upper = GDK_ENG;
else if (sym >= GDK_Amacron && sym <= GDK_Umacron)
*lower += (GDK_amacron - GDK_Amacron);
*lower += (GDK_amacron - GDK_Amacron);
else if (sym >= GDK_amacron && sym <= GDK_umacron)
*upper -= (GDK_amacron - GDK_Amacron);
*upper -= (GDK_amacron - GDK_Amacron);
break;
#endif /* LATIN4 */
#if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu)
#endif /* LATIN4 */
#if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu)
case 6: /* Cyrillic */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Serbian_DJE && sym <= GDK_Serbian_DZE)
*lower -= (GDK_Serbian_DJE - GDK_Serbian_dje);
*lower -= (GDK_Serbian_DJE - GDK_Serbian_dje);
else if (sym >= GDK_Serbian_dje && sym <= GDK_Serbian_dze)
*upper += (GDK_Serbian_DJE - GDK_Serbian_dje);
*upper += (GDK_Serbian_DJE - GDK_Serbian_dje);
else if (sym >= GDK_Cyrillic_YU && sym <= GDK_Cyrillic_HARDSIGN)
*lower -= (GDK_Cyrillic_YU - GDK_Cyrillic_yu);
*lower -= (GDK_Cyrillic_YU - GDK_Cyrillic_yu);
else if (sym >= GDK_Cyrillic_yu && sym <= GDK_Cyrillic_hardsign)
*upper += (GDK_Cyrillic_YU - GDK_Cyrillic_yu);
*upper += (GDK_Cyrillic_YU - GDK_Cyrillic_yu);
break;
#endif /* CYRILLIC */
#if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma)
#endif /* CYRILLIC */
#if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma)
case 7: /* Greek */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= GDK_Greek_ALPHAaccent && sym <= GDK_Greek_OMEGAaccent)
*lower += (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent);
*lower += (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent);
else if (sym >= GDK_Greek_alphaaccent && sym <= GDK_Greek_omegaaccent &&
sym != GDK_Greek_iotaaccentdieresis &&
sym != GDK_Greek_upsilonaccentdieresis)
*upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent);
sym != GDK_Greek_iotaaccentdieresis &&
sym != GDK_Greek_upsilonaccentdieresis)
*upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent);
else if (sym >= GDK_Greek_ALPHA && sym <= GDK_Greek_OMEGA)
*lower += (GDK_Greek_alpha - GDK_Greek_ALPHA);
*lower += (GDK_Greek_alpha - GDK_Greek_ALPHA);
else if (sym >= GDK_Greek_alpha && sym <= GDK_Greek_omega &&
sym != GDK_Greek_finalsmallsigma)
*upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA);
sym != GDK_Greek_finalsmallsigma)
*upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA);
break;
#endif /* GREEK */
#endif /* GREEK */
}
}
static guint
gdk_keyval_to_upper (guint keyval)
gdk_keyval_to_upper (guint keyval)
{
if (keyval)
{
KeySym lower_val = 0;
KeySym upper_val = 0;
gdkx_XConvertCase (keyval, &lower_val, &upper_val);
return upper_val;
}
@@ -368,12 +368,12 @@ static long map_to_unmodified_wx_keysym( KeySym keysym )
case GDK_Shift_R: key_code = WXK_SHIFT; break;
case GDK_Control_L:
case GDK_Control_R: key_code = WXK_CONTROL; break;
case GDK_Meta_L:
case GDK_Meta_R:
case GDK_Alt_L:
case GDK_Alt_R:
case GDK_Super_L:
case GDK_Super_R: key_code = WXK_ALT; break;
case GDK_Meta_L:
case GDK_Meta_R:
case GDK_Alt_L:
case GDK_Alt_R:
case GDK_Super_L:
case GDK_Super_R: key_code = WXK_ALT; break;
case GDK_Menu: key_code = WXK_MENU; break;
case GDK_Help: key_code = WXK_HELP; break;
case GDK_BackSpace: key_code = WXK_BACK; break;
@@ -440,7 +440,7 @@ static long map_to_unmodified_wx_keysym( KeySym keysym )
case GDK_KP_Subtract: key_code = WXK_NUMPAD_SUBTRACT; break;
case GDK_KP_Decimal: key_code = WXK_NUMPAD_DECIMAL; break;
case GDK_KP_Divide: key_code = WXK_NUMPAD_DIVIDE; break;
case GDK_F1: key_code = WXK_F1; break;
case GDK_F2: key_code = WXK_F2; break;
case GDK_F3: key_code = WXK_F3; break;
@@ -539,7 +539,7 @@ static long map_to_wx_keysym( KeySym keysym )
case GDK_KP_Subtract: key_code = '-'; break;
case GDK_KP_Decimal: key_code = '.'; break;
case GDK_KP_Divide: key_code = '/'; break;
case GDK_F1: key_code = WXK_F1; break;
case GDK_F2: key_code = WXK_F2; break;
case GDK_F3: key_code = WXK_F3; break;
@@ -692,7 +692,7 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT)
@@ -714,7 +714,7 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle
static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -738,13 +738,13 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
if (gdk_event->window) gdk_window_get_pointer(gdk_event->window, &x, &y, &state);
long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
/* sending unknown key events doesn't really make sense */
if (key_code == 0) return FALSE;
bool ret = FALSE;
wxKeyEvent event( wxEVT_KEY_DOWN );
wxKeyEvent event( wxEVT_KEY_DOWN );
event.SetTimestamp( gdk_event->time );
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
@@ -756,7 +756,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
event.m_y = y;
event.SetEventObject( win );
ret = win->GetEventHandler()->ProcessEvent( event );
key_code = map_to_wx_keysym( gdk_event->keyval );
#if wxUSE_ACCEL
@@ -781,7 +781,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
will only be sent if it is not a menu accelerator. */
if ((key_code != 0) && ! ret )
{
wxKeyEvent event2( wxEVT_CHAR );
wxKeyEvent event2( wxEVT_CHAR );
event2.SetTimestamp( gdk_event->time );
event2.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
event2.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK);
@@ -818,7 +818,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
new_event.SetEventObject( win );
ret = win->GetEventHandler()->ProcessEvent( new_event );
}
#if (GTK_MINOR_VERSION > 0)
/* pressing F10 will activate the menu bar of the top frame */
if ( (!ret) &&
@@ -828,22 +828,22 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
while (ancestor)
{
if (wxIsKindOf(ancestor,wxFrame))
{
wxFrame *frame = (wxFrame*) ancestor;
{
wxFrame *frame = (wxFrame*) ancestor;
wxMenuBar *menubar = frame->GetMenuBar();
if (menubar)
{
if (menubar)
{
wxNode *node = menubar->GetMenus().First();
if (node)
{
// doesn't work correctly
if (node)
{
// doesn't work correctly
// wxMenu *firstMenu = (wxMenu*) node->Data();
// gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) );
// ret = TRUE;
break;
}
}
}
// gtk_menu_item_select( GTK_MENU_ITEM(firstMenu->m_owner) );
// ret = TRUE;
break;
}
}
}
ancestor = ancestor->GetParent();
}
}
@@ -887,7 +887,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -907,7 +907,7 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk
*/
long key_code = map_to_unmodified_wx_keysym( gdk_event->keyval );
/* sending unknown key events doesn't really make sense */
if (key_code == 0) return FALSE;
@@ -943,7 +943,7 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
/*
@@ -1097,7 +1097,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -1205,7 +1205,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -1316,7 +1316,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -1366,7 +1366,7 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -1403,7 +1403,7 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
@@ -1449,14 +1449,14 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (!win->m_hasVMT) return FALSE;
if (g_blockEventsOnDrag) return FALSE;
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
wxMouseEvent event( wxEVT_LEAVE_WINDOW );
#if (GTK_MINOR_VERSION > 0)
event.SetTimestamp( gdk_event->time );
@@ -1495,7 +1495,7 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_
static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
@@ -1539,7 +1539,7 @@ static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
@@ -1582,7 +1582,7 @@ static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
@@ -1602,7 +1602,7 @@ static void gtk_window_vscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW
static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (g_blockEventsOnDrag) return;
@@ -1624,7 +1624,7 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
// don't test here as we can release the mouse while being over
@@ -1683,7 +1683,7 @@ wxWindow *wxWindowBase::FindFocus()
static gint
gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
{
if (g_isIdle)
if (g_isIdle)
wxapp_install_idle_handler();
if (win->m_delayedFont)
@@ -1696,7 +1696,7 @@ gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
win->SetForegroundColour( win->GetForegroundColour() );
win->SetCursor( win->GetCursor() );
wxWindowCreateEvent event( win );
event.SetEventObject( win );
win->GetEventHandler()->ProcessEvent( event );
@@ -1962,25 +1962,25 @@ wxWindow::~wxWindow()
if (m_widgetStyle)
{
gtk_style_unref( m_widgetStyle );
m_widgetStyle = (GtkStyle*) NULL;
m_widgetStyle = (GtkStyle*) NULL;
}
if (m_scrollGC)
{
gdk_gc_unref( m_scrollGC );
m_scrollGC = (GdkGC*) NULL;
m_scrollGC = (GdkGC*) NULL;
}
if (m_wxwindow)
{
gtk_widget_destroy( m_wxwindow );
m_wxwindow = (GtkWidget*) NULL;
m_wxwindow = (GtkWidget*) NULL;
}
if (m_widget)
{
gtk_widget_destroy( m_widget );
m_widget = (GtkWidget*) NULL;
m_widget = (GtkWidget*) NULL;
}
}
@@ -2049,7 +2049,7 @@ void wxWindow::PostCreation()
/* we cannot set colours, fonts and cursors before the widget has
been realized, so we do this directly after realization */
gtk_signal_connect( GTK_OBJECT(connect_widget), "realize",
GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this );
GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this );
m_hasVMT = TRUE;
}
@@ -2142,42 +2142,42 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
int border = 0;
int bottom_border = 0;
int bottom_border = 0;
if (GTK_WIDGET_CAN_DEFAULT(m_widget))
{
/* the default button has a border around it */
border = 6;
bottom_border = 5;
}
{
/* the default button has a border around it */
border = 6;
bottom_border = 5;
}
/* this is the result of hours of debugging: the following code
means that if we have a m_wxwindow and we set the size of
m_widget, m_widget (which is a GtkScrolledWindow) does NOT
automatically propagate its size down to its m_wxwindow,
which is its client area. therefore, we have to tell the
client area directly that it has to resize itself.
this will lead to that m_widget (GtkScrolledWindow) will
calculate how much size it needs for scrollbars etc and
it will then call XXX_size_allocate of its child, which
is m_wxwindow. m_wxwindow in turn will do the same with its
children and so on. problems can arise if this happens
before all the children have been realized as some widgets
stupidy need to be realized during XXX_size_allocate (e.g.
GtkNotebook) and they will segv if called otherwise. this
emergency is tested in gtk_myfixed_size_allocate. Normally
this shouldn't be needed and only gtk_widget_queue_resize()
should be enough to provoke a resize at the next appropriate
moment, but this seems to fail, e.g. when a wxNotebook contains
a wxSplitterWindow: the splitter window's children won't
show up properly resized then. */
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow),
m_widget,
m_x-border,
m_y-border,
m_width+2*border,
m_height+border+bottom_border );
/* this is the result of hours of debugging: the following code
means that if we have a m_wxwindow and we set the size of
m_widget, m_widget (which is a GtkScrolledWindow) does NOT
automatically propagate its size down to its m_wxwindow,
which is its client area. therefore, we have to tell the
client area directly that it has to resize itself.
this will lead to that m_widget (GtkScrolledWindow) will
calculate how much size it needs for scrollbars etc and
it will then call XXX_size_allocate of its child, which
is m_wxwindow. m_wxwindow in turn will do the same with its
children and so on. problems can arise if this happens
before all the children have been realized as some widgets
stupidy need to be realized during XXX_size_allocate (e.g.
GtkNotebook) and they will segv if called otherwise. this
emergency is tested in gtk_myfixed_size_allocate. Normally
this shouldn't be needed and only gtk_widget_queue_resize()
should be enough to provoke a resize at the next appropriate
moment, but this seems to fail, e.g. when a wxNotebook contains
a wxSplitterWindow: the splitter window's children won't
show up properly resized then. */
gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow),
m_widget,
m_x-border,
m_y-border,
m_width+2*border,
m_height+border+bottom_border );
}
m_sizeSet = TRUE;
@@ -2196,13 +2196,13 @@ void wxWindow::OnInternalIdle()
{
wxCursor cursor = m_cursor;
if (g_globalCursor.Ok()) cursor = g_globalCursor;
if (cursor.Ok() && m_currentGdkCursor != cursor)
{
gdk_window_set_cursor( window, cursor.GetCursor() );
m_currentGdkCursor = cursor;
}
}
if (cursor.Ok() && m_currentGdkCursor != cursor)
{
gdk_window_set_cursor( window, cursor.GetCursor() );
m_currentGdkCursor = cursor;
}
}
UpdateWindowUI();
}
@@ -2513,7 +2513,7 @@ bool wxWindow::AcceptsFocus() const
bool wxWindow::Reparent( wxWindow *newParent )
{
wxCHECK_MSG( (m_widget != NULL), FALSE, _T("invalid window") );
wxWindow *oldParent = m_parent;
if ( !wxWindowBase::Reparent(newParent) )
@@ -2523,27 +2523,27 @@ bool wxWindow::Reparent( wxWindow *newParent )
{
gtk_container_remove( GTK_CONTAINER(oldParent->m_wxwindow), m_widget );
}
if (newParent)
{
/* insert GTK representation */
(*(newParent->m_insertCallback))(newParent, this);
}
return TRUE;
}
void wxWindow::DoAddChild(wxWindow *child)
void wxWindow::DoAddChild(wxWindow *child)
{
wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
wxASSERT_MSG( (child != NULL), _T("invalid child window") );
wxASSERT_MSG( (m_insertCallback != NULL), _T("invalid child insertion function") );
/* add to list */
AddChild( child );
/* insert GTK representation */
(*m_insertCallback)(this, child);
}
@@ -2576,16 +2576,16 @@ bool wxWindow::SetCursor( const wxCursor &cursor )
// been realized
if (!m_delayedCursor) return FALSE;
}
GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window)
{
// indicate that a new style has been set
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedCursor = TRUE;
// pretend we have done something
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedCursor = TRUE;
// pretend we have done something
return TRUE;
}
@@ -2603,7 +2603,7 @@ void wxWindow::WarpPointer( int x, int y )
if (connect_widget->window)
{
/* we provide this function ourselves as it is
missing in GDK */
missing in GDK */
gdk_window_warp_pointer( connect_widget->window, x, y );
}
}
@@ -2687,16 +2687,16 @@ bool wxWindow::SetBackgroundColour( const wxColour &colour )
// been realized
if (!m_delayedBackgroundColour) return FALSE;
}
GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window)
{
// indicate that a new style has been set
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedBackgroundColour = TRUE;
// pretend we have done something
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedBackgroundColour = TRUE;
// pretend we have done something
return TRUE;
}
@@ -2734,16 +2734,16 @@ bool wxWindow::SetForegroundColour( const wxColour &colour )
// been realized
if (!m_delayedForegroundColour) return FALSE;
}
GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window)
{
// indicate that a new style has been set
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedForegroundColour = TRUE;
// pretend we have done something
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedForegroundColour = TRUE;
// pretend we have done something
return TRUE;
}
@@ -2890,7 +2890,7 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
bool wxWindow::SetFont( const wxFont &font )
{
wxCHECK_MSG( m_widget != NULL, FALSE, _T( "invalid window") );
wxCHECK_MSG( m_widget != NULL, FALSE, _T( "invalid window") );
if (!wxWindowBase::SetFont(font))
{
@@ -2898,16 +2898,16 @@ bool wxWindow::SetFont( const wxFont &font )
// been realized
if (!m_delayedFont) return FALSE;
}
GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window)
{
// indicate that a new style has been set
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedFont = TRUE;
// pretend we have done something
// but it couldn't get applied as the
// widget hasn't been realized yet.
m_delayedFont = TRUE;
// pretend we have done something
return TRUE;
}
@@ -2934,7 +2934,7 @@ void wxWindow::CaptureMouse()
GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) return;
gdk_pointer_grab( connect_widget->window, FALSE,
(GdkEventMask)
(GDK_BUTTON_PRESS_MASK |
@@ -2954,7 +2954,7 @@ void wxWindow::ReleaseMouse()
GtkWidget *connect_widget = GetConnectWidget();
if (!connect_widget->window) return;
gdk_pointer_ungrab ( GDK_CURRENT_TIME );
g_captureWindow = (wxWindow*) NULL;
}
@@ -3114,16 +3114,16 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
m_scrollGC = gdk_gc_new( m_wxwindow->window );
gdk_gc_set_exposures( m_scrollGC, TRUE );
}
wxNode *node = m_children.First();
while (node)
{
wxWindow *child = (wxWindow*) node->Data();
int sx = 0;
int sy = 0;
child->GetSize( &sx, &sy );
child->SetSize( child->m_x + dx, child->m_y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE );
node = node->Next();
int sx = 0;
int sy = 0;
child->GetSize( &sx, &sy );
child->SetSize( child->m_x + dx, child->m_y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE );
node = node->Next();
}
int cw = 0;
@@ -3131,7 +3131,7 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
GetClientSize( &cw, &ch );
int w = cw - abs(dx);
int h = ch - abs(dy);
if ((h < 0) || (w < 0))
{
Refresh();

View File

@@ -51,6 +51,7 @@ libwx_msw_la_SOURCES = \
date.cpp \
datstrm.cpp \
dcbase.cpp \
dlgcmn.cpp \
docmdi.cpp \
docview.cpp \
dynlib.cpp \
@@ -114,6 +115,7 @@ libwx_msw_la_SOURCES = \
statusbr.cpp \
tabg.cpp \
textdlgg.cpp \
tipdlg.cpp \
\
accel.cpp \
app.cpp \

View File

@@ -38,8 +38,8 @@ class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData
{
friend class WXDLLEXPORT wxAcceleratorTable;
public:
wxAcceleratorRefData(void);
~wxAcceleratorRefData(void);
wxAcceleratorRefData();
~wxAcceleratorRefData();
inline HACCEL GetHACCEL() const { return m_hAccel; }
protected:
@@ -132,13 +132,14 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]
M_ACCELDATA->m_ok = (M_ACCELDATA->m_hAccel != 0);
}
#else
#else // Win16
wxAcceleratorTable::wxAcceleratorTable(int WXUNUSED(n), const wxAcceleratorEntry WXUNUSED(entries)[])
{
wxFAIL_MSG("not implemented");
}
#endif
#endif // Win32/16
bool wxAcceleratorTable::Ok(void) const
bool wxAcceleratorTable::Ok() const
{
return (M_ACCELDATA && (M_ACCELDATA->m_ok));
}
@@ -158,3 +159,8 @@ WXHACCEL wxAcceleratorTable::GetHACCEL() const
return (WXHACCEL) M_ACCELDATA->m_hAccel;
}
bool wxAcceleratorTable::Translate(wxWindow *window, WXMSG *wxmsg) const
{
MSG *msg = (MSG *)wxmsg;
return Ok() && ::TranslateAccelerator(GetHwndOf(window), GetHaccel(), msg); }

View File

@@ -846,10 +846,7 @@ bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
return FALSE;
const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable();
return acceleratorTable.Ok() &&
::TranslateAccelerator(GetHwnd(),
GetTableHaccel(acceleratorTable),
(MSG *)pMsg);
return acceleratorTable.Translate(this, pMsg);
}
// ---------------------------------------------------------------------------
@@ -863,7 +860,7 @@ bool wxFrame::HandlePaint()
{
if ( m_iconized )
{
HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon)
HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
: (HICON)m_defaultIcon;
// Hold a pointer to the dc so long as the OnPaint() message
@@ -1059,7 +1056,7 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
case WM_QUERYDRAGICON:
{
HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon)
HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
: (HICON)(m_defaultIcon);
rc = (long)hIcon;
processed = rc != 0;

View File

@@ -86,6 +86,7 @@ GENERICOBJS= \
$(MSWDIR)\statusbr.obj \
$(MSWDIR)\tabg.obj \
$(MSWDIR)\textdlgg.obj \
$(MSWDIR)\tipdlg.obj
# Not needed:
# $(MSWDIR)\colrdlgg.obj \
@@ -102,6 +103,7 @@ COMMONOBJS = \
$(MSWDIR)\config.obj \
$(MSWDIR)\cmndata.obj \
$(MSWDIR)\dcbase.obj \
$(MSWDIR)\dlgcmn.obj \
$(MSWDIR)\docview.obj \
$(MSWDIR)\docmdi.obj \
$(MSWDIR)\dynarray.obj \
@@ -239,6 +241,7 @@ MSWOBJS = \
$(MSWDIR)\spinbutt.obj \
$(MSWDIR)\statbmp.obj \
$(MSWDIR)\statbox.obj \
$(MSWDIR)\statline.obj \
$(MSWDIR)\stattext.obj \
$(MSWDIR)\statbr95.obj \
$(MSWDIR)\tabctrl.obj \
@@ -445,6 +448,8 @@ $(MSWDIR)\statbmp.obj: $(MSWDIR)\statbmp.$(SRCSUFF)
$(MSWDIR)\statbox.obj: $(MSWDIR)\statbox.$(SRCSUFF)
$(MSWDIR)\statline.obj: $(MSWDIR)\statline.$(SRCSUFF)
$(MSWDIR)\statbr95.obj: $(MSWDIR)\statbr95.$(SRCSUFF)
$(MSWDIR)\stattext.obj: $(MSWDIR)\stattext.$(SRCSUFF)
@@ -600,6 +605,8 @@ $(MSWDIR)\stream.obj: $(COMMDIR)\stream.$(SRCSUFF)
$(MSWDIR)\objstrm.obj: $(COMMDIR)\objstrm.$(SRCSUFF)
$(MSWDIR)\dlgcmn.obj: $(COMMDIR)\dlgcmn.$(SRCSUFF)
$(MSWDIR)\wincmn.obj: $(COMMDIR)\wincmn.$(SRCSUFF)
$(MSWDIR)\extended.obj: $(COMMDIR)\extended.c
@@ -668,6 +675,8 @@ $(MSWDIR)\statusbr.obj: $(GENDIR)\statusbr.$(SRCSUFF)
$(MSWDIR)\textdlgg.obj: $(GENDIR)\textdlgg.$(SRCSUFF)
$(MSWDIR)\tipdlg.obj: $(GENDIR)\tipdlg.$(SRCSUFF)
$(MSWDIR)\tabg.obj: $(GENDIR)\tabg.$(SRCSUFF)
all_utils:

View File

@@ -89,6 +89,7 @@ GENERICOBJS= \
$(MSWDIR)\statusbr.obj \
$(MSWDIR)\tabg.obj \
$(MSWDIR)\textdlgg.obj \
$(MSWDIR)\tipdlg.obj \
$(MSWDIR)\treectrl.obj
# $(MSWDIR)\msgdlgg.obj \
@@ -144,6 +145,7 @@ COMMONOBJS = \
$(MSWDIR)\datstrm.obj \
$(MSWDIR)\sckstrm.obj \
$(MSWDIR)\extended.obj \
$(MSWDIR)\dlgcmn.obj \
$(MSWDIR)\wincmn.obj \
$(MSWDIR)\objstrm.obj \
$(MSWDIR)\dynlib.obj \
@@ -230,6 +232,7 @@ MSWOBJS = \
$(MSWDIR)\spinbutt.obj \
$(MSWDIR)\statbmp.obj \
$(MSWDIR)\statbox.obj \
$(MSWDIR)\statline.obj \
$(MSWDIR)\stattext.obj \
$(MSWDIR)\tbarmsw.obj \
$(MSWDIR)\textctrl.obj \
@@ -425,6 +428,8 @@ $(MSWDIR)\statbmp.obj: $(MSWDIR)\statbmp.$(SRCSUFF)
$(MSWDIR)\statbox.obj: $(MSWDIR)\statbox.$(SRCSUFF)
$(MSWDIR)\statline.obj: $(MSWDIR)\statline.$(SRCSUFF)
$(MSWDIR)\statbr95.obj: $(MSWDIR)\statbr95.$(SRCSUFF)
$(MSWDIR)\stattext.obj: $(MSWDIR)\stattext.$(SRCSUFF)
@@ -572,6 +577,8 @@ $(MSWDIR)\stream.obj: $(COMMDIR)\stream.$(SRCSUFF)
$(MSWDIR)\objstrm.obj: $(COMMDIR)\objstrm.$(SRCSUFF)
$(MSWDIR)\dlgcmn.obj: $(COMMDIR)\dlgcmn.$(SRCSUFF)
$(MSWDIR)\wincmn.obj: $(COMMDIR)\wincmn.$(SRCSUFF)
$(MSWDIR)\extended.obj: $(COMMDIR)\extended.c
@@ -638,6 +645,8 @@ $(MSWDIR)\statusbr.obj: $(GENDIR)\statusbr.$(SRCSUFF)
$(MSWDIR)\textdlgg.obj: $(GENDIR)\textdlgg.$(SRCSUFF)
$(MSWDIR)\tipdlg.obj: $(GENDIR)\tipdlg.$(SRCSUFF)
$(MSWDIR)\tabg.obj: $(GENDIR)\tabg.$(SRCSUFF)
$(MSWDIR)\treectrl.obj: $(GENDIR)\treectrl.$(SRCSUFF)

View File

@@ -71,6 +71,7 @@ GENERICOBJS= \
$(GENDIR)\statusbr.obj \
$(GENDIR)\tabg.obj \
$(GENDIR)\textdlgg.obj\
$(GENDIR)\tipdlg.obj\
$(GENDIR)\prntdlgg.obj \
$(GENDIR)\treectrl.obj
@@ -128,6 +129,7 @@ COMMONOBJS = \
$(COMMDIR)\zstream.obj \
$(COMMDIR)\datstrm.obj \
$(COMMDIR)\extended.obj \
$(COMMDIR)\dlgcmn.obj \
$(COMMDIR)\wincmn.obj \
$(COMMDIR)\wxchar.obj
@@ -201,6 +203,7 @@ MSWOBJS = \
$(MSWDIR)\spinbutt.obj \
$(MSWDIR)\statbmp.obj \
$(MSWDIR)\statbox.obj \
$(MSWDIR)\statline.obj \
$(MSWDIR)\stattext.obj \
$(MSWDIR)\tbarmsw.obj \
$(MSWDIR)\textctrl.obj \
@@ -610,6 +613,11 @@ $(MSWDIR)/statbox.obj: $*.$(SRCSUFF)
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
$(MSWDIR)/statline.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
$(MSWDIR)/stattext.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
@@ -948,6 +956,11 @@ $(COMMDIR)/extended.obj: $*.c
$(CPPFLAGS2) /Fo$@ /c /Tp $*.c
<<
$(COMMDIR)/dlgcmn.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
$(COMMDIR)/wincmn.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
@@ -1083,6 +1096,11 @@ $(GENDIR)/textdlgg.obj: $*.$(SRCSUFF)
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
$(GENDIR)/tipdlg.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
$(GENDIR)/treectrl.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)

View File

@@ -69,6 +69,7 @@ GENERICOBJS= \
$(GENDIR)/statusbr.$(OBJSUFF) \
$(GENDIR)/tabg.$(OBJSUFF) \
$(GENDIR)/textdlgg.$(OBJSUFF)
$(GENDIR)/tipdlg.$(OBJSUFF)
# $(GENDIR)/colrdlgg.$(OBJSUFF) \
# $(GENDIR)/fontdlgg.$(OBJSUFF) \
@@ -131,6 +132,7 @@ COMMONOBJS = \
$(COMMDIR)/datstrm.$(OBJSUFF) \
$(COMMDIR)/objstrm.$(OBJSUFF) \
$(COMMDIR)/extended.$(OBJSUFF) \
$(COMMDIR)/dlgcmn.$(OBJSUFF) \
$(COMMDIR)/wincmn.$(OBJSUFF) \
$(COMMDIR)/wxchar.$(OBJSUFF)
@@ -214,6 +216,7 @@ MSWOBJS = \
spinbutt.$(OBJSUFF) \
statbmp.$(OBJSUFF) \
statbox.$(OBJSUFF) \
statline.$(OBJSUFF) \
statbr95.$(OBJSUFF) \
stattext.$(OBJSUFF) \
tabctrl.$(OBJSUFF) \

View File

@@ -35,7 +35,8 @@ GENERICOBJS= \
$(GENDIR)\splitter.obj \
$(GENDIR)\statusbr.obj \
$(GENDIR)\tabg.obj \
$(GENDIR)\textdlgg.obj
$(GENDIR)\textdlgg.obj \
$(GENDIR)\tipdlg.obj
# $(GENDIR)\imaglist.obj \
# $(GENDIR)\treectrl.obj \
@@ -105,6 +106,7 @@ COMMONOBJS = \
$(COMMDIR)\datstrm.obj \
$(COMMDIR)\objstrm.obj \
$(COMMDIR)\variant.obj \
$(COMMDIR)\dlgcmn.obj \
$(COMMDIR)\wincmn.obj \
$(COMMDIR)\wxchar.obj
@@ -189,6 +191,7 @@ MSWOBJS = \
$(MSWDIR)\spinbutt.obj \
$(MSWDIR)\statbmp.obj \
$(MSWDIR)\statbox.obj \
$(MSWDIR)\statline.obj \
$(MSWDIR)\statbr95.obj \
$(MSWDIR)\stattext.obj \
$(MSWDIR)\tabctrl.obj \

View File

@@ -79,7 +79,8 @@ GENERICOBJS= \
..\generic\$D\splitter.obj \
..\generic\$D\statusbr.obj \
..\generic\$D\tabg.obj \
..\generic\$D\textdlgg.obj
..\generic\$D\textdlgg.obj \
..\generic\$D\tipdlg.obj
# ..\generic\$D\imaglist.obj \
# ..\generic\$D\treectrl.obj \
@@ -165,6 +166,7 @@ COMMONOBJS = \
..\common\$D\datstrm.obj \
..\common\$D\objstrm.obj \
..\common\$D\variant.obj \
..\common\$D\dlgcmn.obj \
..\common\$D\wincmn.obj \
..\common\$D\wxchar.obj
@@ -240,6 +242,7 @@ MSWOBJS = \
..\msw\$D\spinbutt.obj \
..\msw\$D\statbmp.obj \
..\msw\$D\statbox.obj \
..\msw\$D\statline.obj \
..\msw\$D\statbr95.obj \
..\msw\$D\stattext.obj \
..\msw\$D\tabctrl.obj \

View File

@@ -39,7 +39,8 @@ GENERICOBJS= choicdgg.obj &
splitter.obj &
statusbr.obj &
tabg.obj &
textdlgg.obj
textdlgg.obj &
tipdlg.obj
# These are generic things that don't need to be compiled on MSW,
# but sometimes it's useful to do so for testing purposes.
@@ -112,6 +113,7 @@ COMMONOBJS = cmndata.obj &
datstrm.obj &
objstrm.obj &
variant.obj &
dlgcmn.obj &
wincmn.obj &
wxchar.obj
@@ -191,6 +193,7 @@ MSWOBJS = &
spinbutt.obj &
statbmp.obj &
statbox.obj &
statline.obj &
statbr95.obj &
stattext.obj &
tabctrl.obj &
@@ -453,6 +456,9 @@ statbmp.obj: $(MSWDIR)\statbmp.cpp
statbox.obj: $(MSWDIR)\statbox.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
statline.obj: $(MSWDIR)\statline.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
statbr95.obj: $(MSWDIR)\statbr95.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
@@ -720,6 +726,9 @@ process.obj: $(COMMDIR)\process.cpp
variant.obj: $(COMMDIR)\variant.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
dlgcmn.obj: $(COMMDIR)\dlgcmn.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
wincmn.obj: $(COMMDIR)\wincmn.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
@@ -801,6 +810,9 @@ tabg.obj: $(GENDIR)\tabg.cpp
textdlgg.obj: $(GENDIR)\textdlgg.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
tipdlg.obj: $(GENDIR)\tipdlg.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
crbuffri.obj: $(XPMDIR)\crbuffri.c
*$(CC) $(CPPFLAGS) $(IFLAGS) $<

View File

@@ -537,10 +537,7 @@ bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
return TRUE;
}
if ( m_acceleratorTable.Ok() &&
::TranslateAccelerator(GetHwnd(),
GetTableHaccel(m_acceleratorTable),
pMsg) )
if ( m_acceleratorTable.Translate(this, msg) )
{
return TRUE;
}
@@ -993,15 +990,7 @@ long wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXUINT wParam, WXLPARAM l
bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
{
MSG *pMsg = (MSG *)msg;
if ( m_acceleratorTable.Ok() )
{
return ::TranslateAccelerator(GetWinHwnd(GetParent()),
GetTableHaccel(m_acceleratorTable),
pMsg) != 0;
}
return FALSE;
return m_acceleratorTable.Translate(GetParent(), msg);
}
// ---------------------------------------------------------------------------

View File

@@ -69,10 +69,6 @@ static const int idMenuTitle = -2;
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
#endif
// convenience macros
#define GetHMENU() ((HMENU)GetHMenu())
#define GetHMenuOf(menu) ((HMENU)menu->GetHMenu())
// ============================================================================
// implementation
// ============================================================================
@@ -257,7 +253,7 @@ void wxMenu::Append(wxMenuItem *pItem)
pData = label;
}
if ( !::AppendMenu(GetHMENU(), flags, id, pData) )
if ( !::AppendMenu(GetHmenu(), flags, id, pData) )
{
wxLogLastError("AppendMenu");
}
@@ -272,7 +268,7 @@ void wxMenu::Append(wxMenuItem *pItem)
mii.fMask = MIIM_STATE;
mii.fState = MFS_DEFAULT;
if ( !SetMenuItemInfo(GetHMENU(), (unsigned)id, FALSE, &mii) )
if ( !SetMenuItemInfo(GetHmenu(), (unsigned)id, FALSE, &mii) )
{
wxLogLastError(_T("SetMenuItemInfo"));
}
@@ -323,7 +319,7 @@ void wxMenu::Delete(int id)
wxCHECK_RET( node, _T("wxMenu::Delete(): item doesn't exist") );
HMENU menu = GetHMENU();
HMENU menu = GetHmenu();
wxMenu *pSubMenu = item->GetSubMenu();
if ( pSubMenu != NULL ) {
@@ -453,7 +449,7 @@ void wxMenu::SetTitle(const wxString& label)
bool hasNoTitle = m_title.IsEmpty();
m_title = label;
HMENU hMenu = GetHMENU();
HMENU hMenu = GetHmenu();
if ( hasNoTitle )
{
@@ -622,27 +618,6 @@ wxMenuItem *wxMenu::FindItemForId(int itemId, wxMenu ** itemMenu) const
// other
// ---------------------------------------------------------------------------
bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
{
menu->SetInvokingWindow(this);
menu->UpdateUI();
HWND hWnd = (HWND) GetHWND();
HMENU hMenu = (HMENU)menu->GetHMenu();
POINT point;
point.x = x;
point.y = y;
::ClientToScreen(hWnd, &point);
wxCurrentPopupMenu = menu;
::TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, point.x, point.y, 0, hWnd, NULL);
wxYield();
wxCurrentPopupMenu = NULL;
menu->SetInvokingWindow(NULL);
return TRUE;
}
void wxMenu::Attach(wxMenuBar *menubar)
{
// menu can be in at most one menubar because otherwise they would both
@@ -793,7 +768,7 @@ bool wxMenuBar::IsChecked(int id) const
wxCHECK_MSG( item, FALSE, _T("wxMenuBar::IsChecked(): no such item") );
int flag = ::GetMenuState(GetHMenuOf(itemMenu), id, MF_BYCOMMAND);
int flag = ::GetMenuState(GetHmenuOf(itemMenu), id, MF_BYCOMMAND);
return (flag & MF_CHECKED) != 0;
}
@@ -805,7 +780,7 @@ bool wxMenuBar::IsEnabled(int id) const
wxCHECK_MSG( item, FALSE, _T("wxMenuBar::IsEnabled(): no such item") );
int flag = ::GetMenuState(GetHMenuOf(itemMenu), id, MF_BYCOMMAND) ;
int flag = ::GetMenuState(GetHmenuOf(itemMenu), id, MF_BYCOMMAND) ;
return (flag & MF_ENABLED) != 0;
}
@@ -879,7 +854,7 @@ void wxMenuBar::SetLabelTop(int pos, const wxString& label)
id = pos;
}
if ( ::ModifyMenu(GetHMENU(), pos, MF_BYPOSITION | MF_STRING | flagsOld,
if ( ::ModifyMenu(GetHmenu(), pos, MF_BYPOSITION | MF_STRING | flagsOld,
id, label) == 0xFFFFFFFF )
{
wxLogLastError("ModifyMenu");
@@ -892,7 +867,7 @@ wxString wxMenuBar::GetLabelTop(int pos) const
len++; // for the NUL character
wxString label;
::GetMenuString(GetHMENU(), pos, label.GetWriteBuf(len), len, MF_BYCOMMAND);
::GetMenuString(GetHmenu(), pos, label.GetWriteBuf(len), len, MF_BYCOMMAND);
label.UngetWriteBuf();
return label;
@@ -938,7 +913,7 @@ bool wxMenuBar::OnAppend(wxMenu *a_menu, const wxChar *title)
a_menu->Attach(this);
if ( !::AppendMenu(GetHMENU(), MF_POPUP | MF_STRING,
if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING,
(UINT)submenu, title) )
{
wxLogLastError(_T("AppendMenu"));

82
src/msw/statline.cpp Normal file
View File

@@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////
// Name: msw/statline.cpp
// Purpose: MSW version of wxStaticLine class
// Author: Vadim Zeitlin
// Created: 28.06.99
// Version: $Id$
// Copyright: (c) 1998 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation "statline.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/statline.h"
#include "wx/msw/private.h"
// ============================================================================
// implementation
// ============================================================================
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
// ----------------------------------------------------------------------------
// wxStaticLine
// ----------------------------------------------------------------------------
bool wxStaticLine::Create( wxWindow *parent,
wxWindowID id,
const wxPoint &pos,
const wxSize &size,
long style,
const wxString &name)
{
if ( !CreateBase(parent, id, pos, size, style, name) )
return FALSE;
parent->AddChild(this);
wxSize sizeReal = AdjustSize(size);
m_hWnd = (WXHWND)::CreateWindow
(
_T("STATIC"),
"",
WS_VISIBLE | WS_CHILD |
SS_GRAYRECT | SS_SUNKEN,// | SS_ETCHEDFRAME,
pos.x, pos.y, sizeReal.x, sizeReal.y,
GetWinHwnd(parent),
(HMENU)m_windowId,
wxGetInstance(),
NULL
);
if ( !m_hWnd )
{
wxLogDebug(_T("Failed to create static control"));
return FALSE;
}
SubclassWin(m_hWnd);
return TRUE;
}

View File

@@ -1280,3 +1280,8 @@ void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
event.Enable( CanRedo() );
}
bool wxTextCtrl::AcceptsFocus() const
{
// we don't want focus if we can't be edited
return IsEditable() && wxControl::AcceptsFocus();
}

View File

@@ -281,11 +281,10 @@ wxWindow::~wxWindow()
{
if ( !::DestroyWindow(GetHwnd()) )
wxLogLastError("DestroyWindow");
}
// Restore old Window proc, if required and remove hWnd <-> wxWindow
// association
UnsubclassWin();
// remove hWnd <-> wxWindow association
wxRemoveHandleAssociation(this);
}
}
// real construction (Init() must have been called before!)
@@ -328,7 +327,6 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id,
// want everything: i.e. all keys and WM_CHAR message
m_lDlgCode = DLGC_WANTARROWS | DLGC_WANTCHARS |
DLGC_WANTTAB | DLGC_WANTMESSAGE;
}
MSWCreate(m_windowId, parent, wxCanvasClassName, this, NULL,
@@ -448,7 +446,7 @@ bool wxWindow::SetFont(const wxFont& font)
wxASSERT_MSG( hFont, _T("should have valid font") );
::SendMessage(hWnd, WM_SETFONT, (WPARAM)hFont, TRUE);
::SendMessage(hWnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
}
return TRUE;
@@ -801,10 +799,13 @@ void wxWindow::SubclassWin(WXHWND hWnd)
{
wxASSERT_MSG( !m_oldWndProc, _T("subclassing window twice?") );
wxAssociateWinWithHandle((HWND)hWnd, this);
HWND hwnd = (HWND)hWnd;
wxCHECK_RET( ::IsWindow(hwnd), _T("invalid HWND in SubclassWin") );
m_oldWndProc = (WXFARPROC) GetWindowLong((HWND) hWnd, GWL_WNDPROC);
SetWindowLong((HWND) hWnd, GWL_WNDPROC, (LONG) wxWndProc);
wxAssociateWinWithHandle(hwnd, this);
m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
}
void wxWindow::UnsubclassWin()
@@ -812,16 +813,19 @@ void wxWindow::UnsubclassWin()
wxRemoveHandleAssociation(this);
// Restore old Window proc
if ( GetHwnd() )
HWND hwnd = GetHwnd();
if ( hwnd )
{
FARPROC farProc = (FARPROC) GetWindowLong(GetHwnd(), GWL_WNDPROC);
m_hWnd = 0;
wxCHECK_RET( ::IsWindow(hwnd), _T("invalid HWND in SubclassWin") );
FARPROC farProc = (FARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
if ( (m_oldWndProc != 0) && (farProc != (FARPROC) m_oldWndProc) )
{
SetWindowLong(GetHwnd(), GWL_WNDPROC, (LONG) m_oldWndProc);
SetWindowLong(hwnd, GWL_WNDPROC, (LONG) m_oldWndProc);
m_oldWndProc = 0;
}
m_hWnd = 0;
}
}
@@ -1368,6 +1372,31 @@ void wxWindow::GetCaretPos(int *x, int *y) const
}
#endif // wxUSE_CARET
// ---------------------------------------------------------------------------
// popup menu
// ---------------------------------------------------------------------------
bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
{
menu->SetInvokingWindow(this);
menu->UpdateUI();
HWND hWnd = GetHwnd();
HMENU hMenu = GetHmenuOf(menu);
POINT point;
point.x = x;
point.y = y;
::ClientToScreen(hWnd, &point);
wxCurrentPopupMenu = menu;
::TrackPopupMenu(hMenu, TPM_RIGHTBUTTON, point.x, point.y, 0, hWnd, NULL);
wxYield();
wxCurrentPopupMenu = NULL;
menu->SetInvokingWindow(NULL);
return TRUE;
}
// ===========================================================================
// pre/post message processing
// ===========================================================================
@@ -1454,9 +1483,28 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
// buttons want process Enter themselevs
bProcess = FALSE;
}
// else: but if it does not it makes sense to make it
// work like a TAB - and that's what we do.
// Note that Ctrl-Enter always works this way.
else
{
wxPanel *panel = wxDynamicCast(this, wxPanel);
wxButton *btn = NULL;
if ( panel )
{
// panel may have a default button which should
// be activated by Enter
btn = panel->GetDefaultItem();
}
if ( btn )
{
// if we do have a default button, do press it
btn->MSWCommand(BN_CLICKED, 0 /* unused */);
return TRUE;
}
// else: but if it does not it makes sense to make
// it work like a TAB - and that's what we do.
// Note that Ctrl-Enter always works this way.
}
}
break;
@@ -1504,10 +1552,7 @@ bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
bool wxWindow::MSWTranslateMessage(WXMSG* pMsg)
{
return m_acceleratorTable.Ok() &&
::TranslateAccelerator(GetHwnd(),
GetTableHaccel(m_acceleratorTable),
(MSG *)pMsg);
return m_acceleratorTable.Translate(this, pMsg);
}
// ---------------------------------------------------------------------------