ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/dclient/src/backend/ndk/align.cpp
Revision: 1.3
Committed: Mon Feb 7 19:18:45 2011 UTC (15 years, 8 months ago) by sf-pippijn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +3 -1 lines
Log Message:
inventory_widget: don't fault on pgdn with only one item

by Jonathan Neuschäfer <j.neuschaefer@gmx.net>

File Contents

# User Rev Content
1 sf-pippijn 1.1 /* align.cc
2     * This file is part of NDK++ library
3     * Copyright (c) 2003 by Stanislav Ievlev
4     *
5     * This file is covered by the GNU Library General Public License,
6 sf-pippijn 1.2 * which should be included with libndk as the file COPYING.
7 sf-pippijn 1.1 */
8 sf-pippijn 1.3 #include <stdexcept>
9    
10 sf-pippijn 1.2 #include <ndk/align.hh>
11 sf-pippijn 1.1
12     int
13     ndk::align::pos (int internal_size, int external_size, align::type align)
14     {
15     switch (align)
16     {
17     case left:
18     return 0;
19     case right:
20     return external_size - internal_size;
21     case center:
22     return (external_size - internal_size) / 2;
23     default:
24 sf-pippijn 1.3 throw std::runtime_error ("unknown align type");
25 sf-pippijn 1.1 }
26     }