AeBankWindow.c++ 13.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449

//////////////////////////////////////////////////////////////
//
// Source file for AeBankWindow
//
//    This class is a ViewKit VkWindow subclass
//
//
// Normally, very little in this file should need to be changed.
// Create/add/modify menus using the builder.
//
// Try to restrict any changes to the bodies of functions
// corresponding to menu items, the constructor and destructor.
//
// Restrict changes to those sections between
// the "//--- Start/End editable code block" markers
//
// Doing so will allow you to make changes using the builder
// without losing any changes you may have made manually
//
// Avoid gratuitous reformatting and other changes that might
// make it difficult to integrate changes made using the builder
//////////////////////////////////////////////////////////////
#include <Vk/VkApp.h>
#include <Vk/VkFileSelectionDialog.h>
#include <Vk/VkSubMenu.h>
#include <Vk/VkRadioSubMenu.h>
#include <Vk/VkMenuItem.h>

#include "AeBankWindow.h"
#include "AeBinView.h"
#include "AeBankEditor.h"


// These are default resources for widgets in objects of this class
// All resources will be prepended by *<name> at instantiation,
// where <name> is the name of the specific instance, as well as the
// name of the baseWidget. These are only defaults, and may be overriden
// in a resource file by providing a more specific resource name

String  AeBankWindow::_defaultResources[] = {
        "*title:  Bank Editor",
        "*helpPane.labelString:  Help",
        "*helpPane.mnemonic:  H",
        "*help_click_for_help.labelString:  Click For Help",
        "*help_click_for_help.mnemonic:  C",
        "*help_click_for_help.accelerator:  Shift<Key>F1",
        "*help_click_for_help.acceleratorText:  Shift+F1",
        "*help_overview.labelString:  Overview",
        "*help_overview.mnemonic:  O",
        "*help_index.labelString:  Index",
        "*help_index.mnemonic:  I",
        "*help_keys_and_short.labelString:  Keys and Shortcuts",
        "*help_keys_and_short.mnemonic:  K",
        "*help_prod_info.labelString:  Product Information",
        "*help_prod_info.mnemonic:  P",
        "*editPane.labelString:  Edit",
        "*editPane.mnemonic:  E",
        "*undoButton.labelString:  Undo",
        "*undoButton.mnemonic:  U",
        "*undoButton.accelerator:  Ctrl<Key>Z",
        "*undoButton.acceleratorText:  Ctrl+Z",
        "*cutButton.labelString:  Cut",
        "*cutButton.mnemonic:  t",
        "*cutButton.accelerator:  Ctrl<Key>X",
        "*cutButton.acceleratorText:  Ctrl+X",
        "*copyButton.labelString:  Copy",
        "*copyButton.mnemonic:  C",
        "*copyButton.accelerator:  Ctrl<Key>C",
        "*copyButton.acceleratorText:  Ctrl+C",
        "*pasteButton.labelString:  Paste",
        "*pasteButton.mnemonic:  P",
        "*pasteButton.accelerator:  Ctrl<Key>V",
        "*pasteButton.acceleratorText:  Ctrl+V",
        "*deleteButton.labelString:  Delete",
        "*deleteButton.mnemonic:  D",
        "*deleteButton.accelerator:  Delete",
        "*deleteButton.acceleratorText:  Delete",
        "*assetPane.labelString:  Assets",
        "*assetPane.mnemonic:  A",
        "*addButton.labelString:  Add",
        "*addButton.accelerator:  A",
        "*importButton.labelString:  Import...",
        "*importButton.accelerator:  I",
        "*selectPane.labelString:  Selected",
        "*selectPane.mnemonic:  S",
        "*editorButton.labelString:  Open Editor",
        "*ownersButton.labelString:  List Owners",
        (char*)NULL
};


//---- Class declaration

