| 1446 | |
| 1447 | // #pragma mark - |
| 1448 | |
| 1449 | |
| 1450 | ReplicantsSettingsView::ReplicantsSettingsView(BRect rect) |
| 1451 | : SettingsView(rect, "ReplicantsSettingsView") |
| 1452 | { |
| 1453 | rect.OffsetTo(B_ORIGIN); |
| 1454 | fShowReplicantDraggersCheckBox = new BCheckBox(rect, "", |
| 1455 | "Show Replicant Draggers", |
| 1456 | new BMessage(kShowReplicantDraggers)); |
| 1457 | fShowReplicantDraggersCheckBox->ResizeToPreferred(); |
| 1458 | AddChild(fShowReplicantDraggersCheckBox); |
| 1459 | } |
| 1460 | |
| 1461 | |
| 1462 | void |
| 1463 | ReplicantsSettingsView::GetPreferredSize(float *_width, float *_height) |
| 1464 | { |
| 1465 | if (_width != NULL) { |
| 1466 | float width = fShowReplicantDraggersCheckBox->Bounds().Width(); |
| 1467 | |
| 1468 | *_width = width; |
| 1469 | } |
| 1470 | |
| 1471 | if (_height != NULL) |
| 1472 | *_height = fShowReplicantDraggersCheckBox->Frame().bottom; |
| 1473 | } |
| 1474 | |
| 1475 | |
| 1476 | void |
| 1477 | ReplicantsSettingsView::AttachedToWindow() |
| 1478 | { |
| 1479 | fShowReplicantDraggersCheckBox->SetTarget(this); |
| 1480 | ShowCurrentSettings(); |
| 1481 | } |
| 1482 | |
| 1483 | |
| 1484 | void |
| 1485 | ReplicantsSettingsView::MessageReceived(BMessage *message) |
| 1486 | { |
| 1487 | TTracker *tracker = dynamic_cast<TTracker *>(be_app); |
| 1488 | if (!tracker) |
| 1489 | return; |
| 1490 | TrackerSettings settings; |
| 1491 | |
| 1492 | switch (message->what) { |
| 1493 | case kShowReplicantDraggers: |
| 1494 | if (fShowReplicantDraggersCheckBox->Value() |
| 1495 | == B_CONTROL_ON) { |
| 1496 | BDragger::ShowAllDraggers(); |
| 1497 | } else { |
| 1498 | BDragger::HideAllDraggers(); |
| 1499 | } |
| 1500 | Window()->PostMessage(kSettingsContentsModified); |
| 1501 | break; |
| 1502 | |
| 1503 | default: |
| 1504 | _inherited::MessageReceived(message); |
| 1505 | break; |
| 1506 | } |
| 1507 | } |
| 1508 | |
| 1509 | |
| 1510 | void |
| 1511 | ReplicantsSettingsView::SetDefaults() |
| 1512 | { |
| 1513 | ShowCurrentSettings(); |
| 1514 | } |
| 1515 | |
| 1516 | |
| 1517 | bool |
| 1518 | ReplicantsSettingsView::IsDefaultable() const |
| 1519 | { |
| 1520 | return false; |
| 1521 | } |
| 1522 | |
| 1523 | |
| 1524 | void |
| 1525 | ReplicantsSettingsView::Revert() |
| 1526 | { |
| 1527 | |
| 1528 | } |
| 1529 | |
| 1530 | |
| 1531 | void |
| 1532 | ReplicantsSettingsView::_SendNotices() |
| 1533 | { |
| 1534 | |
| 1535 | } |
| 1536 | |
| 1537 | |
| 1538 | void |
| 1539 | ReplicantsSettingsView::ShowCurrentSettings() |
| 1540 | { |
| 1541 | fShowReplicantDraggersCheckBox->SetValue(BDragger::AreDraggersDrawn()); |
| 1542 | } |
| 1543 | |
| 1544 | |
| 1545 | void |
| 1546 | ReplicantsSettingsView::RecordRevertSettings() |
| 1547 | { |
| 1548 | |
| 1549 | } |
| 1550 | |
| 1551 | |
| 1552 | bool |
| 1553 | ReplicantsSettingsView::IsRevertable() const |
| 1554 | { |
| 1555 | return false; |
| 1556 | } |
| 1557 | |