summaryrefslogtreecommitdiff
path: root/indra/newview/llgltffolderitem.h
blob: a748e2fb6a4686af23d6f681df1fd9bf0a68018c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/**
 * @file llgltffolderitem.h
 * @author Andrey Kleshchev
 * @brief LLGLTFFolderItem header file
 *
 * $LicenseInfo:firstyear=2024&license=viewerlgpl$
 * Second Life Viewer Source Code
 * Copyright (C) 2024, Linden Research, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2.1 of the License only.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 * $/LicenseInfo$
 */

#ifndef LL_LLGLTFFOLDERITEM_H
#define LL_LLGLTFFOLDERITEM_H

#include "llfloater.h"

#include "llfolderviewmodel.h"

class LLGLTFFolderItem : public LLFolderViewModelItemCommon
{
public:
    enum EType
    {
        TYPE_ROOT,
        TYPE_SCENE,
        TYPE_NODE,
        TYPE_MESH,
        TYPE_SKIN,
    };

    LLGLTFFolderItem(S32 id, const std::string &display_name, EType type, LLFolderViewModelInterface& root_view_model);
    LLGLTFFolderItem(LLFolderViewModelInterface& root_view_model);
    virtual ~LLGLTFFolderItem();

    void init();

    const std::string& getName() const override { return mName; }
    const std::string& getDisplayName() const override { return mName; }
    const std::string& getSearchableName() const override { return mName; }

    std::string getSearchableDescription() const override { return std::string(); }
    std::string getSearchableCreatorName()const override { return std::string(); }
    std::string getSearchableUUIDString() const override { return std::string(); }

    LLPointer<LLUIImage> getIcon() const override { return pIcon; }
    LLPointer<LLUIImage> getIconOpen() const override { return getIcon(); }
    LLPointer<LLUIImage> getIconOverlay() const override { return NULL; }

    LLFontGL::StyleFlags getLabelStyle() const override { return LLFontGL::NORMAL; }
    std::string getLabelSuffix() const override { return std::string(); }

    void openItem(void) override {}
    void closeItem(void) override {}
    void selectItem(void) override {}

    void navigateToFolder(bool new_window = false, bool change_mode = false) override {}

    bool isFavorite() const override { return false; }
    bool isItemWearable() const override { return false; }

    bool isItemRenameable() const override { return false; }
    bool renameItem(const std::string& new_name) override { return false; }

    bool isItemMovable(void) const override { return false; } // Can be moved to another folder
    void move(LLFolderViewModelItem* parent_listener) override {}

    bool isItemRemovable(bool check_worn = true) const override { return false; }
    bool isItemInTrash(void) const override { return false; }
    bool removeItem() override { return false; }
    void removeBatch(std::vector<LLFolderViewModelItem*>& batch) override {}

    bool isItemCopyable(bool can_copy_as_link = true) const override { return false; }
    bool copyToClipboard() const override { return false; }
    bool cutToClipboard() override { return false; }
    bool isCutToClipboard() override { return false; }

    bool isClipboardPasteable() const override { return false; }
    void pasteFromClipboard() override {}
    void pasteLinkFromClipboard() override {}

    bool isAgentInventory() const override { return false; }
    bool isAgentInventoryRoot() const override { return false; }

    void buildContextMenu(LLMenuGL& menu, U32 flags) override {};

    bool potentiallyVisible() override { return true; }; // is the item definitely visible or we haven't made up our minds yet?

    bool hasChildren() const override { return mChildren.size() > 0; }

    bool dragOrDrop(
        MASK mask,
        bool drop,
        EDragAndDropType cargo_type,
        void* cargo_data,
        std::string& tooltip_msg) override
    {
        return false;
    }

    bool filterChildItem(LLFolderViewModelItem* item, LLFolderViewFilter& filter);
    bool filter(LLFolderViewFilter& filter) override;

    EType getType() const { return mItemType; }
    S32 getItemId() const { return mItemId; }

private:
    LLUIImagePtr pIcon;
    std::string mName;
    EType mItemType = TYPE_ROOT;

    // mItemId can be an id in a mesh vector, node vector or any other vector.
    // mItemId is not nessesarily unique, ex: some nodes can reuse the same
    // mesh or skin, so mesh-items can have the same id.
    S32 mItemId = -1;
};

#endif