root/_ImageViewer/BF_GUI_ImagePanel.cpp

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

DEFINITIONS

This source file includes following definitions.
  1. Load
  2. Draw
  3. Action_Friend_NewCursor
  4. MessageReceived
  5. FrameResized
  6. OnMouseDown
  7. OnMouseUp
  8. OnKeyDown
  9. DrawPanel
  10. PrepareKeysMenu
  11. PrepareCmdLine
  12. PrepareTopMenuItem
  13. LoadImage

   1 /*
   2 ===============================================
   3 Project:        BeFar
   4 File:           BF_BetaTesting.cpp
   5 Desc:           ??
   6 Author:         Milan Rusek
   7 Created:        26.11.99
   8 Modified:       ??
   9 ===============================================
  10 */
  11 
  12 #include <TranslationUtils.h>
  13 #include "BF_GUI_ImagePanel.h"
  14 #include "BL_Tools.h"
  15 
  16 /////////////////////////////////////////////////////////////////////////////////
  17 
  18 BF_GUI_ImagePanel_Viewer::BF_GUI_ImagePanel_Viewer()
  19 {
  20         
  21 }
  22 
  23 void                                    
  24 BF_GUI_ImagePanel_Viewer::Load(BL_String & s_NodePath)    /* [previous][next][first][last][top][bottom][index][help] */
  25 {
  26         sNodePath = s_NodePath;
  27         mpBitmap = BTranslationUtils::GetBitmapFile(sNodePath.String());
  28         //      your code here
  29 }
  30 
  31 void                                            
  32 BF_GUI_ImagePanel_Viewer::Draw(BView *po_Render,const BRect & o_Rect)    /* [previous][next][first][last][top][bottom][index][help] */
  33 {
  34         /// change this code to real
  35         if (mpBitmap)
  36         {
  37                 if (!po_Render) return;
  38                 po_Render->SetDrawingMode(B_OP_COPY);
  39                 po_Render->DrawBitmap(mpBitmap, o_Rect, o_Rect);
  40                 po_Render->SetDrawingMode(B_OP_ALPHA);
  41                 po_Render->FillRect(o_Rect);
  42         }
  43         else
  44         {
  45                 BPoint oPoint(o_Rect.left,o_Rect.top + o_Rect.Height()/2 - poSysSetup->oFontNode.fAscent);              
  46                 po_Render->SetFont(&poSysSetup->oFontNode.oFont);
  47                 po_Render->SetHighColor(SYS_COLOR(BF_COLOR_NODE));
  48                 po_Render->DrawString(sNodePath.String(),oPoint);
  49         }
  50 }
  51 
  52 /////////////////////////////////////////////////////////////////////////////////
  53 
  54 BF_GUI_ImagePanel::BF_GUI_ImagePanel(
  55         const BRect&    o_Rect,
  56         const char*             pc_FirstName, 
  57         bool                    b_WinPos_OnLeft
  58 ):BF_GUI_Panel(o_Rect,pc_FirstName,b_WinPos_OnLeft)
  59 {       
  60         // your code here 
  61         SetHeader("ImageViewer");
  62 }
  63 
  64 void    
  65 BF_GUI_ImagePanel::Action_Friend_NewCursor(const char *pc_NodePath,const char *pc_NodeName,int32 i_NodeType)    /* [previous][next][first][last][top][bottom][index][help] */
  66 {
  67         BL_String s;
  68         ASSERT(pc_NodePath && pc_NodeName);
  69         s<<pc_NodePath;
  70         s<<"/";
  71         s<<pc_NodeName;
  72         LoadImage(s.String());  
  73 }
  74 
  75 void
  76 BF_GUI_ImagePanel::MessageReceived(BMessage* po_Message)    /* [previous][next][first][last][top][bottom][index][help] */
  77 {
  78         switch(po_Message->what){
  79         default:
  80                 BF_GUI_Panel::MessageReceived(po_Message);
  81         }
  82 }
  83 
  84 void                    
  85 BF_GUI_ImagePanel::FrameResized(float width, float height)    /* [previous][next][first][last][top][bottom][index][help] */
  86 {
  87         BF_GUI_Panel::FrameResized(width,height);
  88         // your code here 
  89 }
  90 
  91 bool                    
  92 BF_GUI_ImagePanel::OnMouseDown(BPoint & o_Point)    /* [previous][next][first][last][top][bottom][index][help] */
  93 {
  94         // your code here 
  95         return BF_GUI_Panel::OnMouseDown(o_Point);
  96 }
  97 
  98 bool
  99 BF_GUI_ImagePanel::OnMouseUp(BPoint & o_Point)    /* [previous][next][first][last][top][bottom][index][help] */
 100 {
 101         // your code here 
 102         return BF_GUI_Panel::OnMouseUp(o_Point);
 103 }
 104 
 105 bool
 106 BF_GUI_ImagePanel::OnKeyDown(const char *bytes, int32 numBytes)    /* [previous][next][first][last][top][bottom][index][help] */
 107 {
 108         // your code here 
 109         return BF_GUI_Panel::OnKeyDown(bytes,numBytes);
 110 }
 111 
 112 void
 113 BF_GUI_ImagePanel::DrawPanel(BRect & o_Rect)    /* [previous][next][first][last][top][bottom][index][help] */
 114 {
 115         BF_GUI_Panel::DrawPanel(o_Rect);
 116         DrawBottom("",true);
 117         // your code here 
 118         oViewer.Draw(poRender,ClientRect());
 119 }
 120 
 121 void
 122 BF_GUI_ImagePanel::PrepareKeysMenu()    /* [previous][next][first][last][top][bottom][index][help] */
 123 {
 124         BF_GUI_Panel::PrepareKeysMenu();
 125         // your code here 
 126 }
 127 
 128 void                                    
 129 BF_GUI_ImagePanel::PrepareCmdLine()    /* [previous][next][first][last][top][bottom][index][help] */
 130 {
 131         BF_GUI_Panel::PrepareCmdLine();
 132         // your code here 
 133 }
 134 
 135 void                                    
 136 BF_GUI_ImagePanel::PrepareTopMenuItem(BF_GUI_TopMenu_HItem *po_HItem)    /* [previous][next][first][last][top][bottom][index][help] */
 137 {
 138         BF_GUI_Panel::PrepareTopMenuItem(po_HItem);
 139         // your code here 
 140 }
 141 ///////////////////////////////////////////////////////
 142 void                                    
 143 BF_GUI_ImagePanel::LoadImage(const char *pc_NodePath)    /* [previous][next][first][last][top][bottom][index][help] */
 144 {
 145         ASSERT(pc_NodePath);
 146         sNodePath = pc_NodePath;        
 147         
 148         oViewer.Load(sNodePath);        
 149         Draw(Bounds());

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