root/BF_GUI_NodePanel_MoveDraw.cpp

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. DrawMove_ColsDown
  2. DrawMove_ColsUp
  3. DrawMove_ColsRight
  4. DrawMove_ColsLeft
  5. DrawMove_FullUp
  6. DrawMove_FullDown

   1 #include <stdio.h>
   2 #include <stdlib.h>
   3 #include <string.h>
   4 
   5 #include "BF_Roster.h"
   6 #include "BF_Msg.h"
   7 #include "BF_GUI_NodePanel.h"
   8 #include "BF_GUI_DlgViews.h"
   9 
  10 
  11 void                                    
  12 BF_GUI_NodePanel::DrawMove_ColsDown()    /* [previous][next][first][last][top][bottom][index][help] */
  13 {
  14                 
  15         /* draw current node in unfocused state */
  16         DrawNodeSelf(iNavCursorIndex,false,true);
  17         // prep full rect for first col
  18         BRect oFirstRect(poRender->Bounds());
  19         oFirstRect.left+=4;
  20         oFirstRect.right = oFirstRect.left + fColsColWidth-3;           
  21         oFirstRect.top += HeaderHeight() + fColTitleHeight + fNodeHeight;       
  22         oFirstRect.bottom = oFirstRect.top + fNodesHeight - fNodeHeight;
  23         // move cols up //
  24         BRect   oColRectOld( oFirstRect ),oColRectNew,oNodeTopOld,oNodeTopNew;
  25         for(int32 iCol=0;iCol<(int32)iColsColCount;iCol++){                     
  26                 /* move top_node to left_bottom */              
  27                 if(iCol>0){                     
  28                         oNodeTopOld = oColRectOld;
  29                         oNodeTopOld.top -= fNodeHeight;
  30                         oNodeTopOld.bottom = oNodeTopOld.top + fNodeHeight-1;
  31                         oNodeTopNew = oColRectOld;
  32                         oNodeTopNew.top = oNodeTopNew.bottom-fNodeHeight;
  33                         oNodeTopNew.bottom--;
  34                         oNodeTopNew.left -= fColsColWidth;
  35                         oNodeTopNew.right -= fColsColWidth;
  36                         poRender->CopyBits(oNodeTopOld,oNodeTopNew);                            
  37                 }
  38                 //
  39                 oColRectNew = oColRectOld;
  40                 oColRectNew.top -= fNodeHeight;
  41                 oColRectNew.bottom -= fNodeHeight;              
  42                 poRender->CopyBits(oColRectOld,oColRectNew);
  43                 /* swift rect to right */
  44                 oColRectOld.left += fColsColWidth;
  45                 oColRectOld.right += fColsColWidth;
  46         }       
  47         /* move cursor_vars down */
  48         NavChangeCursor(iNavCursorIndex+1,false);
  49         /* draw current node in focused state */
  50         DrawNodeSelf(iNavCursorIndex,true,true);        
  51 }
  52 
  53 void                                    
  54 BF_GUI_NodePanel::DrawMove_ColsUp()    /* [previous][next][first][last][top][bottom][index][help] */
  55 {               
  56         /* draw current node in unfocused state */
  57         DrawNodeSelf(iNavCursorIndex,false,true);
  58         // prep full rect for last col
  59         BRect oFirstRect(poRender->Bounds());
  60         oFirstRect.left+=4 + fColsColWidth*(iColsColCount-1);
  61         oFirstRect.right = oFirstRect.left + fColsColWidth-3;           
  62         oFirstRect.top += HeaderHeight() + fColTitleHeight;     
  63         oFirstRect.bottom = oFirstRect.top + fNodesHeight - fNodeHeight;
  64         // move cols down //
  65         BRect   oColRectOld( oFirstRect ),oColRectNew,oNodeTopOld,oNodeTopNew;
  66         
  67         for(int32 iCol=iColsColCount-1;iCol>=0;iCol--){                 
  68                 /* move bottom_node to right_top */
  69                 if(iCol<((int32)iColsColCount-1)){                      
  70                         oNodeTopOld = oColRectOld;
  71                         oNodeTopOld.top = oNodeTopOld.bottom/*+1*/;
  72                         oNodeTopOld.bottom  = oNodeTopOld.top + fNodeHeight/* -1*/;
  73                         oNodeTopNew = oColRectOld;
  74                         oNodeTopNew.bottom = oNodeTopNew.top + fNodeHeight -1;
  75                         oNodeTopNew.left += fColsColWidth;
  76                         oNodeTopNew.right += fColsColWidth;
  77                         poRender->CopyBits(oNodeTopOld,oNodeTopNew);                            
  78                 }
  79                 //
  80                 oColRectNew = oColRectOld;
  81                 oColRectNew.top += fNodeHeight;
  82                 oColRectNew.bottom += fNodeHeight;              
  83                 poRender->CopyBits(oColRectOld,oColRectNew);
  84                 /* swift rect to right */
  85                 oColRectOld.left -= fColsColWidth;
  86                 oColRectOld.right -= fColsColWidth;
  87         }       
  88         /* move cursor_vars down */
  89         NavChangeCursor(iNavCursorIndex-1,false);
  90         /* draw current node in focused state */        
  91         DrawNodeSelf(iNavCursorIndex,true,true);        
  92 }
  93 
  94 void                                    
  95 BF_GUI_NodePanel::DrawMove_ColsRight()    /* [previous][next][first][last][top][bottom][index][help] */
  96 {
  97         /* draw current node in unfocused state */
  98         DrawNodeSelf(iNavCursorIndex,false,true);
  99         // prep full rect for move
 100         BRect oOldRect(poRender->Bounds());
 101         oOldRect.left += 4 + fColsColWidth;
 102         oOldRect.right = oOldRect.left + (iColsColCount-1) * fColsColWidth -2;
 103         oOldRect.top += HeaderHeight() + fColTitleHeight;       
 104         oOldRect.bottom = oOldRect.top + fNodesHeight;
 105                         
 106         // move cols down //
 107         BRect oNewRect(oOldRect);
 108         oNewRect.left -= fColsColWidth;
 109         oNewRect.right -= fColsColWidth;
 110 
 111         //
 112         poRender->CopyBits(oOldRect,oNewRect);
 113         /* move cursor_vars down */
 114         iNavCursorIndex += iColsNodesInCol;
 115         iNavFirstIndex += iColsNodesInCol;      
 116         NavChangeCursor(iNavCursorIndex + iColsNodesInCol,false,false);
 117         /* draw nodes from last_col*/
 118         {
 119                 int iNode = iNavFirstIndex + iColsNodesInCol * (iColsColCount-1);
 120                 for(uint i = 0;i < iColsNodesInCol;i++){
 121                         DrawNodeSelf(i+iNode,(i+iNode)==iNavCursorIndex,true);
 122                 }
 123         }
 124 }
 125 
 126 void                                    
 127 BF_GUI_NodePanel::DrawMove_ColsLeft()    /* [previous][next][first][last][top][bottom][index][help] */
 128 {
 129         /* draw current node in unfocused state */
 130         DrawNodeSelf(iNavCursorIndex,false,true);
 131         // prep full rect for move
 132         BRect oOldRect(poRender->Bounds());
 133         oOldRect.left += 4; 
 134         oOldRect.right = oOldRect.left + (iColsColCount-1) * fColsColWidth -2;
 135         oOldRect.top += HeaderHeight() + fColTitleHeight;       
 136         oOldRect.bottom = oOldRect.top + fNodesHeight;
 137                         
 138         // move cols down //
 139         BRect oNewRect(oOldRect);
 140         oNewRect.left += fColsColWidth;
 141         oNewRect.right += fColsColWidth;
 142 
 143         //
 144         poRender->CopyBits(oOldRect,oNewRect);
 145         /* move cursor_vars left */
 146         iNavCursorIndex -= iColsNodesInCol;
 147         iNavFirstIndex -= iColsNodesInCol;      
 148         NavChangeCursor(iNavCursorIndex,false,false);
 149         /* draw nodes from last_col*/
 150         {
 151                 for(int32 i = iNavFirstIndex;i < iNavFirstIndex+(int32)iColsNodesInCol;i++){
 152                         DrawNodeSelf(i,i==iNavCursorIndex,true);
 153                 }
 154         }
 155 }
 156 
 157 
 158 void                                    
 159 BF_GUI_NodePanel::DrawMove_FullUp()    /* [previous][next][first][last][top][bottom][index][help] */
 160 {
 161         /* draw current node in unfocused state */
 162         DrawNodeSelf(iNavCursorIndex,false,true);
 163         
 164         // prep old rect
 165         BRect oOldRect(poRender->Bounds());
 166         oOldRect.left += 4 ;
 167         oOldRect.right -= 4 ;
 168         oOldRect.top += HeaderHeight() + fColTitleHeight;       
 169         oOldRect.bottom = oOldRect.top + fNodesHeight - fNodeHeight;
 170         // prep new  rect
 171         BRect oNewRect(oOldRect);
 172         oNewRect.top += fNodeHeight;
 173         oNewRect.bottom += fNodeHeight;
 174     
 175     /* copy rect */  
 176         poRender->CopyBits(oOldRect,oNewRect);          
 177 
 178         /* move cursor */
 179         iNavCursorIndex --;
 180         iNavFirstIndex --;
 181         NavChangeCursor(iNavCursorIndex,false,false);
 182                 
 183         /* draw current node in focused state */        
 184         DrawNodeSelf(iNavCursorIndex,true,true);                
 185 
 186 }
 187 
 188 void                                    
 189 BF_GUI_NodePanel::DrawMove_FullDown()    /* [previous][next][first][last][top][bottom][index][help] */
 190 {
 191         /* draw current node in unfocused state */
 192         DrawNodeSelf(iNavCursorIndex,false,true);
 193         
 194         // prep old rect
 195         BRect oOldRect(poRender->Bounds());
 196         oOldRect.left += 4 ;
 197         oOldRect.right -= 4 ;
 198         oOldRect.top += HeaderHeight() + fColTitleHeight;       
 199         oOldRect.bottom = oOldRect.top + fNodesHeight;
 200         oOldRect.top +=  fNodeHeight;
 201         // prep new  rect
 202         BRect oNewRect(oOldRect);
 203         oNewRect.top -= fNodeHeight;
 204         oNewRect.bottom -= fNodeHeight;
 205     // copy rect
 206         poRender->CopyBits(oOldRect,oNewRect);          
 207 
 208         /* move cursor */
 209         iNavCursorIndex ++;
 210         iNavFirstIndex ++;
 211         NavChangeCursor(iNavCursorIndex + iColsNodesInCol,false,false);
 212                 
 213         /* draw current node in focused state */        
 214         DrawNodeSelf(iNavCursorIndex,true,true);                

/* [previous][next][first][last][top][bottom][index][help] */