AeBankWindow::AeBankWindow (const char *name,
			    AeBankEditor * editor,
                            ArgList args,
                            Cardinal argCount) : 
    VkWindow (name, args, argCount) 
{
    // Load any class-default resources for this object

    setDefaultResources(baseWidget(), _defaultResources  );

    fEditor = editor;

    // Create the view component contained by this window

    // fView= new AeBinForm("bankView", mainWindowWidget());
    fView = new AeBinView ("bankView", (AeBinEditor *)editor, mainWindowWidget ());

    XtVaSetValues ( fView->baseWidget(),
                    XmNwidth, 500, 
                    XmNheight, 272, 
                    (XtPointer) NULL );

    // Add the component as the main view

    addView (fView);
    fView->setParent(this);

    // Create the panes of this window's menubar. The menubar itself
    //  is created automatically by ViewKit


    // The editPane menu pane

    _editPane =  addMenuPane("editPane");

    _editPane->add ( theUndoManager );

    _cutButton =  _editPane->addAction ( "cutButton", 
                                        &AeBankWindow::cutCallback, 
                                        (XtPointer) this );

    _copyButton =  _editPane->addAction ( "copyButton", 
                                        &AeBankWindow::copyCallback, 
                                        (XtPointer) this );

    _pasteButton =  _editPane->addAction ( "pasteButton", 
                                        &AeBankWindow::pasteCallback, 
                                        (XtPointer) this );

    _deleteButton =  _editPane->addAction ( "deleteButton", 
                                        &AeBankWindow::deleteCallback, 
                                        (XtPointer) this );

    // The assetPane menu pane

    _assetPane =  addMenuPane("assetPane");

    _addButton =  _assetPane->addAction ( "addButton", 
                                        &AeBankWindow::addAssetCallback, 
                                        (XtPointer) this );

    _importButton =  _assetPane->addAction ( "importButton", 
                                        &AeBankWindow::importAssetCallback, 
                                        (XtPointer) this );

    // The selectPane menu pane

    _selectPane =  addMenuPane("selectPane");

    _editorButton =  _selectPane->addAction ( "editorButton", 
                                        &AeBankWindow::openEditorCallback, 
                                        (XtPointer) this );

    _ownersButton =  _selectPane->addAction ( "ownersButton", 
                                        &AeBankWindow::listOwnersCallback, 
                                        (XtPointer) this );


    //---- Start editable code block: AeBankWindow constructor


    //---- End editable code block: AeBankWindow constructor


} // End Constructor


AeBankWindow::~AeBankWindow()
{
    if (fView)
	delete fView;
    //---- Start editable code block: AeBankWindow destructor


    //---- End editable code block: AeBankWindow destructor
} // End destructor


const char *AeBankWindow::className()
{
    return ("AeBankWindow");
} // End className()


Boolean AeBankWindow::okToQuit()
{    //---- Start editable code block: AeBankWindow okToQuit



    // This member function is called when the user quits by calling
    // theApplication->terminate() or uses the window manager close protocol
    // This function can abort the operation by returning FALSE, or do some.
    // cleanup before returning TRUE. The actual decision is normally passed on
    // to the view object


    // Query the view object, and give it a chance to cleanup

    return ( fView->okToQuit() );

    //---- End editable code block: AeBankWindow okToQuit
} // End okToQuit()


void
AeBankWindow::handleWmDeleteMessage (void)
{
    if (fEditor)
	delete fEditor;
}



/////////////////////////////////////////////////////////////// 
// The following functions are static member functions used to 
// interface with Motif.
/////////////////////////////////// 

void AeBankWindow::addAssetCallback ( Widget    w,
                                              XtPointer clientData,
                                              XtPointer callData ) 
{ 
    AeBankWindow* obj = ( AeBankWindow * ) clientData;
    obj->addAsset ( w, callData );
}

void AeBankWindow::copyCallback ( Widget    w,
                                          XtPointer clientData,
                                          XtPointer callData ) 
{ 
    AeBankWindow* obj = ( AeBankWindow * ) clientData;
    obj->copy ( w, callData );
}

void AeBankWindow::cutCallback ( Widget    w,
                                         XtPointer clientData,
                                         XtPointer callData ) 
{ 
    AeBankWindow* obj = ( AeBankWindow * ) clientData;
    obj->cut ( w, callData );
}

void AeBankWindow::deleteCallback ( Widget    w,
                                             XtPointer clientData,
                                             XtPointer callData ) 
{ 
    AeBankWindow* obj = ( AeBankWindow * ) clientData;
    obj->del ( w, callData );
}

