OROCHI
 
Loading...
Searching...
No Matches
GxToolContentManager.h
Go to the documentation of this file.
1//===========================================================================
9//===========================================================================
10#pragma once
11
12#if GX_DEVELOP
13
14GX_CORE_NAMESPACE_BEGIN()
15
16//===========================================================================
18//===========================================================================
19class GxToolContentManager : public GxToolBase
20{
21 //-------------------------------------------------------------
23 //-------------------------------------------------------------
25public:
26 // RTTI定義
27 GX_RTTI_CLASS_NAME_ICON( GxToolContentManager, GxToolBase, "コンテンツ管理", GxRtti::ICON_TYPE::CORE )
28 // ClassBaseReference継承クラス用禁止宣言
29 GX_PROHIBIT_CLASS_BASE_REFERENCE( GxToolContentManager )
30
31private:
32 class GxGuiAddressBar;
33 class GxGuiContentView;
34
36 //-------------------------------------------------------------
38 //-------------------------------------------------------------
40public:
42 GxToolContentManager( void );
43
45 b32 initialize( void ) override;
46
48 //-------------------------------------------------------------
50 //-------------------------------------------------------------
52protected:
54 void addMenuOwnProperty( GxPropertyTable& table ) override;
55
57 void onSize( const GxSize& size ) override;
58
59public:
61 const GxString& getCurrentDirectory(void) const;
63 void setCurrentDirectory( const GxString& directoryPath, const GxString& fileName, const GxString& extensionFilter );
64
66 void updateDisplay(const GxString* pPath = nullptr);
67
68private:
70 void updatePropertySearchStringCallback( const GxString& value );
71
73 void getPropertyListViewFlag( void* const pValue );
75 void setPropertyListViewFlag( const void* const pValue );
76
78 //-------------------------------------------------------------
80 //-------------------------------------------------------------
82public:
84 GX_FORCE_INLINE void resetSearchString( void ) { _pGuiSearchBar->setSearchString(""); }
85
87 //-------------------------------------------------------------
89 //-------------------------------------------------------------
91private:
92 GxGuiSplitter* _pGuiSplitterMain;
93 GxGuiSplitter* _pGuiSplitterSub;
94
95 GxGuiContentView* _pGuiContentView;
96 GxGuiPropertySearchBar* _pGuiSearchBar;
97
99};
100
101//===========================================================================
103//===========================================================================
104class GxToolContentManager::GxGuiAddressBar : public GxGuiForm
105{
106 //-------------------------------------------------------------
108 //-------------------------------------------------------------
110public:
111 // RTTI定義
112 GX_RTTI_CLASS( GxToolContentManager::GxGuiAddressBar, GxGuiForm )
113 // ClassBaseReference継承クラス用禁止宣言
114 GX_PROHIBIT_CLASS_BASE_REFERENCE( GxGuiAddressBar )
115
116private:
117 class GxAddressPath;
118 class GxAddressIcon;
119
121 //-------------------------------------------------------------
123 //-------------------------------------------------------------
125public:
127 GxGuiAddressBar( void );
129 GxGuiAddressBar( GxToolContentManager* pTool, GxGuiContentView* pGuiContentView );
130
132 b32 initialize( void ) override;
134 void cleanup( void ) override;
135
137 //-------------------------------------------------------------
139 //-------------------------------------------------------------
141protected:
143 void update( void ) override;
145 void onDraw( void ) override;
146
148 void onClick( const GxPoint2& position, u32 button ) override;
149
151 void onSize( const GxSize& size ) override;
152
153private:
155 void updatePath( void );
157 void clearPath( void );
159 void updateDrawPath( void );
160
162 //-------------------------------------------------------------
164 //-------------------------------------------------------------
166private:
167 GxToolContentManager* _pParentTool;
168 GxGuiContentView* _pGuiContentView;
169
170 GxAddressIcon* _pPreviousDirectoryIcon;
171 GxAddressIcon* _pNextDirectoryIcon;
172
173 GxSize _currentSize;
174
175 GxString _currentPath;
176 GxArrayClassBase _pathList;
177
179};
180
181//===========================================================================
183//===========================================================================
184class GxToolContentManager::GxGuiAddressBar::GxAddressPath : public GxClassBase
185{
186 //-------------------------------------------------------------
188 //-------------------------------------------------------------
190public:
191 // RTTI定義
192 GX_RTTI_CLASS( GxToolContentManager::GxGuiAddressBar::GxAddressPath, GxClassBase )
193 // ClassBase継承クラス用禁止宣言
194 GX_PROHIBIT_CLASS_BASE( GxAddressPath )
195
196
197 //-------------------------------------------------------------
199 //-------------------------------------------------------------
201public:
203 GxAddressPath( void );
205 GxAddressPath( const GxString& path, const GxString& name );
207 ~GxAddressPath( void ) override {}
208
210 //-------------------------------------------------------------
212 //-------------------------------------------------------------
214public:
216 GX_FORCE_INLINE b32 isDraw( void ) const { return _drawFlag; }
218 GX_FORCE_INLINE void setDraw( b32 flag ) { _drawFlag = flag; }
219
221 GX_FORCE_INLINE const GxString& getPath( void ) const { return _path; }
223 GX_FORCE_INLINE const GxString& getName( void ) const { return _name; }
225 GX_FORCE_INLINE const GxSize getDrawSize( void ) const { return GxGuiGraphics::calculateStringSize( _name.getString() ); }
226
228 GX_FORCE_INLINE const GxRect& getDrawRect( void ) const { return _drawRect; }
230 GX_FORCE_INLINE void setDrawRect( const GxPoint2& point ) { _drawRect = GxRect( point, getDrawSize() ); }
231
233 //-------------------------------------------------------------
235 //-------------------------------------------------------------
237private:
238 b32 _drawFlag;
239
240 GxString _path;
241 GxString _name;
242
243 GxRect _drawRect;
244
246};
247
248//===========================================================================
250//===========================================================================
251class GxToolContentManager::GxGuiAddressBar::GxAddressIcon : public GxClassBase
252{
253 //-------------------------------------------------------------
255 //-------------------------------------------------------------
257public:
258 // RTTI定義
259 GX_RTTI_CLASS( GxToolContentManager::GxGuiAddressBar::GxAddressIcon, GxClassBase )
260 // ClassBase継承クラス用禁止宣言
261 GX_PROHIBIT_CLASS_BASE( GxAddressIcon )
262
263
264 static const GxSize ICON_SIZE;
265
267 //-------------------------------------------------------------
269 //-------------------------------------------------------------
271public:
273 GxAddressIcon( void );
275 ~GxAddressIcon( void ) override {}
276
278 //-------------------------------------------------------------
280 //-------------------------------------------------------------
282public:
284 void draw( const GxPoint2& point, const GxColor& color, GxRtti::ICON_TYPE icon, b32 isFlip );
285
287 //-------------------------------------------------------------
289 //-------------------------------------------------------------
291public:
293 GX_FORCE_INLINE const GxRect& getDrawRect( void ) const { return _drawRect; }
294
296 //-------------------------------------------------------------
298 //-------------------------------------------------------------
300private:
301 GxRect _drawRect;
302
304};
305
306//===========================================================================
308//===========================================================================
309class GxToolContentManager::GxGuiContentView : public GxGuiForm
310{
311 //-------------------------------------------------------------
313 //-------------------------------------------------------------
315public:
316 // RTTI定義
317 GX_RTTI_CLASS( GxToolContentManager::GxGuiContentView, GxGuiForm )
318 // ClassBaseReference継承クラス用禁止宣言
319 GX_PROHIBIT_CLASS_BASE_REFERENCE( GxGuiContentView )
320
321private:
322 class GxGuiFormBody;
323 class GxGuiFormBar;
324
326 static constexpr u32 HISTORY_COUNT_MAX = GxMath::VALUE_32;
327
329 //-------------------------------------------------------------
331 //-------------------------------------------------------------
333public:
335 GxGuiContentView( void );
337 GxGuiContentView( GxToolBase* pTool );
338
340 b32 initialize( void ) override;
342 void cleanup( void ) override;
343
345 //-------------------------------------------------------------
347 //-------------------------------------------------------------
349protected:
351 void update( void ) override;
352
353public:
355 void addHistoryDirectory( const GxString& path );
357 void updatePreviousDirectory( void );
359 void updateNextDirectory( void );
361 b32 isUpdatePreviousDirectory( void ) const;
363 b32 isUpdateNextDirectory( void ) const;
365 b32 isExistPreviousDirectory( void ) const;
367 b32 isExistNextDirectory( void ) const;
369 void resetHistoryDirectory( void );
370
372 //-------------------------------------------------------------
374 //-------------------------------------------------------------
376public:
378 constexpr u32 getItemCount( void ) const { return _itemCount; }
380 constexpr void setItemCount( u32 count ) { _itemCount = count; }
382 constexpr s32 getScrollOffsetY( void ) const { return _scrollOffsetY; }
384 constexpr void setScrollOffsetY( s32 offset ) { _scrollOffsetY = offset; }
385
387 GX_FORCE_INLINE b32 isListView( void ) const { return _listViewFlag; }
389 GX_FORCE_INLINE void setListView( b32 flag ) { _listViewFlag = flag; }
390
392 GX_FORCE_INLINE b32 isDirtyFileList( void ) const { return _dirtyFileList; }
394 GX_FORCE_INLINE void setDirtyFileList( b32 flag ) { _dirtyFileList = flag; }
395
397 GX_FORCE_INLINE const GxString& getSearchString( void ) const { return _searchString; }
399 GX_FORCE_INLINE void setSearchString( const GxString& string ) { _searchString = string; }
401 GX_FORCE_INLINE const GxString& getSelectPath( void ) const { return _selectPath; }
403 GX_FORCE_INLINE void setSelectPath( const GxString& path ) { _selectPath = path; }
405 GX_FORCE_INLINE const GxString& getSelectFileName( void ) const { return _selectFileName; }
407 GX_FORCE_INLINE void setSelectFileName( const GxString& fileName ) { _selectFileName = fileName; }
409 GX_FORCE_INLINE const GxString& getSelectExtensionFilter( void ) const { return _selectExtensionFilter; }
411 GX_FORCE_INLINE void setSelectExtensionFilter( const GxString& filter ) { _selectExtensionFilter = filter; }
412
414 void getRootPath( GxString& path );
415
417 constexpr GxGuiSplitter* getGuiSplitter( void ) { return _pGuiSplitter; }
418
420 //-------------------------------------------------------------
422 //-------------------------------------------------------------
424private:
425 GxToolBase* _pParentTool;
426
427 GxGuiSplitter* _pGuiSplitter;
428
429 GxString* _pDirectoryHistory;
430 u32 _directoryHistoryCurrentIndex;
431 u32 _directoryHistoryTopIndex;
432 u32 _directoryHistoryTailIndex;
433
434 u32 _itemCount;
435 s32 _scrollOffsetY;
436
437 b32 _listViewFlag;
438 b32 _dirtyFileList;
439
440 GxString _searchString;
441 GxString _selectPath;
442 GxString _selectFileName;
443 GxString _selectExtensionFilter;
444
446};
447
448//===========================================================================
450//===========================================================================
451class GxToolContentManager::GxGuiContentView::GxGuiFormBody : public GxGuiForm
452{
453 //-------------------------------------------------------------
455 //-------------------------------------------------------------
457public:
458 // RTTI定義
459 GX_RTTI_CLASS( GxToolContentManager::GxGuiContentView::GxGuiFormBody, GxGuiForm )
460 // ClassBaseReference継承クラス用禁止宣言
461 GX_PROHIBIT_CLASS_BASE_REFERENCE( GxGuiFormBody )
462
463private:
465 static constexpr u32 INITIAL_ALLOCATE_DRAW_NODE_COUNT = GxMath::VALUE_1K;
466
468 static constexpr u32 LIST_VIEW_REGION_HEIGHT = GxMath::VALUE_16;
470 static constexpr u32 LIST_VIEW_ICON_SIZE = GxMath::VALUE_16;
471
473 static constexpr u32 TILE_VIEW_REGION_WIDTH = GxMath::VALUE_64;
475 static constexpr u32 TILE_VIEW_REGION_HEIGHT = 96;
477 static constexpr u32 TILE_VIEW_ICON_SIZE = 54;
478
480 static const GX_CSTR CREATE_FOLDER_NAME;
482 static const GX_CSTR COPY_FILE_NAME_SUFFIX;
483
485 static const GX_CSTR IGNORE_DIRECTORY_NAME_LIST[];
487 static const GX_CSTR IGNORE_FILE_NAME_LIST[];
489 static const GX_CSTR IGNORE_EXTENSION_NAME_LIST[];
490
492 //-------------------------------------------------------------
494 //-------------------------------------------------------------
496public:
498 GxGuiFormBody( void );
500 GxGuiFormBody( GxToolBase* pTool, GxGuiContentView* pGuiContentView );
501
503 b32 initialize( void ) override;
505 void cleanup( void ) override;
506
508 //-------------------------------------------------------------
510 //-------------------------------------------------------------
512public:
514 void onDragMouseUp( u32 button ) override;
515
516protected:
518 void update(void) override;
519
521 void onDraw( void ) override;
522
524 void onMouseMove( const GxPoint2& position ) override;
526 void onMouseDown( const GxPoint2& position, u32 button ) override;
528 void onMouseUp( const GxPoint2& position, u32 button ) override;
530 void onDoubleClick( const GxPoint2& position, u32 button ) override;
532 void onKeyDown( GxKeyboard::KEY key ) override;
533
535 void onMouseWheel( const GxPoint2& position, s32 rotate ) override;
536
537private:
539 void createPopupMenu( const GxPoint2& position, const GxPropertyTable& table );
541 void createPopupMenuPropertyTable( GxPropertyTable& table );
542
544 u32 getSameFileNameCount( GX_CSTR srcPath, GX_CSTR baseFileName, GX_CSTR fileExtension, b32 isSearchDirectory );
545
547 void eventCreateDirectory( void );
549 void callbackCreateResource(const GxRttiResource& rttiResource);
551 void eventRemoveConfirm( void );
553 void callbackRemove( void );
555 void removeFile( GX_CSTR rootPath, GX_CSTR srcPath, GX_CSTR deleteFilePath );
557 void removeDirectory( GX_CSTR rootPath, GX_CSTR srcPath, GxArray& removeDirectoryList );
559 void eventCut( void );
561 void eventCopy( void );
563 void eventPaste( GX_CSTR newFileName = "" );
565 void pasteCut( GX_CSTR rootPath, GX_CSTR srcPath, const GxString& dstPath, const GxString& cutFilePath, GX_CSTR newFileName, GxArray& removeDirectoryList, b32 isAddRemoveDirectory );
567 void pasteCopy( GX_CSTR rootPath, GX_CSTR srcPath, const GxString& dstPath, const GxString& copyFilePath );
568#if defined( _WINDOWS )
570 void eventRename( void );
572 static LRESULT CALLBACK MyDialogProc( HWND handleDialogWindow, UINT message, WPARAM wParam, LPARAM lParam );
573#endif // _WINDOWS
574
576 void convertGuidFilePath( GX_CSTR rootPath, GX_CSTR extension, GxString& path );
577
579 void clearCutNode( void );
581 void clearCopyNode( void );
582
584 void updateDrawNode( void );
586 void updateDrawNodeSub( GX_CSTR srcPath, GxArrayClassBase& directoryList, GxArrayClassBase& fileList );
588 void clearDrawNode( void );
590 void drawNode( GxFilePath* pFilePath, const GxPoint2& mousePosition, const GxRect& rect );
591
593 b32 isAllowDrawDirectoryName( GX_CSTR rootPath, GX_CSTR targetPath );
595 b32 isAllowDrawFileName( GX_CSTR rootPath, GX_CSTR targetPath );
597 b32 isAllowDrawExtensionName( GX_CSTR extension );
598
600 //-------------------------------------------------------------
602 //-------------------------------------------------------------
604public:
606 GX_FORCE_INLINE u32 getRegionHeight( void ) const { return _pGuiContentView->isListView() ? LIST_VIEW_REGION_HEIGHT : TILE_VIEW_REGION_HEIGHT; }
607
609 //-------------------------------------------------------------
611 //-------------------------------------------------------------
613private:
614 GxToolBase* _pParentTool;
615 GxGuiContentView* _pGuiContentView;
616
617 GxArrayClassBase _drawNodeArray;
618 GxArrayClassBase _selectNodeArray;
619 GxArrayClassBase _cutNodeArray;
620 GxArrayClassBase _copyNodeArray;
621
622 s32 _lastClickNodeIndex;
623 s32 _drawMin;
624 s32 _drawMax;
625
627};
628
629//===========================================================================
631//===========================================================================
632class GxToolContentManager::GxGuiContentView::GxGuiFormBar : public GxGuiForm
633{
634 //-----------------------------------------------------------
636 //-----------------------------------------------------------
638public:
639 // RTTI定義
640 GX_RTTI_CLASS( GxToolContentManager::GxGuiContentView::GxGuiFormBar, GxGuiForm )
641 // 基底継承クラス用禁止宣言
643
644
645 //-----------------------------------------------------------
647 //-----------------------------------------------------------
649public:
651 GxGuiFormBar( void );
653 GxGuiFormBar( GxGuiContentView* pGuiContentView, GxGuiFormBody* pGuiContentViewBody );
654
656 //-----------------------------------------------------------
658 //-----------------------------------------------------------
660protected:
662 void update( void ) override;
663
665 void onMouseWheel( const GxPoint2& position, s32 rotate ) override;
666
668 //-----------------------------------------------------------
670 //-----------------------------------------------------------
672private:
673 GxGuiContentView* _pGuiContentView;
674 GxGuiFormBody* _pGuiContentViewBody;
675
676 s32 _oldScrollOffsetY;
677
679};
680
681GX_CORE_NAMESPACE_END()
682
683#endif // GX_DEVELOP
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
#define GX_PROHIBIT_CLASS_BASE(__CLASS__)
GxClassBase継承の禁止宣言
Definition GxBase.h:240
配列クラス
Definition GxArrayClassBase.h:18
配列クラス
Definition GxArray.h:18
オブジェクト基底クラス
Definition GxBase.h:88
ファイルパス管理クラス
Definition GxFile.h:376
static constexpr u32 VALUE_32
32
Definition GxMath.h:124
static constexpr u32 VALUE_1K
1K
Definition GxMath.h:129
static constexpr u32 VALUE_16
16
Definition GxMath.h:123
static constexpr u32 VALUE_64
64
Definition GxMath.h:125
プロパティテーブルクラス
Definition GxProperty.h:1641
ICON_TYPE
アイコンタイプ定義
Definition GxRtti.h:202
リソース実行時型情報クラス
Definition GxRttiResource.h:188
Definition GxColor.h:21
座標
Definition GxStruct.h:867
矩形
Definition GxStruct.h:951
サイズ
Definition GxStruct.h:730
文字列型クラス
Definition GxString.h:18
32bitブーリアン
Definition GxDefine.h:173