#pragma hdrstop
#endif
+#if wxUSE_PROPSHEET
+
#ifndef WX_PRECOMP
#include "wx/window.h"
#include "wx/font.h"
#include "wx/sizer.h"
#include "wx/module.h"
#include "wx/intl.h"
+#include "wx/artprov.h"
#include "wx/colordlg.h"
#include "wx/proplist.h"
#include <math.h>
#include <string.h>
-// ----------------------------------------------------------------------------
-// XPMs
-// ----------------------------------------------------------------------------
-
-#ifndef __WXMSW__
- #include "wx/generic/cross.xpm"
- #include "wx/generic/tick.xpm"
-#endif
-
-// ----------------------------------------------------------------------------
-// accessor functions for the bitmaps (may return NULL, check for it!)
-// ----------------------------------------------------------------------------
-
-static wxBitmap *GetTickBitmap();
-static wxBitmap *GetCrossBitmap();
-
// ----------------------------------------------------------------------------
// Property text edit control
// ----------------------------------------------------------------------------
-IMPLEMENT_CLASS(wxPropertyTextEdit, wxTextCtrl)
+IMPLEMENT_DYNAMIC_CLASS(wxPropertyTextEdit, wxTextCtrl)
wxPropertyTextEdit::wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent,
const wxWindowID id, const wxString& value,
if (clearEditArea)
{
m_valueList->Clear();
- m_valueText->SetValue("");
+ m_valueText->SetValue(_T(""));
}
wxNode *node = m_propertySheet->GetProperties().First();
// Find the wxListBox index corresponding to this property
int wxPropertyListView::FindListIndexForProperty(wxProperty *property)
{
- int n = m_propertyScrollingList->Number();
+ int n = m_propertyScrollingList->GetCount();
for (int i = 0; i < n; i++)
{
if (property == (wxProperty *)m_propertyScrollingList->wxListBox::GetClientData(i))
}
m_valueList->Clear();
- m_valueText->SetValue("");
+ m_valueText->SetValue(_T(""));
if (property)
{
{
wxPanel *panel = (wxPanel *)m_propertyWindow;
- wxSize largeButtonSize( 60, 25 );
+ wxSize largeButtonSize( 70, 25 );
wxSize smallButtonSize( 23, 23 );
if (m_valueText)
if (!panel)
return FALSE;
- wxSystemSettings settings;
- wxFont guiFont = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
+ wxFont guiFont = wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT);
#ifdef __WXMSW__
- wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxMODERN, wxNORMAL, wxNORMAL, FALSE, "Courier New");
+ wxFont *boringFont =
+ wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxMODERN,
+ wxNORMAL, wxNORMAL, FALSE, _T("Courier New"));
#else
wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxTELETYPE, wxNORMAL, wxNORMAL);
#endif
if (m_buttonFlags & wxPROP_BUTTON_CHECK_CROSS)
{
- wxBitmap *tickBitmap = GetTickBitmap();
- wxBitmap *crossBitmap = GetCrossBitmap();
+ wxBitmap tickBitmap = wxArtProvider::GetBitmap(wxART_TICK_MARK);
+ wxBitmap crossBitmap = wxArtProvider::GetBitmap(wxART_CROSS_MARK);
- if ( tickBitmap && crossBitmap )
+ if ( tickBitmap.Ok() && crossBitmap.Ok() )
{
- m_confirmButton = new wxBitmapButton(panel, wxID_PROP_CHECK, *tickBitmap, wxPoint(-1, -1), smallButtonSize );
- m_cancelButton = new wxBitmapButton(panel, wxID_PROP_CROSS, *crossBitmap, wxPoint(-1, -1), smallButtonSize );
+ m_confirmButton = new wxBitmapButton(panel, wxID_PROP_CHECK, tickBitmap, wxPoint(-1, -1), smallButtonSize );
+ m_cancelButton = new wxBitmapButton(panel, wxID_PROP_CROSS, crossBitmap, wxPoint(-1, -1), smallButtonSize );
}
else
{
- m_confirmButton = new wxButton(panel, wxID_PROP_CHECK, ":-)", wxPoint(-1, -1), smallButtonSize );
- m_cancelButton = new wxButton(panel, wxID_PROP_CROSS, "X", wxPoint(-1, -1), smallButtonSize );
+ m_confirmButton = new wxButton(panel, wxID_PROP_CHECK, _T(":-)"), wxPoint(-1, -1), smallButtonSize );
+ m_cancelButton = new wxButton(panel, wxID_PROP_CROSS, _T("X"), wxPoint(-1, -1), smallButtonSize );
}
topsizer->Add( m_confirmButton, 0, wxLEFT|wxTOP|wxBOTTOM | wxEXPAND, buttonborder );
topsizer->Add( m_cancelButton, 0, wxLEFT|wxTOP|wxBOTTOM | wxEXPAND, buttonborder );
}
- m_valueText = new wxPropertyTextEdit(this, panel, wxID_PROP_TEXT, "",
+ m_valueText = new wxPropertyTextEdit(this, panel, wxID_PROP_TEXT, _T(""),
wxPoint(-1, -1), wxSize(-1, smallButtonSize.y), wxPROCESS_ENTER);
m_valueText->Enable(FALSE);
topsizer->Add( m_valueText, 1, wxALL | wxEXPAND, buttonborder );
if (m_buttonFlags & wxPROP_PULLDOWN)
{
- m_editButton = new wxButton(panel, wxID_PROP_EDIT, "...", wxPoint(-1, -1), smallButtonSize);
+ m_editButton = new wxButton(panel, wxID_PROP_EDIT, _T("..."), wxPoint(-1, -1), smallButtonSize);
m_editButton->Enable(FALSE);
topsizer->Add( m_editButton, 0, wxRIGHT|wxTOP|wxBOTTOM | wxEXPAND, buttonborder );
}
m_windowCloseButton = new wxButton(panel, wxID_OK, _("OK"), wxPoint(-1, -1), largeButtonSize );
m_windowCloseButton->SetDefault();
m_windowCloseButton->SetFocus();
- bottomsizer->Add( m_windowCloseButton, 0, wxLEFT|wxTOP|wxBOTTOM, buttonborder );
+ bottomsizer->Add( m_windowCloseButton, 0, wxALL, buttonborder );
}
else if (m_buttonFlags & wxPROP_BUTTON_CLOSE)
{
bottomsizer->Add( m_windowHelpButton, 0, wxALL, buttonborder );
}
- mainsizer->Add( bottomsizer, 1, wxALIGN_RIGHT | wxEXPAND );
+ mainsizer->Add( bottomsizer, 0, wxALIGN_RIGHT | wxEXPAND );
}
panel->SetSizer( mainsizer );
OnCheck(event);
m_managedWindow->Close(TRUE);
+ sm_dialogCancelled = FALSE;
}
void wxPropertyListView::OnCancel(wxCommandEvent& WXUNUSED(event))
// Property dialog box
// ----------------------------------------------------------------------------
-IMPLEMENT_CLASS(wxPropertyListDialog, wxDialog)
+IMPLEMENT_DYNAMIC_CLASS(wxPropertyListDialog, wxDialog)
BEGIN_EVENT_TABLE(wxPropertyListDialog, wxDialog)
EVT_BUTTON(wxID_CANCEL, wxPropertyListDialog::OnCancel)
// Property panel
// ----------------------------------------------------------------------------
-IMPLEMENT_CLASS(wxPropertyListPanel, wxPanel)
+IMPLEMENT_DYNAMIC_CLASS(wxPropertyListPanel, wxPanel)
BEGIN_EVENT_TABLE(wxPropertyListPanel, wxPanel)
EVT_SIZE(wxPropertyListPanel::OnSize)
// Property frame
// ----------------------------------------------------------------------------
-IMPLEMENT_CLASS(wxPropertyListFrame, wxFrame)
+IMPLEMENT_DYNAMIC_CLASS(wxPropertyListFrame, wxFrame)
BEGIN_EVENT_TABLE(wxPropertyListFrame, wxFrame)
EVT_CLOSE(wxPropertyListFrame::OnCloseWindow)
bool wxPropertyListValidator::OnValueListSelect(wxProperty *property, wxPropertyListView *view, wxWindow *WXUNUSED(parentWindow))
{
wxString s(view->GetValueList()->GetStringSelection());
- if (s != T(""))
+ if (s != wxT(""))
{
view->GetValueText()->SetValue(s);
view->RetrieveProperty(property);
if (!StringToFloat(WXSTRINGCAST value, &val))
{
wxChar buf[200];
- wxSprintf(buf, T("Value %s is not a valid real number!"), value.GetData());
- wxMessageBox(buf, T("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
+ wxSprintf(buf, wxT("Value %s is not a valid real number!"), value.GetData());
+ wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
if (!StringToLong(WXSTRINGCAST value, &val))
{
wxChar buf[200];
- wxSprintf(buf, T("Value %s is not a valid integer!"), value.GetData());
- wxMessageBox(buf, T("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
+ wxSprintf(buf, wxT("Value %s is not a valid integer!"), value.GetData());
+ wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
if (val < m_integerMin || val > m_integerMax)
{
wxChar buf[200];
- wxSprintf(buf, T("Value must be an integer between %ld and %ld!"), m_integerMin, m_integerMax);
- wxMessageBox(buf, T("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
+ wxSprintf(buf, wxT("Value must be an integer between %ld and %ld!"), m_integerMin, m_integerMax);
+ wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
return TRUE;
if (!view->GetValueText())
return FALSE;
wxString value(view->GetValueText()->GetValue());
- if (value != T("True") && value != T("False"))
+ if (value != wxT("True") && value != wxT("False"))
{
- wxMessageBox(T("Value must be True or False!"), T("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
+ wxMessageBox(wxT("Value must be True or False!"), wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
return TRUE;
wxString value(view->GetValueText()->GetValue());
bool boolValue = FALSE;
- if (value == T("True"))
+ if (value == wxT("True"))
boolValue = TRUE;
else
boolValue = FALSE;
view->ShowListBoxControl(TRUE);
view->GetValueList()->Enable(TRUE);
- view->GetValueList()->Append(T("True"));
- view->GetValueList()->Append(T("False"));
+ view->GetValueList()->Append(wxT("True"));
+ view->GetValueList()->Append(wxT("False"));
wxChar *currentString = copystring(view->GetValueText()->GetValue());
view->GetValueList()->SetStringSelection(currentString);
delete[] currentString;
return FALSE;
wxString str(property->GetValue().GetStringRepresentation());
view->GetValueText()->SetValue(str);
- if (m_strings && view->GetValueList() && view->GetValueList()->IsShown() && view->GetValueList()->Number() > 0)
+ if (m_strings && view->GetValueList() && view->GetValueList()->IsShown() && view->GetValueList()->GetCount() > 0)
{
view->GetValueList()->SetStringSelection(str);
}
m_filenameWildCard.GetData(),
0,
parentWindow);
- if (s != T(""))
+ if (s != wxT(""))
{
property->GetValue() = s;
view->DisplayProperty(property);
expr = expr->GetNext();
}
- wxString title(T("Editing "));
+ wxString title(wxT("Editing "));
title += property->GetName();
if (EditStringList(parentWindow, stringList, title.GetData()))
delete[] (wxChar *)node->Data();
delete node;
m_currentSelection = -1;
- m_stringText->SetValue("");
+ m_stringText->SetValue(_T(""));
}
void wxPropertyStringListEditorDialog::OnAdd(wxCommandEvent& WXUNUSED(event))
{
SaveCurrentSelection();
- wxChar *initialText = T("");
+ wxString initialText;
wxNode *node = m_stringList->Add(initialText);
m_listBox->Append(initialText, (void *)node);
m_currentSelection = m_stringList->Number() - 1;
{
if (m_currentSelection == -1)
{
- m_stringText->SetValue("");
+ m_stringText->SetValue(_T(""));
return;
}
wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(m_currentSelection);
m_stringText->Enable(TRUE);
}
-// ----------------------------------------------------------------------------
-// global functions
-// ----------------------------------------------------------------------------
-
-// FIXME MT-UNSAFE
-static wxBitmap *GetTickBitmap()
-{
- static wxBitmap* s_tickBitmap = (wxBitmap *) NULL;
- static bool s_loaded = FALSE;
-
- if ( !s_loaded )
- {
- s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
-
- #if defined(__WXMSW__) || defined(__WXOS2__)
- s_tickBitmap = new wxBitmap("tick_bmp", wxBITMAP_TYPE_RESOURCE);
- #else
- s_tickBitmap = new wxBitmap( tick_xpm );
- #endif
- }
-
- return s_tickBitmap;
-}
-
-static wxBitmap *GetCrossBitmap()
-{
- static wxBitmap* s_crossBitmap = (wxBitmap *) NULL;
- static bool s_loaded = FALSE;
-
- if ( !s_loaded )
- {
- s_loaded = TRUE; // set it to TRUE anyhow, we won't try again
-
- #if defined(__WXMSW__) || defined(__WXOS2__)
- s_crossBitmap = new wxBitmap("cross_bmp", wxBITMAP_TYPE_RESOURCE);
- #else // XPMs
- s_crossBitmap = new wxBitmap( cross_xpm );
- #endif // BMPs/XPMs
- }
-
- return s_crossBitmap;
-}
+#endif // wxUSE_PROPSHEET