#pragma once ///////////////////////////////////////////////////////////////////// // BrowseForm.h - declares browse form, used to send selected // // paths back to parent form // // // // Jim Fawcett, CSE687 - Object Oriented Design, Spring 2004 // ///////////////////////////////////////////////////////////////////// // Notes: // // This form hosts a .Net control, tvPlus, written in C#. // // Amazingly, you just pull the control from the toolbox // // (you have to add the control to the toolbox first) onto // // the form and use it! Everything just works due to the // // effective interoperability mechanisms built into .Net. // ///////////////////////////////////////////////////////////////////// using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace System::Threading; namespace demoWinForm { /// /// Summary for BrowseForm /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// public __gc class BrowseForm : public System::Windows::Forms::Form { public: BrowseForm(void) : _baseForm(NULL), _first(true) { InitializeComponent(); } protected: void Dispose(Boolean disposing) { if (disposing && components) { components->Dispose(); } __super::Dispose(disposing); } private: TreeViewPlus::TVPlus * tvPlus1; // private: /// /// Required designer variable. /// System::ComponentModel::Container* components; /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// void InitializeComponent(void) { this->tvPlus1 = new TreeViewPlus::TVPlus(); this->SuspendLayout(); // // tvPlus1 // this->tvPlus1->Anchor = (System::Windows::Forms::AnchorStyles)(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) | System::Windows::Forms::AnchorStyles::Left) | System::Windows::Forms::AnchorStyles::Right); this->tvPlus1->Location = System::Drawing::Point(8, 8); this->tvPlus1->Name = S"tvPlus1"; this->tvPlus1->showFiles = false; this->tvPlus1->Size = System::Drawing::Size(272, 464); this->tvPlus1->TabIndex = 0; this->tvPlus1->AfterSelect += new System::Windows::Forms::TreeViewEventHandler(this, tvPlus1_AfterSelect); // // BrowseForm // this->AutoScaleBaseSize = System::Drawing::Size(5, 13); this->ClientSize = System::Drawing::Size(292, 490); this->Controls->Add(this->tvPlus1); this->Name = S"BrowseForm"; this->Text = S"BrowseForm"; this->Load += new System::EventHandler(this, BrowseForm_Load); this->ResumeLayout(false); } //----< handle treeView selection event >------------------------ private: System::Void tvPlus1_AfterSelect( System::Object * sender, System::Windows::Forms::TreeViewEventArgs * e); //----< build tree after form loads >---------------------------- private: System::Void BrowseForm_Load( System::Object * sender, System::EventArgs * e) { tvPlus1->buildTree(); } //----< enables parent to send me its reference >---------------- public: void setBaseForm(Form* baseForm); __delegate void setPathDelegate(String* path); __event setPathDelegate* setPathEvent; private: Form* _baseForm; bool _first; }; }