![]() | Logo by Alessandro Bacchia (anonymous IP: 216.73.217.15,2528) | |||||||||||||
| ||||||||||||||
Audio (353) Datatype (52) Demo (214) Development (631) Document (24) Driver (104) Emulation (157) Game (1069) Graphics (519) Library (124) Network (248) Office (75) Utility (962) Video (75) Total files: 4607 Full index file Recent index file
Amigans.net Aminet IntuitionBase Hyperion Entertainment A-Eon Amiga Future
Support the site
|
FileBrowser 1.1 - a ListBrowser with an icon view
=================================================
FileBrowser is a subclass of listbrowser.gadget that can also show its list
as icons: each node becomes a cell with its image or icon on top and its
column texts below, laid out in a grid like a Workbench drawer window.
This is a developer release. FileBrowser is not a library: you add
FileBrowser.c to your program's build and include FileBrowser.h.
In the default details mode the gadget *is* a ListBrowser: every method
goes to listbrowser.gadget, so you can replace a ListBrowser with a
FileBrowser and nothing changes. One attribute switches to the icon view:
SetGadgetAttrs(gad, win, NULL, FILEBROWSER_ViewMode, FBVM_ICONS, TAG_DONE);
The list, the column info and your event handling stay as they are:
selection, double-clicks (LBRE_DOUBLECLICK), LISTBROWSER_Selected and the
other selection attributes keep working in both views.
Icon view
---------
- Cells flow left to right, top to bottom; the view scrolls vertically.
- The node's LBNCA_Image, or a full size icon (struct DiskObject) that
your program returns from FILEBROWSER_IconHook.
- FILEBROWSER_IconSize gives every cell the same image box, like an icon
grid: larger icons are scaled down, keeping their aspect ratio.
- One text line per list column; FILEBROWSER_HiddenColumns hides some.
- Click, Shift-click, double-click, a selection box (lasso) dragged from
empty space, the mouse wheel, and dragging selected cells for your own
drag & drop.
- Drawn through an offscreen bitmap, so scrolling doesn't flicker.
Contents
--------
FileBrowser/
FileBrowser.readme this file
LICENSE public domain (The Unlicense)
Autodocs/FileBrowser.doc
the class: attributes, methods, functions
Include/FileBrowser.h the attributes and MakeFileBrowserClass()
Source/FileBrowser.c the class
Demo/FileBrowserDemo a ready-built example: lists a drawer (SYS: by
default, or "FileBrowserDemo <drawer>") and a
button switches between the two views
Demo/FileBrowserDemo.c, Demo/makefile
its source; "make" in Demo/ builds it
Using it
--------
1. Copy Include/FileBrowser.h and Source/FileBrowser.c into your project
and compile FileBrowser.c with the rest of your program.
2. Open the interfaces the class uses (it uses your program's global
interface pointers): IExec, IIntuition, IGraphics, ILayers, IUtility,
IIcon and IListBrowser.
3. Make the class, then gadgets from it:
#include "FileBrowser.h"
struct IClass *cl = MakeFileBrowserClass();
Object *gad = NewObject(cl, NULL,
GA_ID, GID_FILES,
GA_RelVerify, TRUE,
LISTBROWSER_Labels, &list,
LISTBROWSER_ColumnInfo, columninfo,
LISTBROWSER_ColumnTitles, TRUE,
LISTBROWSER_MultiSelect, TRUE,
TAG_DONE);
4. When the windows are gone: FreeFileBrowserClass(cl).
The class is private: objects are made with the class pointer, not by
name. Autodocs/FileBrowser.doc describes every attribute; Demo/ shows a
complete program.
Building the demo: the makefile uses ppc-amigaos-gcc, as in the AmigaOS 4
SDK and in cross compilers. If your SDK only has "gcc", run
"make CC=gcc". FileBrowser.c doesn't depend on a C library: it only uses
AmigaOS interfaces, so it builds with newlib (the default) as well as
clib4. The demo is written for newlib: it defines IUtility itself, which
clib4's startup code also does.
FILEBROWSER_VERSION and FILEBROWSER_REVISION in FileBrowser.h tell which
release a copy of the header belongs to.
License
-------
Public domain. Use it in any program, free or commercial, change it, and
leave out credits if you like. See LICENSE.
History
-------
1.1 (15.11.2026)
- Dragging a selection box past the top or bottom of the view (which
scrolls it) no longer draws lines of the box outside the view. The
box's corner stays inside the view while it scrolls, so the box is
always seen.
- The mouse wheel also scrolls while a selection box is dragged.
- Icon view paints the thin gaps around the cells and the scroll bar;
bits of the list view showed through there after switching views.
1.0 (15.11.2026)
- First release.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright © 2004-2026 by Björn Hagström All Rights Reserved |