home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / VPR_DATA / DOGA / SOURCES / MEDIT.LZH / TIMEBAR.CPP < prev    next >
C/C++ Source or Header  |  1996-05-30  |  2KB  |  101 lines

  1. /*  Project medit
  2.     Project Team DoGA
  3.     Copyright (c) 1995. All Rights Reserved.
  4.  
  5.     サブシステム:    medit.apx Application
  6.     ファイル:        timebar.cpp
  7.     作成者:          Taka2
  8.  
  9.  
  10.     概要
  11.     ====
  12.     TTimeBar (TScrollBar) のインプリメンテーション用のソースファイル
  13. */
  14.  
  15.  
  16. #include <owl\owlpch.h>
  17. #pragma hdrstop
  18.  
  19. #include "timebar.h"
  20. #include "anim.h"
  21. #include "motion.h"
  22.  
  23.  
  24. //{{TTimeBar Implementation}}
  25.  
  26.  
  27. TTimeBar::TTimeBar (TWindow* parent, AnimationData *a, int id, int x, int y, int w, int h, BOOL /*isHScrollBar*/, TModule* /*module*/):
  28. #ifdef SLIDER_FRAME
  29.     THSlider(parent, id, x, y, w, h)
  30. #else
  31.     TScrollBar(parent, id, x, y, w, h, isHScrollBar, module)
  32. #endif
  33. {
  34.     // TScrollBar 用の,デフォルトのウィンドウスタイルをオーバーライドする
  35. //    Attr.Style |= WS_CHILD | WS_VISIBLE;
  36. //    Attr.Style &= ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX);
  37.  
  38.     // INSERT>> コンストラクタ用のコードはここに
  39.  
  40.     SetBkgndColor(TColor::LtGray);
  41.  
  42.     PageMagnitude = 5;
  43.     LineMagnitude = 1;
  44.     SetRuler(5, FALSE);
  45.  
  46.     anim = a;
  47.  
  48. }
  49.  
  50.  
  51. TTimeBar::~TTimeBar ()
  52. {
  53.     Destroy();
  54.  
  55.     // INSERT>> デストラクタ用のコードはここに
  56.  
  57. }
  58.  
  59.  
  60. void TTimeBar::SBPageDown ()
  61. {
  62. //    TScrollBar::SBPageDown();
  63.  
  64.     // INSERT>> 追加のコードはここに
  65.     if (anim->select == NULL) {
  66.         TScrollBar::SBPageDown();
  67.     } else if (anim->selectframe >= anim->select->endframe) {
  68.         SetPosition(anim->maxframe);
  69.     } else if (anim->selectframe < anim->select->beginframe) {
  70.         SetPosition(anim->select->beginframe);
  71.     } else {
  72.         SetPosition(anim->select->endframe);
  73.     }
  74. }
  75.  
  76.  
  77. void TTimeBar::SBPageUp ()
  78. {
  79. //    TScrollBar::SBPageUp();
  80.  
  81.     // INSERT>> 追加のコードはここに
  82.  
  83.     if (anim->select == NULL) {
  84.         TScrollBar::SBPageUp();
  85.     } else if (anim->selectframe <= anim->select->beginframe) {
  86.         SetPosition(BEGIN);
  87.     } else if (anim->selectframe > anim->select->endframe) {
  88.         SetPosition(anim->select->endframe);
  89.     } else {
  90.         SetPosition(anim->select->beginframe);
  91.     }
  92. }
  93.  
  94. int
  95. TTimeBar::PointToPos(TPoint& point)
  96. {
  97.     return ((int)((long)point.x*Range))/((int)(Attr.W-ThumbRect.Width())) + (int)Min;
  98. }
  99.  
  100.  
  101.