static CFComparisonResult PortSorter(const void *lhs, const void *rhs, void *context)
	// Compares two port dictionaries and orders them appropriately.
{
	#pragma unused(context)
	CFDictionaryRef lhsDict;
	CFDictionaryRef rhsDict;
	int lhsOrder;
	int rhsOrder;

	assert(lhs != NULL);
	assert(rhs != NULL);
	
	lhsDict = (CFDictionaryRef) lhs;
	assert( CFGetTypeID(lhsDict) == CFDictionaryGetTypeID() );
	rhsDict = (CFDictionaryRef) rhs;
	assert( CFGetTypeID(rhsDict) == CFDictionaryGetTypeID() );
	
	lhsOrder = SortOrder(lhsDict);
	rhsOrder = SortOrder(rhsDict);

    if (lhsOrder > rhsOrder)
        return kCFCompareGreaterThan;

    if (lhsOrder < rhsOrder)
        return kCFCompareLessThan;

    // objects are the same type, so order by name

    return CFStringCompare( 
                (CFStringRef) CFDictionaryGetValue(lhsDict, kSCPropUserDefinedName), 
                (CFStringRef) CFDictionaryGetValue(rhsDict, kSCPropUserDefinedName), kCFCompareLocalized);
}
Esempio n. 2
0
#include "userlist.h"
#include "usermenu.h"
#include "utils/sortutil.h"
#include "log.h"


BEGIN_EVENT_TABLE(NickListCtrl, NickListCtrl::BaseType)
EVT_LIST_ITEM_ACTIVATED(NICK_LIST, NickListCtrl::OnActivateItem)
EVT_CONTEXT_MENU(NickListCtrl::OnShowMenu)
#if wxUSE_TIPWINDOW
EVT_MOTION(NickListCtrl::OnMouseMotion)
#endif
END_EVENT_TABLE()

template <>
SortOrder NickListCtrl::BaseType::m_sortorder = SortOrder();

