1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 20 #pragma once 21 22 #include <vcl/weld.hxx> 23 24 #include <memory> 25 26 namespace sd { 27 28 #define SMALL_ICON_SIZE 16 29 #define TOP_OFFSET 5 30 #define ICON_HEIGHT 42 31 #define ICON_WIDTH 47 32 #define ICON_OFFSET 72 33 #define RIGHT_ICON_OFFSET 5 34 #define SPACE_BETWEEN 3 35 36 class ClientBox; 37 struct ClientBoxEntry; 38 struct ClientInfo; 39 40 typedef std::shared_ptr<ClientBoxEntry> TClientBoxEntry; 41 42 struct ClientBoxEntry 43 { 44 std::unique_ptr<weld::Builder> m_xBuilder; 45 std::unique_ptr<weld::Container> m_xContainer; 46 std::unique_ptr<weld::Label> m_xDeviceName; 47 std::unique_ptr<weld::Label> m_xPinLabel; 48 std::unique_ptr<weld::Entry> m_xPinBox; 49 std::unique_ptr<weld::Button> m_xDeauthoriseButton; 50 51 std::shared_ptr<ClientInfo> m_xClientInfo; 52 ClientBox* m_pClientBox; 53 54 DECL_LINK(DeauthoriseHdl, weld::Button&, void); 55 DECL_LINK(FocusHdl, weld::Widget&, void); 56 57 ClientBoxEntry(ClientBox* pClientBox, const std::shared_ptr<ClientInfo>& pClientInfo); 58 ~ClientBoxEntry(); 59 }; 60 61 class ClientBox 62 { 63 std::unique_ptr<weld::ScrolledWindow> m_xScroll; 64 std::unique_ptr<weld::Container> m_xContents; 65 66 std::vector< TClientBoxEntry > m_vEntries; 67 ClientBoxEntry* m_pActive; 68 69 public: 70 ClientBox(std::unique_ptr<weld::ScrolledWindow> xScroll, std::unique_ptr<weld::Container> xContents); GetContainer()71 weld::Container* GetContainer() { return m_xContents.get(); } 72 ~ClientBox(); 73 74 ClientBoxEntry* GetActiveEntry(); 75 76 void addEntry(const std::shared_ptr<ClientInfo>& pClientInfo); 77 void setActive(ClientBoxEntry* pClientData); 78 void clearEntries(); 79 80 void populateEntries(); 81 }; 82 83 } // end namespace sd 84 85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 86