Tizen 2.1 base
[sdk/ide/native-sample.git] / samples / native / cpp / Sample / Tizen C++ / MediaApp / MediaApp / project / inc / BrowserForm.h
1 //
2 // Tizen C++ SDK
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.tizenopensource.org/license
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #ifndef _BROWSER_FORM_H_
19 #define _BROWSER_FORM_H_
20
21 #include <FBase.h>
22 #include <FUi.h>
23 #include <FMedia.h>
24
25 #include "MultiForm.h"
26
27 using namespace Osp::Base;
28
29 class BrowserFormParam
30 {
31 public:
32         BrowserFormParam()
33         {
34                 lockDir = true;
35                 selected = false;
36                 formParam = null;
37         }
38         BrowserFormParam(const Osp::Base::String initDir, const Osp::Base::String filter, bool lock)
39         {
40                 this->initDir = initDir;
41                 lockDir = lock;
42                 selected = false;
43                 formParam = null;
44                 this->filter = filter;
45         }
46
47         String initDir;     // in
48         String filter;      // in
49         bool lockDir;       // in
50         bool selected;      // out
51         String fileName;    // out
52         String formName;    // callback form
53         void* formParam;        // callback param
54 };
55
56
57 class BrowserForm
58         : public MultiForm
59         , public Osp::Ui::IItemEventListener
60 {
61 public:
62         BrowserForm();
63         virtual ~BrowserForm();
64         bool Initialize(void);
65
66         static result TestFunc(void* pParam);
67
68
69 protected:
70         virtual result OnActivate(void* param);
71
72         result OnInitializing(void);
73         void SetFilter(const Osp::Base::String& filter) { __filter = filter; }
74         result BrowseDirectory(const Osp::Base::String& dirName);
75         void OnItemStateChanged(const Osp::Ui::Control& source, int index, int itemId, Osp::Ui::ItemStatus status);
76         void OnActionPerformed(const Osp::Ui::Control& source, int actionId);
77
78         bool IsFiltered(const Osp::Base::String& filter, const Osp::Base::String& ext);
79
80 private:
81         CONST_INT(ITEM_DIRECTORY);
82         CONST_INT(ITEM_FILE);
83         CONST_INT(ITEM_PREV_DIRECTORY);
84         CONST_INT(ITEM_IMAGE_FILE);
85         CONST_INT(ITEM_AUDIO_FILE);
86         CONST_INT(ITEM_VIDEO_FILE);
87         CONST_INT(ITEM_PLS_FILE);
88         CONST_INT(ID_ROOT);
89         CONST_INT(ID_BACK);
90
91
92         Osp::Ui::Controls::List* __pListCtrl;
93         Osp::Media::Image* __pImage;
94         Osp::Graphics::Bitmap* __pFileBmp;
95         Osp::Graphics::Bitmap* __pFolderBmp;
96         Osp::Graphics::Bitmap* __pImageBmp;
97         Osp::Graphics::Bitmap* __pVideoBmp;
98         Osp::Graphics::Bitmap* __pAudioBmp;
99
100         Osp::Base::Collection::ArrayList* __pEntryList;
101         Osp::Base::String* __pCurDirectory;
102         Osp::Base::String* __pSrcCopyFile;
103         Osp::Base::String __lastPath;
104
105         Osp::Ui::Controls::Button* __pButtonRecorder;
106         BrowserFormParam* __pParam;
107         String __filter;
108 };
109
110 #endif // _BROWSER_FORM_H_