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

# Content
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 * which should be included with libndk as the file COPYING.
7 */
8 #include <stdexcept>
9
10 #include <ndk/align.hh>
11
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 throw std::runtime_error ("unknown align type");
25 }
26 }