void AeBankWindow::importAssetCallback ( Widget    w,
                                                 XtPointer clientData,
                                                 XtPointer callData ) 
{ 
    AeBankWindow* obj = ( AeBankWindow * ) clientData;
    obj->importAsset ( w, callData );
}

void AeBankWindow::listOwnersCallback ( Widget    w,
                                                XtPointer clientData,
                                                XtPointer callData ) 
{ 
    AeBankWindow* obj = ( AeBankWindow * ) clientData;
    obj->listOwners ( w, callData );
}

void AeBankWindow::openEditorCallback ( Widget    w,
                                                XtPointer clientData,
                                                XtPointer callData ) 
{ 
    AeBankWindow* obj = ( AeBankWindow * ) clientData;
    obj->openEditor ( w, callData );
}

void AeBankWindow::pasteCallback ( Widget    w,
                                           XtPointer clientData,
                                           XtPointer callData ) 
{ 
    AeBankWindow* obj = ( AeBankWindow * ) clientData;
    obj->paste ( w, callData );
}





/////////////////////////////////////////////////////////////// 
// The following functions are called from the menu items 
// in this window.
/////////////////////////////////// 

void AeBankWindow::copy ( Widget w, XtPointer callData ) 
{
    //---- Start editable code block: AeBankWindow copy


    // This virtual function is called from copyCallback.
    // By default this member function passes control
    // to the component contained by this window

    //fView->copy();


    //---- End editable code block: AeBankWindow copy

} // End AeBankWindow::copy()


void AeBankWindow::cut ( Widget w, XtPointer callData ) 
{
    //---- Start editable code block: AeBankWindow cut


    // This virtual function is called from cutCallback.
    // By default this member function passes control
    // to the component contained by this window

    //fView->cut();


    //---- End editable code block: AeBankWindow cut

} // End AeBankWindow::cut()


void AeBankWindow::paste ( Widget w, XtPointer callData ) 
{
    //---- Start editable code block: AeBankWindow paste


    // This virtual function is called from pasteCallback.
    // By default this member function passes control
    // to the component contained by this window

    //fView->paste();


    //---- End editable code block: AeBankWindow paste

} // End AeBankWindow::paste()


void AeBankWindow::del ( Widget w, XtPointer callData ) 
{
    //---- Start editable code block: AeBankWindow delete


    // This virtual function is called from deleteCallback.
    // By default this member function passes control
    // to the component contained by this window

    //fView->del( w, callData);


    //---- End editable code block: AeBankWindow delete

} // End AeBankWindow::delete()


void AeBankWindow::addAsset ( Widget w, XtPointer callData ) 
{
    //---- Start editable code block: AeBankWindow addAsset


    // This virtual function is called from addAssetCallback.
    // By default this member function passes control
    // to the component contained by this window

    //fView->addAsset( w, callData);


    //---- End editable code block: AeBankWindow addAsset

} // End AeBankWindow::addAsset()


void AeBankWindow::importAsset ( Widget w, XtPointer callData ) 
{
    //---- Start editable code block: AeBankWindow importAsset


    // This virtual function is called from importAssetCallback.
    // By default this member function passes control
    // to the component contained by this window

    //fView->importAsset( w, callData);


    //---- End editable code block: AeBankWindow importAsset

} // End AeBankWindow::importAsset()


void AeBankWindow::listOwners ( Widget w, XtPointer callData ) 
{
    //---- Start editable code block: AeBankWindow listOwners


    // This virtual function is called from listOwnersCallback.
    // By default this member function passes control
    // to the component contained by this window

    //fView->listOwners( w, callData);


    //---- End editable code block: AeBankWindow listOwners

} // End AeBankWindow::listOwners()


void AeBankWindow::openEditor ( Widget w, XtPointer callData ) 
{
    //---- Start editable code block: AeBankWindow openEditor


    // This virtual function is called from openEditorCallback.
    // By default this member function passes control
    // to the component contained by this window

    //fView->openEditor( w, callData);


    //---- End editable code block: AeBankWindow openEditor

} // End AeBankWindow::openEditor()




//---- Start editable code block: End of generated code


//---- End editable code block: End of generated code