minor changes here and there

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7668 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-07-02 22:04:57 +00:00
parent 41c3173dde
commit 2e18172773
4 changed files with 73 additions and 49 deletions

View File

@@ -166,24 +166,25 @@ MyFrame::MyFrame(wxWindow *parent,
void MyFrame::ChooseColour(wxCommandEvent& WXUNUSED(event) ) void MyFrame::ChooseColour(wxCommandEvent& WXUNUSED(event) )
{ {
wxColourData data; wxColourData data;
data.SetChooseFull(TRUE); data.SetChooseFull(TRUE);
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
wxColour colour(i*16, i*16, i*16); wxColour colour(i*16, i*16, i*16);
data.SetCustomColour(i, colour); data.SetCustomColour(i, colour);
} }
wxColourDialog *dialog = new wxColourDialog(this, &data); wxColourDialog *dialog = new wxColourDialog(this, &data);
if (dialog->ShowModal() == wxID_OK) dialog->SetTitle("Choose the background colour");
{ if (dialog->ShowModal() == wxID_OK)
{
wxColourData retData = dialog->GetColourData(); wxColourData retData = dialog->GetColourData();
wxColour col = retData.GetColour(); wxColour col = retData.GetColour();
myCanvas->SetBackgroundColour(col); myCanvas->SetBackgroundColour(col);
myCanvas->Clear(); myCanvas->Clear();
myCanvas->Refresh(); myCanvas->Refresh();
} }
dialog->Destroy(); dialog->Destroy();
} }
void MyFrame::ChooseFont(wxCommandEvent& WXUNUSED(event) ) void MyFrame::ChooseFont(wxCommandEvent& WXUNUSED(event) )
@@ -609,6 +610,11 @@ void MyModalDialog::OnButton(wxCommandEvent& event)
m_btnDelete->Disable(); m_btnDelete->Disable();
} }
else if ( event.GetEventObject() == m_btnFocused )
{
wxGetTextFromUser("Dummy prompt", "Modal dialog called from dialog",
"", this);
}
else else
{ {
event.Skip(); event.Skip();

View File

@@ -408,11 +408,11 @@ void MyFrame::OnAppendMenuItem(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAppendSubMenu(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAppendSubMenu(wxCommandEvent& WXUNUSED(event))
{ {
wxMenuBar *menubar = GetMenuBar(); wxMenuBar *menubar = GetMenuBar();
wxMenu *menu = menubar->GetMenu(menubar->GetMenuCount() - 1); wxMenu *menu = menubar->GetMenu(menubar->GetMenuCount() - 1);
menu->Append(Menu_Dummy_Last, "Dummy sub menu\tCtrl-F2", menu->Append(Menu_Dummy_Last, "Dummy sub menu",
CreateDummyMenu(NULL)); CreateDummyMenu(NULL), "Dummy sub menu help");
} }
void MyFrame::OnDeleteMenuItem(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnDeleteMenuItem(wxCommandEvent& WXUNUSED(event))
@@ -498,7 +498,7 @@ void MyFrame::OnGetMenuItemInfo(wxCommandEvent& WXUNUSED(event))
msg << "The item is " << (item->IsEnabled() ? "enabled" msg << "The item is " << (item->IsEnabled() ? "enabled"
: "disabled") : "disabled")
<< '\n'; << '\n';
if ( item->IsCheckable() ) if ( item->IsCheckable() )
{ {
msg << "It is checkable and " << (item->IsChecked() ? "" : "un") msg << "It is checkable and " << (item->IsChecked() ? "" : "un")

View File

@@ -544,6 +544,10 @@ void MyTextCtrl::OnKeyDown(wxKeyEvent& event)
case WXK_F6: case WXK_F6:
SetValue("F6 was just pressed."); SetValue("F6 was just pressed.");
break; break;
case WXK_F7:
ShowPosition(10);
break;
} }
LogEvent( wxT("Key down"), event); LogEvent( wxT("Key down"), event);
@@ -634,9 +638,12 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
m_enter->SetClientData((void *)_T("enter")); m_enter->SetClientData((void *)_T("enter"));
m_textrich = new MyTextCtrl(this, -1, "Allows more than 30Kb of text\n" m_textrich = new MyTextCtrl(this, -1, "Allows more than 30Kb of text\n"
"(even under broken Win9x)", "(even under broken Win9x)\n"
"and a very very very very very "
"very very very long line to test"
"wxHSCROLL style",
wxPoint(450, 10), wxSize(200, 230), wxPoint(450, 10), wxSize(200, 230),
wxTE_RICH | wxTE_MULTILINE); wxTE_RICH | wxTE_MULTILINE | wxHSCROLL);
} }
void MyPanel::OnSize( wxSizeEvent &event ) void MyPanel::OnSize( wxSizeEvent &event )

View File

@@ -431,7 +431,18 @@ void MyFrame::OnSetImageSize(wxCommandEvent& event)
void MyFrame::OnToggleImages(wxCommandEvent& event) void MyFrame::OnToggleImages(wxCommandEvent& event)
{ {
wxGetApp().SetShowImages(!wxGetApp().ShowImages()); if ( wxGetApp().ShowImages() )
{
m_treeCtrl->CreateImageList(-1);
wxGetApp().SetShowImages(FALSE);
}
else
{
m_treeCtrl->CreateImageList();
wxGetApp().SetShowImages(TRUE);
}
OnRecreate(event); OnRecreate(event);
} }
@@ -525,42 +536,42 @@ void MyTreeCtrl::CreateImageList(int size)
if ( size == -1 ) if ( size == -1 )
{ {
m_imageListNormal = NULL; m_imageListNormal = NULL;
return;
} }
else
// Make an image list containing small icons
m_imageListNormal = new wxImageList(size, size, TRUE);
// should correspond to TreeCtrlIcon_xxx enum
#if defined(__WXMSW__) && defined(__WIN16__)
m_imageListNormal->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE));
m_imageListNormal->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE));
m_imageListNormal->Add(wxBitmap("bitmap3", wxBITMAP_TYPE_BMP_RESOURCE));
m_imageListNormal->Add(wxBitmap("bitmap4", wxBITMAP_TYPE_BMP_RESOURCE));
m_imageListNormal->Add(wxBitmap("bitmap5", wxBITMAP_TYPE_BMP_RESOURCE));
#else
wxIcon icons[5];
icons[0] = wxICON(icon1);
icons[1] = wxICON(icon2);
icons[2] = wxICON(icon3);
icons[3] = wxICON(icon4);
icons[4] = wxICON(icon5);
int sizeOrig = icons[0].GetWidth();
for ( size_t i = 0; i < WXSIZEOF(icons); i++ )
{ {
if ( size == sizeOrig ) // Make an image list containing small icons
m_imageListNormal = new wxImageList(size, size, TRUE);
// should correspond to TreeCtrlIcon_xxx enum
#if defined(__WXMSW__) && defined(__WIN16__)
m_imageListNormal->Add(wxBitmap("bitmap1", wxBITMAP_TYPE_BMP_RESOURCE));
m_imageListNormal->Add(wxBitmap("bitmap2", wxBITMAP_TYPE_BMP_RESOURCE));
m_imageListNormal->Add(wxBitmap("bitmap3", wxBITMAP_TYPE_BMP_RESOURCE));
m_imageListNormal->Add(wxBitmap("bitmap4", wxBITMAP_TYPE_BMP_RESOURCE));
m_imageListNormal->Add(wxBitmap("bitmap5", wxBITMAP_TYPE_BMP_RESOURCE));
#else // !MSW
wxIcon icons[5];
icons[0] = wxICON(icon1);
icons[1] = wxICON(icon2);
icons[2] = wxICON(icon3);
icons[3] = wxICON(icon4);
icons[4] = wxICON(icon5);
int sizeOrig = icons[0].GetWidth();
for ( size_t i = 0; i < WXSIZEOF(icons); i++ )
{ {
m_imageListNormal->Add(icons[i]); if ( size == sizeOrig )
} {
else m_imageListNormal->Add(icons[i]);
{ }
m_imageListNormal->Add(wxImage(icons[i]).Rescale(size, size). else
ConvertToBitmap()); {
m_imageListNormal->Add(wxImage(icons[i]).Rescale(size, size).
ConvertToBitmap());
}
} }
#endif // MSW/!MSW
} }
#endif
SetImageList(m_imageListNormal); SetImageList(m_imageListNormal);
} }