OS4 DepotLogo by Alessandro Bacchia 
(anonymous IP: 216.73.217.15,2528) 
 HomeRecentStatsSearchSubmitUploadsMirrorsContactInfoDisclaimerConfigAdmin
 Menu

 Features
   Crashlogs
   Bug tracker
   Locale browser
   Markdown composer
 

 Categories

   o Audio (353)
   o Datatype (52)
   o Demo (214)
   o Development (631)
   o Document (24)
   o Driver (104)
   o Emulation (157)
   o Game (1069)
   o Graphics (519)
   o Library (124)
   o Network (248)
   o Office (75)
   o Utility (962)
   o Video (75)

Total files: 4607

Full index file
Recent index file

 Links

  Amigans.net
  Aminet
  IntuitionBase
  Hyperion Entertainment
  A-Eon
  Amiga Future


Support the site


 Readme for:  Development » Library » Gui » filebrowser.lha

FileBrowser

Description: ListBrowser subclass with an icon view (dev)
Download: filebrowser.lha       (TIPS: Use the right click menu if your browser takes you back here all the time)
Size: 150kb
Version: 1.1
Date: 15 Nov 2026
Author: Björn Hagström
Submitter: Björn Hagström
Homepage: http://openamiga.org/?function=viewproject&projectid=52
Requirements: AmigaOS 4.1 SDK
Category: development/library/gui
License: Public domain
Distribute: yes
Min OS Version: 4.1
FileID: 14273
 
Comments: 0
Snapshots: 0
Videos: 0
Downloads: 9  (Current version)
9  (Accumulated)
Votes: 0 (0/0)  (30 days/7 days)

Show comments Show snapshots Show videos Show content Show crashlogs Replace file 
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