campo-sirio/al/cpp_ui.win/archwin.cpp
alex 714dd74636 Archive Library versione 2.00
git-svn-id: svn://10.65.10.50/trunk@5350 c028cbd2-c16b-5b4b-a496-9718f37d4682
1997-10-09 16:09:54 +00:00

140 lines
3.6 KiB
C++
Executable File

//
// ARCHWIN.CPP
//
// Source file for ArchiveLib 2.0
//
// Copyright (c) Greenleaf Software, Inc. 1994-1996
// All Rights Reserved
//
// CONTENTS
//
// ALArchive::FillListBox()
// ALArchiveFillListBox()
//
// DESCRIPTION
//
// A single function that provides Windows UI support for ALArchive.
//
// REVISION HISTORY
//
// February 14, 1996 2.0A : New release
#include "arclib.h"
#if !defined( AL_IBM )
#pragma hdrstop
#endif
//
// NAME
//
// ALArchive::FillListBox()
//
// PLATFORMS/ENVIRONMENTS
//
// PM
// C++ C
//
// SHORT DESCRIPTION
//
// Fill a Windows list box control with the file names from an archive.
//
// C++ SYNOPSIS
//
// #include "arclib.h"
//
// int ALArchive::FillListBox( HWND hDlg,
// int list_box_id = -1 );
//
// C SYNOPSIS
//
// #include "arclib.h"
//
// int ALArchiveFillListBox( hALArchive this_object,
// HWND hDlg,
// int list_box_id );
//
// VB SYNOPSIS
//
// Declare Function ALArchiveFillListBox Lib "AL20LW"
// (ByVal this_object&, ByVal hDlg%, ByVal list_box_id%) As Integer
//
// DELPHI SYNOPSIS
//
// function ALArchiveFillListBox( this_object : hALArchive;
// hDlg : HWnd;
// list_box_id : Integer ) : Integer;
//
// ARGUMENTS
//
// this_object : A reference or pointer to the ALArchive object that
// is going to fill this list box. Note that the C++ member
// fn version of this call doesn't have an explicit argument
// here, since it has access to 'this' implicitly.
//
// hDlg : This argument can represent one of two things.
// If the value of list_box_id is set to -1, it means that
// hWnd refers to an actual list box itself. If the value
// of list_box_id is not -1, it means that hWnd referes
// to a dialog box, and list_box_id refers the id of a
// list box control within that dialog box.
//
// list_box_d : See the description of hWnd for a full detail of what
// this argument does.
//
// DESCRIPTION
//
// This is a quicky useful function to read the names of all the
// storage objects out of this, then stuffing them all into a list
// box.
//
// RETURNS
//
// The count of objects in the archive, or an error status < 0.
//
// EXAMPLE
//
// SEE ALSO
//
// REVISION HISTORY
//
// February 14, 1996 2.0A : New release
//
int AL_PROTO
ALArchive::FillListBox( HWND hDlg, /* Tag public function */
int list_box_id /* = -1 */ )
{
ALEntryList list;
HWND window;
ReadDirectory( list );
if ( list_box_id != -1 )
window = GetDlgItem( hDlg, (short int) list_box_id );
else
window = hDlg;
int count;
if ( ( count = list.FillListBox( window ) ) == 0 ) {
if ( mStatus < 0 ) {
SendMessage( window, LB_RESETCONTENT, 0, 0 );
SendMessage( window,
LB_ADDSTRING,
0,
(LPARAM)( (LPSTR) "Error!" ) );
}
}
return count;
}
#if !defined( AL_NO_C )
extern "C" AL_LINKAGE int AL_FUNCTION
ALArchiveFillListBox( hALArchive this_object, /* Tag public function */
HWND hDlg,
int list_box_id )
{
AL_ASSERT_OBJECT( this_object, ALArchive, "ALArchiveFillListBox" );
return ((ALArchive *) this_object)->FillListBox( hDlg, list_box_id );
}
#endif