branchpropwindow.cpp
author insilmaril
Tue Jan 23 11:50:56 2007 +0000 (2007-01-23)
changeset 423 7019762f8701
child 440 c6a8651e6bbc
permissions -rw-r--r--
1.8.65 Various fixes
     1 #include "branchpropwindow.h"
     2 
     3 #include "frameobj.h"
     4 
     5 
     6 BranchPropertyWindow::BranchPropertyWindow (QWidget *parent):QDialog(parent)
     7 {
     8 	ui.setupUi (this);
     9 
    10 	branch=NULL;
    11 	mapEditor=NULL;
    12 
    13 	connect ( ui.frameTypeCombo, SIGNAL (currentIndexChanged( int)), this, SLOT (frameTypeChanged (int)));
    14 	connect ( ui.hideLinkIfUnselected, SIGNAL (stateChanged( int)), this, SLOT (linkHideUnselectedChanged (int)));
    15 }
    16 
    17 void BranchPropertyWindow::setBranch (BranchObj *bo)
    18 {
    19 	if (!bo) return;
    20 	branch=bo;
    21 
    22 	// Frame
    23 	switch (branch->getFrameType())
    24 	{
    25 		case NoFrame: 
    26 			ui.frameTypeCombo->setCurrentIndex (0);
    27 			break;
    28 		case Rectangle: 
    29 			ui.frameTypeCombo->setCurrentIndex (1);
    30 			break;
    31 		case Ellipse: 
    32 			ui.frameTypeCombo->setCurrentIndex (2);
    33 			break;
    34 	}
    35 	
    36 	// Link
    37 	if (branch->getHideLinkUnselected())
    38 		ui.hideLinkIfUnselected->setCheckState (Qt::Checked);
    39 	else	
    40 		ui.hideLinkIfUnselected->setCheckState (Qt::Unchecked);
    41 }
    42 
    43 void BranchPropertyWindow::setMapEditor (MapEditor *me)
    44 {
    45 	if (me) mapEditor=me;
    46 }
    47 
    48 void BranchPropertyWindow::frameTypeChanged (int i)
    49 {
    50 	if (mapEditor)
    51 		switch (i)
    52 		{
    53 			case 0: mapEditor->setFrame (NoFrame); break;
    54 			case 1: mapEditor->setFrame (Rectangle); break;
    55 			case 2: mapEditor->setFrame (Ellipse); break;
    56 		}
    57 }
    58 
    59 void BranchPropertyWindow::linkHideUnselectedChanged (int i)
    60 {
    61 	if (!branch) return;
    62 	branch->setHideLinkUnselected(i);
    63 }
    64