home *** CD-ROM | disk | FTP | other *** search
- #include <cstring.h>
- #include <windows.h>
- #include <owl\applicat.h>
- #include <owl\checkbox.h>
- #include <owl\dialog.h>
- #include <owl\edit.h>
- #include <owl\framewin.h>
- #include <owl\radiobut.h>
- #include <owl\window.h>
- #include <owl\window.rh>
-
- #include "dialog2.h"
-
- const MaxEditLen = 30;
-
- struct TTransferBuffer
- {
- char find[MaxEditLen];
- char replace[MaxEditLen];
- WORD global, seltext, csensitive, wholeword;
- };
-
- class TSearchDialog : public TDialog
- {
- public:
- TSearchDialog( TWindow *parent,
- TTransferBuffer *xfer,
- TModule *module = 0);
-
- };
-
- TSearchDialog::TSearchDialog( TWindow *parent,
- TTransferBuffer *xfer,
- TModule *module)
- : TDialog(parent, "Search", module)
- {
- new TEdit(this, IDE_FIND, MaxEditLen);
- new TEdit(this, IDE_REPLACE, MaxEditLen);
- new TRadioButton(this, IDR_GLOBAL);
- new TRadioButton(this, IDR_SELTEXT);
- new TCheckBox(this, IDC_CASE);
- new TCheckBox(this, IDC_WHOLEWORD);
- SetTransferBuffer(xfer);
- }
-
- class TMyWindow : public TWindow
- {
- public:
- TMyWindow(TWindow *parent = 0);
-
- protected:
- void CmExit();
- void CmDialog();
-
- private:
- TTransferBuffer xfer;
-
- DECLARE_RESPONSE_TABLE(TMyWindow);
- };
- DEFINE_RESPONSE_TABLE1(TMyWindow, TWindow)
- EV_COMMAND(CM_EXIT, CmExit),
- EV_COMMAND(CM_DIALOG, CmDialog),
- END_RESPONSE_TABLE;
-
- TMyWindow::TMyWindow(TWindow *parent)
- : TWindow(parent)
- {
- memset(&xfer, 0, sizeof(xfer));
- lstrcpy(xfer.find, "DOS");
- lstrcpy(xfer.replace, "Replace");
- xfer.global = BF_CHECKED;
- xfer.csensitive = BF_CHECKED;
- xfer.wholeword = BF_CHECKED;
- }
-
- void TMyWindow::CmExit()
- {
- SendMessage(WM_CLOSE);
- }
-
- void TMyWindow::CmDialog()
- {
- if (TSearchDialog(this, &xfer).Execute() == IDOK)
- {
- string msg("Find String: ");
- msg += xfer.find;
- msg += "\n\nReplace String: ";
- msg += xfer.replace;
- MessageBox(msg.c_str(), "Dialog Box Data");
- }
- }
-
- class TDialogApp : public TApplication
- {
- public:
- TDialogApp() : TApplication()
- { nCmdShow = SW_SHOWMAXIMIZED; }
-
- void InitMainWindow()
- {
- SetMainWindow(new TFrameWindow( 0,
- "Modal Dialog Box Data Transfer Tester",
- new TMyWindow ));
- GetMainWindow()->AssignMenu("MainMenu");
- }
- };
-
- int OwlMain(int, char *[])
- {
- return TDialogApp().Run();
- }
-