NickListCtrl::NickListCtrl(wxWindow* parent, bool show_header, ChatPanelMenu* popup, bool singleSelectList,
			   const wxString& name, bool highlight)
    : NickListCtrl::BaseType(parent, NICK_LIST, wxDefaultPosition, wxDefaultSize,
			     wxLC_VIRTUAL | wxSUNKEN_BORDER | wxLC_REPORT | (int)(!show_header) * wxLC_NO_HEADER | (int)(singleSelectList) * wxLC_SINGLE_SEL,
			     name, 3, &NickListCtrl::CompareOneCrit, highlight, UserActions::ActHighlight, true /*periodic sort*/)
    , m_menu(popup)
{
	AddColumn(0, 20, _("s"), _T( "Status" ));
	AddColumn(1, 20, _("c"), _T( "Country" ));
	AddColumn(2, 20, _("r"), _T( "Rank" ));
	AddColumn(3, 180, _("Nickname"), _T( "Nickname" ));

	if (m_sortorder.size() == 0) {
		m_sortorder[0].col = 0;
Esempio n. 3
0
#endif // _MSC_VER

#include <wx/intl.h>
#include <wx/menu.h>
#include <wx/datetime.h>

#include "torrentlistctrl.h"
#include "torrentwrapper.h"
//#include "utils/.h"
#include "iconimagelist.h"

#include "utils/conversion.h"

static const wxString na_str = wxString(_("N/A"));

template<> SortOrder TorrentListCtrl::BaseType::m_sortorder = SortOrder();

BEGIN_EVENT_TABLE( TorrentListCtrl, TorrentListCtrl::BaseType )

	EVT_LIST_ITEM_RIGHT_CLICK	( TLIST_CLICK, TorrentListCtrl::OnListRightClick )
	//EVT_LIST_COL_CLICK			( TLIST_CLICK, TorrentListCtrl::OnColClick )
	EVT_MENU					( TLIST_CANCEL, TorrentListCtrl::OnCancel )
	EVT_MENU					( TLIST_RETRY, TorrentListCtrl::OnRetry )
	#if wxUSE_TIPWINDOW
	#ifndef __WXMSW__ //disables tooltips on win
	EVT_MOTION( TorrentListCtrl::OnMouseMotion )
	#endif
	#endif
END_EVENT_TABLE()

TorrentListCtrl::TorrentListCtrl( wxWindow* parent )
Esempio n. 4
0
#include "battle.h"
#include "ibattle.h"
#include "uiutils.h"
#include "ui.h"
#include "user.h"
#include "server.h"
#include "utils/debug.h"
#include "utils/conversion.h"
#include "uiutils.h"
#include "countrycodes.h"
#include "mainwindow.h"
#include "aui/auimanager.h"
#include "utils/customdialogs.h"
#include "settings.h"

template<> SortOrder CustomVirtListCtrl<User*,BattleroomListCtrl>::m_sortorder = SortOrder();

BEGIN_EVENT_TABLE( BattleroomListCtrl,  BattleroomListCtrl::BaseType )

  EVT_LIST_ITEM_RIGHT_CLICK( BRLIST_LIST, BattleroomListCtrl::OnListRightClick )
  EVT_MENU                 ( BRLIST_SPEC, BattleroomListCtrl::OnSpecSelect )
  EVT_MENU                 ( BRLIST_KICK, BattleroomListCtrl::OnKickPlayer )
  EVT_LIST_ITEM_ACTIVATED( BRLIST_LIST, BattleroomListCtrl::OnActivateItem )
//  EVT_MENU                 ( BRLIST_ADDCREATEGROUP, BattleroomListCtrl::OnPlayerAddToGroup )
//  EVT_MENU                 ( BRLIST_ADDTOGROUP, BattleroomListCtrl::OnPlayerAddToGroup )
  EVT_MENU                 ( BRLIST_RING, BattleroomListCtrl::OnRingPlayer )
  EVT_MENU                 ( BRLIST_COLOUR, BattleroomListCtrl::OnColourSelect )
  EVT_MENU                 ( BRLIST_HANDICAP, BattleroomListCtrl::OnHandicapSelect )
#if wxUSE_TIPWINDOW
#ifndef __WXMSW__ //disables tooltips on win
  EVT_MOTION(BattleroomListCtrl::OnMouseMotion)
Esempio n. 5
0
#include "channellistctrl.h"
#include "../iconimagelist.h"
#include "../utils/conversion.h"
#include "../ui.h"
#include <algorithm>
#include "../helper/sortutil.h"

template<> SortOrder CustomVirtListCtrl<ChannelInfo,ChannelListctrl>::m_sortorder = SortOrder();

BEGIN_EVENT_TABLE( ChannelListctrl, ChannelListctrl::BaseType )
  EVT_LIST_ITEM_ACTIVATED( CHANNELLIST, ChannelListctrl::OnActivateItem )
END_EVENT_TABLE()


ChannelListctrl::ChannelListctrl(wxWindow* parent, wxWindowID /*unused*/, const wxString& /*unused*/,
                    long /*unused*/, const wxPoint& /*unused*/, const wxSize& /*unused*/)
	:CustomVirtListCtrl<ChannelInfo,ChannelListctrl>( parent, CHANNELLIST, wxDefaultPosition, wxDefaultSize,
													wxSUNKEN_BORDER | wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_ALIGN_LEFT,
													_T("ChannelListCtrl"), 3, &ChannelListctrl::CompareOneCrit)
{
#if defined(__WXMSW__)
    const int widths [3] = { wxLIST_AUTOSIZE, wxLIST_AUTOSIZE, wxLIST_AUTOSIZE };
#elif defined(__WXMAC__)
    const int widths [3] = { wxLIST_AUTOSIZE, wxLIST_AUTOSIZE, wxLIST_AUTOSIZE };
#else
    const int widths [3] = { wxLIST_AUTOSIZE, wxLIST_AUTOSIZE, wxLIST_AUTOSIZE };
#endif

    AddColumn( 0, widths[0], _("Channel"), _T("Channelname") );
    AddColumn( 1, widths[1], _("# users"), _T("Users") );
    AddColumn( 2, widths[2], _T("Topic"), _T("Topic") );
Esempio n. 6
0
#endif // _MSC_VER

#include <wx/intl.h>
#include <wx/menu.h>
#include <wx/datetime.h>
#include <boost/algorithm/string.hpp>

#include "downloadlistctrl.h"
#include "prdownloader.h"
#include "iconimagelist.h"
#include "utils/conversion.h"
#include "downloadsobserver.h"

static const wxString na_str = wxString(_("N/A"));

template<> SortOrder DownloadListCtrl::BaseType::m_sortorder = SortOrder();

BEGIN_EVENT_TABLE( DownloadListCtrl, DownloadListCtrl::BaseType )

	EVT_LIST_ITEM_RIGHT_CLICK	( TLIST_CLICK, DownloadListCtrl::OnListRightClick )
	//EVT_LIST_COL_CLICK			( TLIST_CLICK, DownloadListCtrl::OnColClick )
	EVT_MENU					( TLIST_CANCEL, DownloadListCtrl::OnCancel )
	EVT_MENU					( TLIST_RETRY, DownloadListCtrl::OnRetry )
	#if wxUSE_TIPWINDOW
	#ifndef __WXMSW__ //disables tooltips on win
	EVT_MOTION( DownloadListCtrl::OnMouseMotion )
	#endif
	#endif
END_EVENT_TABLE()

DownloadListCtrl::DownloadListCtrl( wxWindow* parent )
Esempio n. 7
0
#include "../iconimagelist.h"
#include "../uiutils.h"
#include "../ui.h"


BEGIN_EVENT_TABLE_TEMPLATE1(PlaybackListCtrl, PlaybackListCtrl::BaseType, PlaybackType )

  EVT_LIST_ITEM_RIGHT_CLICK( RLIST_LIST, PlaybackListCtrl::OnListRightClick )
  EVT_MENU                 ( RLIST_DLMAP, PlaybackListCtrl::OnDLMap )
  EVT_MENU                 ( RLIST_DLMOD, PlaybackListCtrl::OnDLMod )
  EVT_LIST_COL_CLICK       ( RLIST_LIST, ParentType::OnColClick )
  EVT_KEY_DOWN			   ( PlaybackListCtrl::OnChar )

END_EVENT_TABLE()

template<class T,class L> SortOrder CustomVirtListCtrl<T,L>::m_sortorder = SortOrder();

template <class PlaybackType>
PlaybackListCtrl<PlaybackType>::PlaybackListCtrl( wxWindow* parent  ):
  PlaybackListCtrl::BaseType(parent, RLIST_LIST, wxDefaultPosition, wxDefaultSize,
							wxSUNKEN_BORDER | wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_ALIGN_LEFT,
							_T("PlaybackListCtrl"), 4, &PlaybackListCtrl::CompareOneCrit )
{
#ifdef __WXMSW__
    const int hd = wxLIST_AUTOSIZE_USEHEADER;
    const int widths[8] = {80,140,141,hd,160,hd,70,180};
#else
    const int widths[8] = {80,140,141,50,160,50,70,180};

#endif
Esempio n. 8
0
#include <wx/intl.h>
#include <wx/menu.h>

#include "user.h"
#include "iconimagelist.h"
#include "uiutils.h"
#include "ui.h"
#include "server.h"
#include "countrycodes.h"
#include "settings.h"
#include "utils/customdialogs.h"
#include "useractions.h"
#include "helper/sortutil.h"
#include "aui/auimanager.h"

template<> SortOrder CustomVirtListCtrl<IBattle*,BattleListCtrl>::m_sortorder = SortOrder();

BEGIN_EVENT_TABLE(BattleListCtrl, BattleListCtrl::BaseType )

  EVT_LIST_ITEM_RIGHT_CLICK( BLIST_LIST, BattleListCtrl::OnListRightClick )
  EVT_MENU                 ( BLIST_DLMAP, BattleListCtrl::OnDLMap )
  EVT_MENU                 ( BLIST_DLMOD, BattleListCtrl::OnDLMod )
#if wxUSE_TIPWINDOW
#if !defined(__WXMSW__) /* && !defined(__WXMAC__) */ //disables tooltips on msw /* and mac */
  EVT_MOTION(BattleListCtrl::OnMouseMotion)
#endif
#endif
END_EVENT_TABLE()

BattleListCtrl::BattleListCtrl( wxWindow* parent )
	: CustomVirtListCtrl< IBattle *,BattleListCtrl>(parent, BLIST_LIST, wxDefaultPosition, wxDefaultSize,
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

#include "contentsearchresultslistctrl.h"
#include "../utils/conversion.h"

template<> SortOrder ContentSearchResultsListctrl::BaseType::m_sortorder = SortOrder();

BEGIN_EVENT_TABLE( ContentSearchResultsListctrl, ContentSearchResultsListctrl::BaseType )
  
END_EVENT_TABLE()

ContentSearchResultsListctrl::ContentSearchResultsListctrl(wxWindow* parent, wxWindowID id, const wxString& name, long int style, const wxPoint& pt, const wxSize& sz):
  ContentSearchResultsListctrl::BaseType(parent, id, wxDefaultPosition, wxDefaultSize,
									   wxSUNKEN_BORDER | wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_ALIGN_LEFT, _T("ContentSearchResultsListctrl"),
									   3, &ContentSearchResultsListctrl::CompareOneCrit)
{
  AddColumn(0,wxLIST_AUTOSIZE,_("Name"),_("Name"));
  AddColumn(1,wxLIST_AUTOSIZE,_("Preview"),_("Preview"));
  AddColumn(2,wxLIST_AUTOSIZE,_("Type"),_("Type"));
  AddColumn(3,wxLIST_AUTOSIZE,_("Size"),_("Size"));