~ubuntu-branches/ubuntu/maverick/wxwidgets2.8/maverick-proposed

« back to all changes in this revision

Viewing changes to samples/dnd/dnd.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Devid Filoni
  • Date: 2007-11-06 18:25:13 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20071106182513-809agqds6igh7mqo
Tags: 2.8.6.1-0ubuntu1
* New upstream version, based on the upstream tarball
  wxPython-src-2.8.6.1.tar.bz2, renamed debian to debian-upstream.
* Provide a get-orig-source target to do the repackaging.
* Fix "substvar-source-version-is-deprecated" lintian warnings.
* Remove duplicate Description field in debian/control.
* Add "\" at the end of line 8 in debian/python-wxtools.menu to fix
  "bad-test-in-menu-item" lintian error.
* Provide .xpm icons to fix "menu-icon-not-in-xpm-format" lintian errors,
  changed Icon field in debian/python-wxtools.menu.
* Fix "wrong-name-for-upstream-changelog" lintian warnings.
* Remove "Application;" from Categories field in debian/pycrust.desktop,
  debian/pyshell.desktop, debian/xrced.desktop.
* Switch "Apps" to "Applications" in debian/python-wxtools.menu to fix
  "menu-item-uses-apps-section" lintian warnings.
* Drop the icon extension from debian/pycrust.desktop,
  debian/pyshell.desktop, debian/xrced.desktop.
* Add dpatch support.
* Add "WX_CONFIG" patch.
* debian/rules:
  - added .xpm icons to install-gtk-py-tools target
  - added "docs/changes.txt" to dh_installchangelogs in binary-common target
  - added "\" at the end of "install-examples install-msw-dev
    install-msw-dbg install-headers-msw" line in .PHONY

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
// Author:      Vadim Zeitlin
5
5
// Modified by:
6
6
// Created:     04/01/98
7
 
// RCS-ID:      $Id: dnd.cpp,v 1.107 2006/10/30 20:23:41 VZ Exp $
 
7
// RCS-ID:      $Id: dnd.cpp 48566 2007-09-05 12:39:06Z RR $
8
8
// Copyright:
9
9
// Licence:     wxWindows licence
10
10
/////////////////////////////////////////////////////////////////////////////
25
25
#include "wx/clipbrd.h"
26
26
#include "wx/colordlg.h"
27
27
#include "wx/metafile.h"
 
28
#include "wx/file.h"
28
29
 
29
30
#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__)
30
31
    #include "../sample.xpm"
206
207
    void OnSize(wxSizeEvent& event);
207
208
    void OnQuit(wxCommandEvent& event);
208
209
    void OnAbout(wxCommandEvent& event);
 
210
    void OnOpenFile(wxCommandEvent& event);
209
211
    void OnDrag(wxCommandEvent& event);
210
212
    void OnDragMoveByDefault(wxCommandEvent& event);
211
213
    void OnDragMoveAllow(wxCommandEvent& event);
793
795
    Menu_DragMoveAllow,
794
796
    Menu_NewFrame,
795
797
    Menu_About = 101,
 
798
    Menu_OpenFile,
796
799
    Menu_Help,
797
800
    Menu_Clear,
798
801
    Menu_Copy,
812
815
BEGIN_EVENT_TABLE(DnDFrame, wxFrame)
813
816
    EVT_MENU(Menu_Quit,       DnDFrame::OnQuit)
814
817
    EVT_MENU(Menu_About,      DnDFrame::OnAbout)
 
818
    EVT_MENU(Menu_OpenFile,      DnDFrame::OnOpenFile)
815
819
    EVT_MENU(Menu_Drag,       DnDFrame::OnDrag)
816
820
    EVT_MENU(Menu_DragMoveDef,  DnDFrame::OnDragMoveByDefault)
817
821
    EVT_MENU(Menu_DragMoveAllow,DnDFrame::OnDragMoveAllow)
904
908
    // create the main frame window
905
909
    DnDFrame *frame = new DnDFrame((wxFrame  *) NULL,
906
910
                                   _T("Drag-and-Drop/Clipboard wxWidgets Sample"),
907
 
                                   10, 100, 650, 340);
 
911
                                   10, 100, 750, 540);
908
912
 
909
913
    // activate it
910
914
    frame->Show(true);
940
944
    file_menu->AppendSeparator();
941
945
    file_menu->Append(Menu_NewFrame, _T("&New frame\tCtrl-N"));
942
946
    file_menu->AppendSeparator();
 
947
    file_menu->Append(Menu_OpenFile, _T("&Open file..."));
 
948
    file_menu->AppendSeparator();
943
949
    file_menu->Append(Menu_Quit, _T("E&xit\tCtrl-Q"));
944
950
 
945
951
#if wxUSE_LOG
1007
1013
    sizer_top->Add(m_ctrlText, 1, wxEXPAND );
1008
1014
 
1009
1015
    wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
1010
 
    sizer->Add(sizer_top, 1, wxEXPAND );
 
1016
    sizer->Add(sizer_top, 2, wxEXPAND );
1011
1017
#if wxUSE_LOG
1012
 
    sizer->Add(m_ctrlLog, 2, wxEXPAND);
1013
 
    sizer->SetItemMinSize(m_ctrlLog, 450, 0);
 
1018
    sizer->Add(m_ctrlLog, 1, wxEXPAND);
 
1019
    sizer->SetItemMinSize(m_ctrlLog, 450, 100);
1014
1020
#endif // wxUSE_LOG
1015
1021
    sizer->AddSpacer(50);
1016
1022
 
1110
1116
    m_moveAllow = event.IsChecked();
1111
1117
}
1112
1118
 
 
1119
 
 
1120
void DnDFrame::OnOpenFile(wxCommandEvent& WXUNUSED(event))
 
1121
{
 
1122
    wxFileDialog dialog(this, _T("Open a file"), wxEmptyString, wxEmptyString, _T("Files (*.*)|*.*"), wxFD_MULTIPLE);
 
1123
    if (dialog.ShowModal() == wxID_OK)
 
1124
    {
 
1125
        wxString str;
 
1126
        str.Printf( _T("File opened: %s"), dialog.GetPath().c_str() );
 
1127
        m_ctrlFile->Append( str );
 
1128
    }
 
1129
}
 
1130
 
1113
1131
void DnDFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
1114
1132
{
1115
1133
    wxMessageBox(_T("Drag-&-Drop Demo\n")
1490
1508
    wxString str;
1491
1509
    str.Printf( _T("%d files dropped"), (int)nFiles);
1492
1510
    m_pOwner->Append(str);
1493
 
    for ( size_t n = 0; n < nFiles; n++ ) {
 
1511
    for ( size_t n = 0; n < nFiles; n++ )
 
1512
    {
1494
1513
        m_pOwner->Append(filenames[n]);
 
1514
        if (wxFile::Exists(filenames[n]))
 
1515
            m_pOwner->Append(wxT("  This file exists.") );
 
1516
        else
 
1517
            m_pOwner->Append(wxT("  This file doesn't exist.") );
 
1518
            
1495
1519
    }
1496
1520
 
1497
1521
    return true;