root/BF_GUI_OperRoster.h

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

INCLUDED FROM


   1 #ifndef __BF_GUI_OPERROSTER_H__
   2 #define __BF_GUI_OPERROSTER_H__
   3 
   4 #include "BL_Tools.h"
   5 #include "BF_Node.h"
   6 #include "BF_GUI_DlgViews.h"
   7 
   8 class   BF_GUI_OperRoster;
   9 int32   BF_GUI_OperTask_Thread(void *data);
  10 void    BF_GUI_OperRoster_Draw_Progress(BView *po_Render,const BRect & o_Rect,uint64 i_Index,uint64 i_Count,const char *pc_Text);
  11 
  12 ///////////////////////////////////////////////////////////////////////////
  13 typedef enum{
  14         BF_GUI_OPERTASK_COPY_DEFAULT=-1,
  15         BF_GUI_OPERTASK_COPY_OVERWRITE=0,
  16         BF_GUI_OPERTASK_COPY_SKIP,      
  17         BF_GUI_OPERTASK_COPY_APPEND,    
  18         BF_GUI_OPERTASK_COPY_CANCEL,    
  19 }BF_GUI_OperTask_Copy_Answer;
  20 
  21 typedef enum{
  22         BF_GUI_OPERTASK_ERROR_OK=0,
  23         BF_GUI_OPERTASK_ERROR_CANCEL_ALL,
  24 }BF_GUI_OperTask_Error_Answer;
  25 
  26 #define BF_GUI_OPERTASK_STYLE_DEFAULT           0
  27 #define BF_GUI_OPERTASK_STYLE_CANMINIMASE       1
  28 
  29 #define BF_GUI_OPERTASK_STATE_PRESTART          0
  30 #define BF_GUI_OPERTASK_STATE_PAUSE                     1
  31 #define BF_GUI_OPERTASK_STATE_RUN                       2
  32 
  33 class BF_GUI_OperTask:public BL_Object/*BHandler*/{
  34 public:
  35                                                                         BF_GUI_OperTask(const char *pc_Name,int32 i_Styles = BF_GUI_OPERTASK_STYLE_CANMINIMASE);
  36                                                                         ~BF_GUI_OperTask();
  37 
  38 virtual         void                                                    Run();                          // must be caled before childs_code
  39                 bool                                                    Pause();                        
  40                 bool                                                    DePause();                      
  41                 bool                                                    Cancel();                       
  42 
  43 public:                         
  44                 BL_String                                               sName;          
  45                 
  46                 int32                                                   State();
  47 
  48 protected:              
  49                 int32                                                   iStyles;
  50 
  51                 void                                                    SetProgress(uint64 i_TotalIndex,uint64 i_TotalCount);           
  52                 BF_GUI_OperTask_Copy_Answer             Ask_Copy_FileExist(const char *pc_NodeName,bool b_AskAboutAppend=true);
  53                 BF_GUI_OperTask_Error_Answer    Ask_Error(const char *pc_Message,bool b_AskAdditional=true, const char *pc_ExtMessage=NULL);
  54                 int32                                                   Ask_Message(const char *pc_Message,BL_List *plo_MenuItem,const char *pc_ExtMessage=NULL);
  55                 bool                                                    Canceled();
  56                                                 
  57 private:
  58                 int32                                                   iState; 
  59                 thread_id                                               idThread;
  60                 BMessenger                                              oMessenger;
  61                 BMessage                                                oMessage;
  62                 bigtime_t                                               iLastProgressTime;              
  63                 
  64                 uint64                                                  iTotalCount,iTotalIndex;
  65                 
  66                 bool                                                    bWaitingScreen;
  67                 bool                                                    bReqCancel;
  68                 
  69                 BF_GUI_OperTask_Copy_Answer             iLastCopyAnswer;
  70                                 
  71 
  72                 void                                                    RunThread();
  73                 void                                                    Finished();
  74                 
  75 friend class BF_GUI_OperRoster;
  76 friend int32 BF_GUI_OperTask_Thread(void *data);
  77 };
  78 
  79 ///////////////////////////////////////////////////////////////////////////
  80 
  81 class BF_GUI_OperRoster_Lenta:public BView{
  82 public:
  83                                                                                 BF_GUI_OperRoster_Lenta();      
  84                                                                                 ~BF_GUI_OperRoster_Lenta();             
  85 virtual void                                                    Draw(BRect o_Rect);                                                                                             
  86 virtual void                                                    MouseDown(BPoint point);
  87                 void                                                    DrawProg(uint64 i_Index,uint64 i_Count,bool b_MustDraw);
  88 
  89                 BL_String                                               sText;
  90 private:                
  91                 bigtime_t                                               iLastProgressTime;
  92                 uint64                                                  iProgCount,iProgIndex;
  93                 
  94                 float                                                   fSizeY;
  95 };
  96 
  97 ///////////////////////////////////////////////////////////////////////////
  98 class BF_GUI_OperRoster_Dialog_Item:public BF_GUI_ViewMenu_Item{
  99 public:
 100                                                                                 BF_GUI_OperRoster_Dialog_Item(const char *pc_StatText,int i_TaskState);
 101 virtual void                                                    Draw(BF_GUI_DlgView_Menu *po_Parent,BView *po_Render,float f_PosY);
 102 
 103                 BL_String                                               sStatText;
 104                 uint64                                                  iProgCount,iProgIndex;
 105                 uint32                                                  iTaskState;             
 106 private:
 107 };
 108 ///////////////////////////////////////////////////////////////////////////
 109 class BF_GUI_OperRoster_Dialog:public BF_GUI_Dialog{
 110 public: 
 111                                                                                 BF_GUI_OperRoster_Dialog(const BRect & o_Rect);
 112 virtual void                                                    MessageReceived(BMessage* po_Message);
 113 
 114                 void                                                    Minimaze();             
 115                 void                                                    Task_Pause(int i_TaskIndex);
 116                 void                                                    Task_Cancel(int i_TaskIndex);
 117 
 118                 BF_GUI_DlgView_VMenu                    *poTasksMenu;           
 119                 
 120 private:
 121                 void                                                    PrepareKeysMenu(bool b_Init);
 122 };
 123 
 124 ///////////////////////////////////////////////////////////////////////////
 125 #define BF_GUI_OPERROSTER_VIEW_HIDED    0
 126 #define BF_GUI_OPERROSTER_VIEW_DIALOG   1
 127 #define BF_GUI_OPERROSTER_VIEW_LENTA    2
 128 
 129 
 130 class BF_GUI_OperRoster:public BHandler{
 131 public:
 132                                                                                 BF_GUI_OperRoster();
 133                                                                                 ~BF_GUI_OperRoster(); //!!!
 134                                                                                 
 135 virtual void                                                    MessageReceived(BMessage* po_Message);          
 136                 void                                                    SetViewMode(int32 i_NewViewMode);
 137                 bool                                                    CanMinimase();
 138                 
 139                 float                                                   fHeightInWinMain();
 140 virtual void                                                    Enable(bool b_Enable);  
 141 
 142                 BF_GUI_OperTask                                 *TaskAt(int32 i_Index);
 143 
 144 private:
 145                 BL_List                                                 loTask;
 146                 int                                                             iViewMode;
 147                 BL_String                                               sOldFocusViewName;
 148                 int32                                                   iDisableCount;
 149                 
 150                 void                                                    CalcTotalProg(uint64 & iCount,uint64 & iIndex);
 151                 void                                                    UpdateLenta(bool b_Must=false);
 152                 void                                                    UpdateDialog();
 153                 
 154                 void                                                    Check_ScreenWaiting();
 155                                 
 156                 status_t                                                AddTask(BF_GUI_OperTask *po_Task);                              
 157                 
 158                 void                                                    StoreCurrentFocus();
 159                 void                                                    SetFocusToOld();
 160                 
 161                 void                                                    Close();
 162 };
 163 extern BF_GUI_OperRoster *poOperRoster;
 164 ///////////////////////////////////////////////////////////////////////////
 165 void
 166 BF_GUI_OperRoster_Init();
 167 
 168 void
 169 BF_GUI_OperRoster_AddTask(BF_GUI_OperTask *po_Task);
 170 
 171 ///////////////////////////////////////////////////////////////////////////
 172 

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