| 1 | /* fre:ac - free audio converter |
| 2 | * Copyright (C) 2001-2019 Robert Kausch <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation, either version 2 of |
| 7 | * the License, or (at your option) any later version. |
| 8 | * |
| 9 | * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR |
| 10 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 11 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ |
| 12 | |
| 13 | #include <gui/edit_folder.h> |
| 14 | |
| 15 | freac::FolderEditBox::FolderEditBox(const Point &iPos, const Size &iSize, Int maxSize) : EditBox(iPos, iSize, maxSize) |
| 16 | { |
| 17 | cursor->Deactivate(); |
| 18 | } |
| 19 | |
| 20 | Int freac::FolderEditBox::Paint(Int message) |
| 21 | { |
| 22 | if (!IsRegistered()) return Error(); |
| 23 | if (!IsVisible()) return Success(); |
| 24 | |
| 25 | switch (message) |
| 26 | { |
| 27 | case SP_PAINT: |
| 28 | { |
| 29 | Surface *surface = GetDrawSurface(); |
| 30 | Rect frame = Rect(GetRealPosition(), GetRealSize()); |
| 31 | |
| 32 | surface->StartPaint(GetVisibleArea()); |
| 33 | |
| 34 | cursor->SetBackgroundColor(Setup::BackgroundColor); |
| 35 | |
| 36 | surface->Box(frame, Setup::BackgroundColor, Rect::Filled); |
| 37 | surface->Frame(frame, FRAME_DOWN); |
| 38 | |
| 39 | Widget::Paint(message); |
| 40 | |
| 41 | surface->EndPaint(); |
| 42 | } |
| 43 | |
| 44 | if (comboBox != NIL) |
| 45 | { |
| 46 | comboBox->onSelectEntry.DisconnectAll(); |
| 47 | comboBox->onSelectEntry.Connect(&FolderEditBox::OnSelectEntry, this); |
| 48 | } |
| 49 | |
| 50 | return Success(); |
| 51 | } |
| 52 | |
| 53 | return Widget::Paint(message); |
| 54 | } |
| 55 | |
| 56 | Void freac::FolderEditBox::OnSelectEntry(ListEntry *entry) |
| 57 | { |
| 58 | cursor->SetText(entry->GetText()); |
| 59 | |
| 60 | onSelectEntry.Emit(entry); |
| 61 | onInput.Emit(cursor->GetText()); |
| 62 | } |