Input: add icons to the DeviceList
Change-Id: I2eaebca0f0e91e3420b7e63a4a568f4e658af253 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2722 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
589de4799a
commit
ed257f056f
10
src/preferences/input/IconHandles.h
Normal file
10
src/preferences/input/IconHandles.h
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright 2020, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
enum {
|
||||
mouse_icon = 1,
|
||||
touchpad_icon = 2,
|
||||
keyboard_icon = 3
|
||||
};
|
@ -27,10 +27,12 @@ const char* kSignature = "application/x-vnd.Haiku-Input";
|
||||
|
||||
InputApplication::InputApplication()
|
||||
:
|
||||
BApplication(kSignature)
|
||||
BApplication(kSignature),
|
||||
fIcons()
|
||||
{
|
||||
BRect rect(0, 0, 600, 500);
|
||||
InputWindow* window = new InputWindow(rect);
|
||||
DeviceListItemView::SetIcons(&fIcons);
|
||||
window->Show();
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,8 @@ public:
|
||||
InputApplication();
|
||||
void MessageReceived(BMessage* message);
|
||||
private:
|
||||
InputIcons fIcons;
|
||||
InputWindow* fWindow;
|
||||
};
|
||||
|
||||
#endif /* INPUT_H */
|
||||
#endif /* INPUT_H */
|
||||
|
@ -2,8 +2,6 @@ resource app_signature "application/x-vnd.Haiku-Input";
|
||||
|
||||
resource app_name_catalog_entry "x-vnd.Haiku-Input:System name:Input";
|
||||
|
||||
resource app_flags B_SINGLE_LAUNCH;
|
||||
|
||||
resource app_version {
|
||||
major = 1,
|
||||
middle = 0,
|
||||
@ -19,20 +17,188 @@ resource app_version {
|
||||
long_info = "Input Preferences ©2002-2020 Haiku"
|
||||
};
|
||||
|
||||
resource app_flags B_SINGLE_LAUNCH;
|
||||
|
||||
resource vector_icon {
|
||||
$"6E636966080301000002000202AC6DA33A810CBCBF0CAEA9C248C4E546BB2A00"
|
||||
$"6E6369660A0500040063020006023A9CFB3B0744BD682D3CF09A498CD74A42F0"
|
||||
$"00798291FF5B697D0200060239D8C838576FBB1EA33C90064B3B284A08CD0024"
|
||||
$"344BFF485567020006023D00000000000000004000004A000044000000C6CBD2"
|
||||
$"FF666F7D032A264005C70200160236227D3657C8B769C1371C1E4889A148271F"
|
||||
$"00FFFFC902001602375F6837E895BD682D3CF09A498CD7464BC300E2FF890597"
|
||||
$"0C0A045CC11A465A4C5A60C1E60A062240224646585A445A38382C0A04465022"
|
||||
$"40224646580A0446505A385A4446580A0446505A38382C22400A06BD9BB7BFBD"
|
||||
$"B0B86EBE7CB8BAB8B6BE1AB8CABE64BF28B86B0A06B7E9BDB4BDAFB86EBD9BB7"
|
||||
$"BFB73DBD9DB8CABE64B8B5BE1A0A04B8B5BE1ABE7BB8BABDAFB86EB7E9BDB406"
|
||||
$"079A362E302B333631393436333131BA61BA13B92FB97A0606BA0E2E302B332E"
|
||||
$"34B7FBBAABB92DBB44313634333131BA5FBA12B92DB979060566032B33363139"
|
||||
$"362E34B92DBB44B7FBBAAB0A0431363139343634331A0A010100000A00010110"
|
||||
$"01178400040A020102000A030103000A040104000A0601052020240A03010620"
|
||||
$"20240A0501072020240A00010830212401178400040A0701092021240A08010A"
|
||||
$"2021240A09010B2021240A0601052029280A0301062029280A0501072029280A"
|
||||
$"00010830322101178400040A0701092032210A08010A2032210A09010B203221"
|
||||
$"0A06010520332C0A03010620332C0A05010720332C0A00010830372A01178400"
|
||||
$"040A07010920372A0A08010A20372A0A09010B20372A"
|
||||
};
|
||||
|
||||
resource(1, "mouse_icon") #'VICN' array {
|
||||
$"6E636966080301000002000202B712F2385DDDBC4DA2BAFDDD4B6C60471E1F00"
|
||||
$"01000000FF010000FF020016023D2328BA287D3B40A23E5D334837CE48FA2500"
|
||||
$"69FF01020116023E40000000000000003E400048000048000000FBFFC0020106"
|
||||
$"02B832FBBACA8D3ACA8DB832FB48D3BB493902FFBEBEBE0001000005BE05FC01"
|
||||
$"0100007D0604033E2C3C2436263E222E2E282E342E2802082C4CB5EDC39ABA27"
|
||||
$"C5B7BFBFC883BD60C754C19AC9715052C4C9C842C722C5E9544EC6B5C656C90E"
|
||||
$"C3FDC7B7C08BC992C179C558BF5C4038C21FBDBFBDE5BBA232BD5BBB83BC04B9"
|
||||
$"2ABE5DB6FB42B7FDBF8AB5A4C1E30208475443544B54C6EB50C660C6ABC777C5"
|
||||
$"9456C487C803C508C9DBC33056405842543E42334E3536312C3A3036283EB628"
|
||||
$"C223B628C2232A4A344AB80EC27CBE0FC50F0604EE2E383838323638383B3635"
|
||||
$"333B332F3304032F3049304930433A36BA1DBE14413141330606FE0B4659C487"
|
||||
$"59C36B59C5605954C8E9C6D7C95AC91CC837CBD7C4FBCB67C614CC30C41DCAE7"
|
||||
$"C289CBC8C2FAC983C1D75443080A070105000A0101001001178400040A000302"
|
||||
$"01031001178422040A020101000A030102000A0001041001178100040A060104"
|
||||
$"123FE3AA0000000000003FDFFC41DB9540107701178100040A04010300"
|
||||
$"0100007D060404FE2C3C2634263A262E382A2C2A442A4E244EB7254E2402082C"
|
||||
$"4CB5EDC39ABA27C5B7BFBFC883BD60C754C19AC9715052C4C9C842C722C5E954"
|
||||
$"4EC6B5C656C90EC3FDC7B7C08BC992C179C558BF5C4038C21FBDBFBDE5BBA232"
|
||||
$"BD5BBB83BC04B92ABE5DB6FB42B7FDBF8AB5A4C1E30208475443544B54C6EB50"
|
||||
$"C660C6ABC777C59456C487C803C508C9DBC33056405842543E42334E3536312C"
|
||||
$"3A3036283EB628C223B628C2232A4A344AB80EC27CBE0FC50F0604EE2E383838"
|
||||
$"323638383B3635333B332F3304032F3049304930433A36BA1DBE144131413306"
|
||||
$"06FE0B4659C48759C36B59C5605954C8E9C6D7C95AC91CC837CBD7C4FBCB67C6"
|
||||
$"14CC30C41DCAE7C289CBC8C2FAC983C1D75443080A070105000A010100100117"
|
||||
$"8400040A00030201031001178422040A020101000A030102000A000104100117"
|
||||
$"8100040A060104123FE3AA0000000000003FDFFC41DB9540107701178100040A"
|
||||
$"04010300"
|
||||
};
|
||||
|
||||
resource(2, "touchpad_icon") #'VICN' array {
|
||||
$"6E6369660804016E0501020006023C67322F27DFB19BC13EBF7049ECF347B011"
|
||||
$"00E9ECF0FFAAB5BE0200060239FD3736EBD9BACFE23DD7074A5DFE48B6640084"
|
||||
$"96A3FF86A7BE020006033A061C3A03E4BED2853ED5A04B5372461D6F00BFCBD6"
|
||||
$"77D8E3EBFFAAB5BE0200060336E53E3693C0BD68493DD4084BB36248EBAC00D5"
|
||||
$"E7F6B47A98AEFF96A9B90200060237DFA0368620B6CBC53825414A24904B0B5F"
|
||||
$"00F3F3F3FFB8CBDB020002023CDA6E34E581B61D283E151248B8A9472070004F"
|
||||
$"617106FFFFFFFFEB080A045C3B5E3C475844580A043E334F39394E27450A0422"
|
||||
$"453A5153383E300606AE0B4456BFCFC6F3C096C757BEFEC68B3C52C3E0C1334E"
|
||||
$"45C4A7C1675046C64BC2B306032E4456BFCFC6F3C096C757BEFEC68B3C520605"
|
||||
$"EA0244563C52C3E0C1334E45C4A7C1675046C64BC2B30606BA0EC493C0805638"
|
||||
$"C9A6BC8AC912BC59CA44BCBF5C3AC6FEC201C606C10BC6D2C171C550C0B00802"
|
||||
$"3B364B3D080A000100000A01030206051001178422040A020101000A04020102"
|
||||
$"000A030201071001178100040A070101100215820004178100040A0502030600"
|
||||
$"0A06010400"
|
||||
};
|
||||
|
||||
|
||||
resource(3, "keyboard_icon") #'VICN' array {
|
||||
$"6E6369661E0500057705A705DF05C8050005FF0500057705A705DF05C8050005"
|
||||
$"FF0500057705A705A705DF05C8050005FF04005405000380000003E4000003FF"
|
||||
$"666603FF666603FFCCCC03FFCCCC17021CC676B65BC676B65BC64DB61DC5D7B5"
|
||||
$"C0C619B5E6C5BDB5AEC59CB597C59BB597C59CB597C0C2B32DC0C2B32DC00AB2"
|
||||
$"D1BE8AB382BF16B2F6BE8AB382BAE8B725BAE8B725BAE5B725BAA4B77CBAA4B7"
|
||||
$"7CBAA9B776BAC3B752BABDB757BA8CB78DBA48B822BA64B7D4BA36B840BA22B8"
|
||||
$"84BA28B861BA20B890BA20B8A8BA1FB89CBA20B89CBA23B886BA21B891BA23B8"
|
||||
$"86B959BCDDB959BCDDB954BCE9B953BD02B953BCF5B953BD87BA29BE4EB9ABBE"
|
||||
$"10BA2BBE50BA30BE50BA2DBE4FBA36BE53C080C176C080C176C0B0C18EC114C1"
|
||||
$"96C0E2C198C118C196C121C197C120C197C156C19745C170C189C189C1B5C173"
|
||||
$"C1A4C179C1ACC177C1B3C175C1D0C168C1C2C16FC1CAC16BC1BFC170C1C5C16D"
|
||||
$"C1E9C15FC238C11EC212C145C238C11EC62CBD2AC62CBD2AC67CBCDAC6CDBBD0"
|
||||
$"C6CDBC50C6CDBBD0C6CDB712C6CDB712C6C7B6C7C677B65BC6A8B688C677B65B"
|
||||
$"0209C5E5B6E9C5E5B6E9C5CBB6B2C569B668C59FB685C5AAB69EC57CB72FC5B2"
|
||||
$"B6EEC57CB72FC1A3BB06C1A3BB06C16CBB3EC13FBBD0C13EBB99C13FBBD0C13F"
|
||||
$"C08FC13FC08FC13FC0C7C1A4C08FC16CC0C7C1A4C08FC598BC9BC598BC9BC5D0"
|
||||
$"BC63C5FEBBD0C5FEBC09C5FEBBD0021AC13EBBD2C13EBBD2C13EBB9AC1A4BB08"
|
||||
$"C16CBB40C1A4BB08C1C9BAE3C1C9BAE3C17DBB29C096BB15C0FABB3EC096BB15"
|
||||
$"BB91B896BB91B896BB3CB85EBB77B7B5BB2EB7FEBB77B7B5BB74B7B4BB74B7B4"
|
||||
$"BB67B7C1BB57B7DD35B7CFBB2EB808BAFEB878BB10B83DBAFDB878BAFDB879BA"
|
||||
$"FDB879BAF2B884BAEAB8A8BAEAB893BAEAB8A8BA20BD02BA20BD02BA20BD39BA"
|
||||
$"86BD99BA4DBD7EBA86BD99BA89BD9BBA89BD9BBA51BD7FBA24BD03BA23BD3BBA"
|
||||
$"24BD03BA24BD02BA24BD02BA25BD3ABA8ABD99BA51BD7EBA8ABD99C0DDC0C1C0"
|
||||
$"DDC0C1C0F3C0CBC118C0CBC107C0CEC11BC0CCC123C0CDC11FC0CDC140C0CDC1"
|
||||
$"70C0B644C0C3C156C0BEC144C090C144C0B2C144C090C144C08FC144C08FC144"
|
||||
$"C091C144C095C144C093C144C092C145C08EC145C090C145C08EC145BBD2C145"
|
||||
$"BBD2C145BBD20209C541B64DC541B64DC541B64DC067B3E2C067B3E2BFFEB3AD"
|
||||
$"BF1AB411BF68B3C2BF1AB411BB77B7B4BB77B7B4BB27B803BBA7B8A2BB3DB86E"
|
||||
$"BBA7B8A2C081BB0DC081BB0DC0EABB42C1CFBADEC180BB2CC1CFBADEC571B73B"
|
||||
$"C571B73BC5BFB6ECC541B64DC5AAB681C541B64D020CBF31B532BF31B532BF50"
|
||||
$"B504BF6AB4DFBF6AB4DFBF6BB4DFBF23B526BF4AB4FFBF23B526BC0FB839BC0F"
|
||||
$"B839BBE8B860BBB4B898BBBFB88BBBB4B898BBB7B8A6BBB4B898BBB9B8B3BBBA"
|
||||
$"B8B3BBB9B8B3BBCEB8C2BC3A2FBC08B8E1BC3A2FC05CBB0BC05CBB0BC08EBB24"
|
||||
$"C066BAFBC092BB1DC066BAFBBD4BB8A9BD4BB8A9BD1FB888BD34B819BD14B847"
|
||||
$"BD34B8190210C1CDB6EEC1CDB6EEC125B69AC033B735C09AB6F3BFC7B77ABF68"
|
||||
$"B77BBF93B791BF30B75FBF7BB702BF5CB721BFCDB6B0C03EB6D6C015B6C9C03E"
|
||||
$"B6D6C09FB66BC09FB66BC000B623BF0CB6C9BF71B664BE76B75FBF11B7E2BEC6"
|
||||
$"B7BDBFA8B82DC083B7A5C03FB7D0C101B756C16BB755C131B738C197B76BC165"
|
||||
$"B7E9C1ADB7A1C107B847C072B818C09AB824C072B818C01BB882C01BB882C113"
|
||||
$"B8DFC1D8B824C1A1B85BC1F0B80CC234B79CC222B7D7C23FB761C1CEB6EEC221"
|
||||
$"B718C1CEB6EE060FFEFFAF3FC570B73BC1CEBADDC1CEBADDC17FBB2DC081BB0D"
|
||||
$"C0EABB42C081BB0DBBA6B8A2BBA6B8A2BB3DB86EBB76B7B5BB28B804BB76B7B5"
|
||||
$"BB74B7B4BB74B7B4BB67B7C1BB57B7DD35B7CFBB2EB808BAFDB878BB0FB83EBA"
|
||||
$"FDB878BAFDB879BAFDB879BAF1B884BAEAB8A8BAE9B893BAEAB8A8BA1FBD02BB"
|
||||
$"92B979C028BBC2C028BBC2C0DFBC1EC235BB41C14ABC2DC31DBA56C571B73BC5"
|
||||
$"70B73BC571B73B021CC023BCAFC023BCAFBFFABC70BF84BC13BFC6BC39BF69BC"
|
||||
$"01BF49BBEBBF48BBEBBF49BBEBBA6EB980BA6EB980B9B7B924B837B9D5B8C3B9"
|
||||
$"49B837B9D5B494BD78B494BD78B491BD78B451BDD0B451BDD0B456BDC9B470BD"
|
||||
$"A5B46ABDABB438BDE0B3F4BE75B410BE27B3E2BE93B3CFBED7B3D5BEB4B3CDBE"
|
||||
$"E322BEFB22BEF022BEF0B3CFBED9B3CDBEE4B3CFBED9B306C331B306C33120C3"
|
||||
$"3D20C35520C34920C3DAB3D6C4A2B358C463B3D8C4A3B3DDC4A3B3DAC4A2B3E2"
|
||||
$"C4A6BA2DC7C932C7C9BA5DC7E1BAC0C7E9BA8FC7EBBAC4C7E9BACDC7EBBACDC7"
|
||||
$"EBBB03C7EBBB6AC7C3BB36C7DDBB62C7C7BB50C7CDBB59C7CBBB60C7C9BB7CC7"
|
||||
$"BBBB6EC7C3BB77C7BEBB6CC7C3BB71C7C0BB96C7B3BBE5C772BBBEC798BBE5C7"
|
||||
$"72BFD9C37DBFD9C37DC028C32EC07A46C079C2A4C07A46C07ABD65C07ABD65C0"
|
||||
$"74BD1AC023BCAFC054BCDBC023BCAF0209BF92BD3DBF92BD3DBF78BD05BF16BC"
|
||||
$"BCBF4CBCD8BF57BCF1BF28BD82BF5FBD41BF28BD82BB51C159BB51C159BB19C1"
|
||||
$"92BAEC46BAECC1ECBAEC46BAECC6E2BAECC6E2BAECC71ABB52C6E2BB19C71ABB"
|
||||
$"52C6E2BF46C2EEBF46C2EEBF7EC2B7BFAC46BFABC25CBFAC46021ABAEBC226BA"
|
||||
$"EBC226BAEBC1EEBB50C15BBB18C193BB50C15BBB75C137BB75C137BB29C17DBA"
|
||||
$"42C169BAA6C191BA42C169B53EBEE9B53EBEE9B4E8BEB1B524BE09B4DABE52B5"
|
||||
$"24BE09B521BE07B521BE07B514BE14B504BE30B50BBE22B4DABE5CB4ABBECBB4"
|
||||
$"BCBE90B4AABECCB4AABECDB4AABECCB49EBED7B497BEFBB496BEE6B497BEFB22"
|
||||
$"C35522C35522C38D23C3EDB3FAC3D023C3EDB435C3EEB435C3EEB3FEC3D2B3D0"
|
||||
$"49B3D0C38EB3D049B3D0C355B3D0C355B3D2C38EB436C3ECB3FEC3D1B436C3EC"
|
||||
$"BA8AC714BA8AC714BAA0C71FBAC5C71EBAB4C722BAC8C71FBACFC720BACBC720"
|
||||
$"BAECC720BB1DC709BB05C716BB03C711BAF1C6E4BAF0C706BAF1C6E4BAF1C6E3"
|
||||
$"BAF1C6E3BAF1C6E4BAF1C6E8BAF0C6E6BAF1C6E6BAF2C6E1BAF1C6E4BAF2C6E1"
|
||||
$"BAF2C226BAF2C226BAF2C2260209BEEDBCA0BEEDBCA0BEEDBCA0BA14BA35BA14"
|
||||
$"BA35B9AABA00B8C6BA65B915BA16B8C6BA65B524BE07B524BE07B4D4BE56B554"
|
||||
$"BEF6B4E9BEC1B554BEF6BA2DC160BA2DC160BA97C195BB7CC130BB2DC17FBB7C"
|
||||
$"C130BF1EBD8EBF1EBD8EBF6CBD3FBEEEBCA0BF57BCD5BEEEBCA0020CB8DDBB86"
|
||||
$"B8DDBB86B8FDBB58B917BB32B917BB32B918BB32B8D0BB79B8F7BB52B8D0BB79"
|
||||
$"B5BCBE8DB5BCBE8DB594BEB4B561BEEBB56BBEDEB561BEEB26BEF9B561BEEBB5"
|
||||
$"66BF07B566BF07B566BF07B57BBF15B5E6BF4EB5B4BF35B5E6BF4EBA09C15EBA"
|
||||
$"09C15EBA3BC177BA13C14FBA3FC170BA13C14FB6F8BEFDB6F8BEFDB6CCBEDBB6"
|
||||
$"E1BE6CB6C1BE9AB6E1BE6C0A08B8F3BCE7B885BD54BA6ABF71BAD8BF02BA68BE"
|
||||
$"8BBB35BDBFBBFBBDDFBC6CBD6E0A03BA14BE32B95BBD6EBAA1BDA6060FFEFFAF"
|
||||
$"3FBF1EBD8EBB7BC130BB7BC130BB2CC180BA2DC160BA96C195BA2DC160B553BE"
|
||||
$"F6B553BEF6B4EABEC1B523BE08B4D5BE57B523BE08B521BE07B521BE07B514BE"
|
||||
$"14B503BE30B50ABE22B4DABE5CB4AABECBB4BCBE90B4AABECCB4AABECDB4AABE"
|
||||
$"CCB49EBED7B497BEFBB496BEE6B497BEFB22C355B53EBFCCB9D5C216B9D5C216"
|
||||
$"BA8CC271BBE2C195BAF7C280BCCAC0AABF1EBD8EBF1EBD8EBF1EBD8E001BCBFF"
|
||||
$"BE43CBFFBE43CBD6BE05CB60BDA8CBA2BDCECB46BD96CB25BD80CB24BD80CB25"
|
||||
$"BD80C64BBB15C64BBB15C593BAB9C413BB6AC49FBADEC413BB6AC071BF0DC071"
|
||||
$"BF0DC06EBF0DC02DBF64C02DBF64C032BF5EC04CBF3AC046BF3FC015BF75BFD1"
|
||||
$"C00ABFEDBFBCBFBFC028BFABC06CBFB1C049BFA9C078BFA9C090BFA8C084BFA9"
|
||||
$"C084BFACC06EBFAAC079BFACC06EBEE2C4C5BEE2C4C5BEC7C559BFB4C636BF34"
|
||||
$"C5F7BFB6C637BFBBC638BFB8C637BFC1C63BC60CC95EC60BC95EC63CC976C69F"
|
||||
$"C97DC66EC980C6A3C97EC6ACC97FC6ACC97FC6E1C97FC749C958C714C972C740"
|
||||
$"C95BC72FC961C737C95FC73EC95DC75B58C74DC957C756C953C74BC958C750C9"
|
||||
$"55C775C947C7C4C906C79DC92CC7C4C906CBB8C512CBB8C512CC07C4C2CC59C3"
|
||||
$"B9CC58C439CC59C3B9CC59BEFACC59BEFACC50BEAFCBFFBE43CC31BE70CBFFBE"
|
||||
$"430209CB6EBED2CB6EBED2CB54BE9ACAF2BE51CB28BE6DCB33BE86CB04BF17CB"
|
||||
$"3BBED6CB04BF17C72DC2EFC72DC2EFC6F5C326C6C8C3B9C6C8C381C6C8C3B9C6"
|
||||
$"C8C878C6C8C878C6C8C8AFC72EC878C6F6C8AFC72EC878CB22C484CB22C484CB"
|
||||
$"5AC44BCB88C3B9CB88C3F1CB88C3B90219C6C7C3BBC6C7C3BBC6C7C383C72D48"
|
||||
$"C6F5C328C72D4853C2CC53C2CCC706C312C61EC2FDC683C326C61EC2FDC11AC0"
|
||||
$"7EC11AC07EC0C5C046C100BF9EC0B6BFE6C100BF9EC0FDBF9CC0FDBF9CC0F0BF"
|
||||
$"A9C0DFBFC5C0E7BFB7C0B6BFF1C086C060C09841C086C060C086C061C086C061"
|
||||
$"C07BC06CC073C090C073C07BC073C090BFA9C4EABFA9C4EABFA9C521C00EC582"
|
||||
$"BFD6C565C00EC582C011C583C011C583BFDAC567BFADC4EBBFACC523BFADC4EB"
|
||||
$"BFADC4EABFADC4EABFAEC522C012C581BFDAC566C012C581C666C8A9C666C8A9"
|
||||
$"C67CC8B3C6A1C8B3C690C8B6C6A4C8B4C6ACC8B5C6A8C8B5C6C9C8B5C6F9C89E"
|
||||
$"C6E1C8ABC6DFC8A6C6CDC879C6CDC89BC6CDC879C6CDC878C6CDC878C6CDC879"
|
||||
$"C6CDC87DC6CDC87BC6CDC87BC6CEC876C6CEC879C6CEC876060EBFFBFF0FC6C7"
|
||||
$"C3BBC6C7C3BBC6C7C383C61EC2FDC683C326C61EC2FDC11AC07EC11AC07EC0C5"
|
||||
$"C046C073C090BFB3C494BFB3C494BF8DC514C00EC582C666C8A9C666C8A9C67C"
|
||||
$"C8B3C6A1C8B3C690C8B6C6A4C8B4C6ACC8B5C6A8C8B5C6C9C8B5C6F9C89EC6E1"
|
||||
$"C8ABC6DFC8A6C6CDC879C6CDC89BC6CDC879C6CDC878C6CDC878C6CDC879C6CD"
|
||||
$"C87DC6CDC87BC6CDC87BC6CEC876C6CEC879C6CEC8760209CACABE35CACABE35"
|
||||
$"CACABE35C5F0BBCAC5F0BBCAC587BB95C4A2BBF9C4F1BBABC4A2BBF9C100BF9C"
|
||||
$"C100BF9CC0B0BFEBC130C08AC0C6C056C130C08AC60AC2F5C60AC2F5C673C32A"
|
||||
$"C758C2C6C709C314C758C2C6CAFBBF23CAFBBF23CB48BED4CACABE35CB33BE69"
|
||||
$"CACABE350604EE4D38C1A9C036C17EBF27C1BFC0C4C62CC2D6C2BDBFF3C297C0"
|
||||
$"E7C2E2BEFE0A0AC7A0BEFBC67DC01EC5C8BE20C55DBDEAC3E6BF61C459BF9CC5"
|
||||
$"48BEACC5F8C097C674C0D4C813BF350608FFBE5149524950494442454343414E"
|
||||
$"364F364D364241433F4143404E434442454443514B504B524B5D3E1E0A000100"
|
||||
$"000A010101000A020102000A030103000A040104000A050105000A060106000A"
|
||||
$"070107000A080108000A090109000A0A010A000A0B010B000A0C020C0D000A0D"
|
||||
$"010E000A0E010F000A0F0110000A100111000A110112000A120113000A130114"
|
||||
$"000A140115000A150116000A1600000A1700000A1800000A1900000A1A00000A"
|
||||
$"1B00000A1C00000A1D0000"
|
||||
};
|
||||
|
@ -25,6 +25,137 @@
|
||||
#define B_TRANSLATION_CONTEXT "DeviceList"
|
||||
|
||||
|
||||
InputIcons* DeviceListItemView::sIcons = NULL;
|
||||
|
||||
|
||||
DeviceListItemView::DeviceListItemView(BString title, input_type type)
|
||||
:
|
||||
BListItem((uint32)0),
|
||||
fTitle(title),
|
||||
fInputType(type)
|
||||
{
|
||||
}
|
||||
|
||||
struct DeviceListItemView::Renderer {
|
||||
Renderer()
|
||||
:
|
||||
fTitle(NULL),
|
||||
fPrimaryIcon(NULL),
|
||||
fSelected(false)
|
||||
{
|
||||
}
|
||||
|
||||
void AddIcon(BBitmap* icon)
|
||||
{
|
||||
if (!fPrimaryIcon)
|
||||
fPrimaryIcon = icon;
|
||||
}
|
||||
|
||||
void SetTitle(const char* title)
|
||||
{
|
||||
fTitle = title;
|
||||
}
|
||||
|
||||
void SetSelected(bool selected)
|
||||
{
|
||||
fSelected = selected;
|
||||
}
|
||||
|
||||
void Render(BView* onto, BRect frame, bool complete = false)
|
||||
{
|
||||
const rgb_color lowColor = onto->LowColor();
|
||||
const rgb_color highColor = onto->HighColor();
|
||||
|
||||
if (fSelected || complete) {
|
||||
if (fSelected)
|
||||
onto->SetLowColor(ui_color(B_LIST_SELECTED_BACKGROUND_COLOR));
|
||||
onto->FillRect(frame, B_SOLID_LOW);
|
||||
}
|
||||
|
||||
BPoint point(frame.left + 4.0f,
|
||||
frame.top + (frame.Height() - InputIcons::sBounds.Height()) / 2.0f);
|
||||
|
||||
BRect iconFrame(InputIcons::IconRectAt(point + BPoint(1, 0)));
|
||||
|
||||
onto->SetDrawingMode(B_OP_OVER);
|
||||
if (fPrimaryIcon) {
|
||||
onto->DrawBitmap(fPrimaryIcon, iconFrame);
|
||||
point.x = iconFrame.right + 1;
|
||||
}
|
||||
|
||||
onto->SetDrawingMode(B_OP_COPY);
|
||||
|
||||
BFont font = be_plain_font;
|
||||
font_height fontInfo;
|
||||
font.GetHeight(&fontInfo);
|
||||
|
||||
onto->SetFont(&font);
|
||||
onto->MovePenTo(point.x + 8, frame.top
|
||||
+ fontInfo.ascent + (frame.Height()
|
||||
- ceilf(fontInfo.ascent + fontInfo.descent)) / 2.0f);
|
||||
onto->DrawString(fTitle);
|
||||
|
||||
onto->SetHighColor(highColor);
|
||||
onto->SetLowColor(lowColor);
|
||||
}
|
||||
|
||||
float ItemWidth()
|
||||
{
|
||||
float width = 4.0f;
|
||||
width += be_plain_font->StringWidth(fTitle) + 16.0f;
|
||||
return width;
|
||||
}
|
||||
private:
|
||||
|
||||
BString fTitle;
|
||||
BBitmap* fPrimaryIcon;
|
||||
bool fSelected;
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
DeviceListItemView::Update(BView* owner, const BFont* font)
|
||||
{
|
||||
BListItem::Update(owner, font);
|
||||
|
||||
float iconHeight = InputIcons::sBounds.Height() + 1;
|
||||
if ((Height() < iconHeight + kITEM_MARGIN * 2)) {
|
||||
SetHeight(iconHeight + kITEM_MARGIN * 2);
|
||||
}
|
||||
|
||||
Renderer renderer;
|
||||
renderer.SetTitle(Label());
|
||||
renderer.SetTitle(fTitle);
|
||||
SetRenderParameters(renderer);
|
||||
SetWidth(renderer.ItemWidth());
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
DeviceListItemView::DrawItem(BView* owner, BRect frame, bool complete)
|
||||
{
|
||||
Renderer renderer;
|
||||
renderer.SetSelected(IsSelected());
|
||||
renderer.SetTitle(Label());
|
||||
SetRenderParameters(renderer);
|
||||
renderer.Render(owner, frame, complete);
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
DeviceListItemView::SetRenderParameters(Renderer& renderer)
|
||||
{
|
||||
if (fInputType == MOUSE_TYPE)
|
||||
renderer.AddIcon(&Icons()->mouseIcon);
|
||||
|
||||
else if (fInputType == TOUCHPAD_TYPE)
|
||||
renderer.AddIcon(&Icons()->touchpadIcon);
|
||||
|
||||
else if (fInputType == KEYBOARD_TYPE)
|
||||
renderer.AddIcon(&Icons()->keyboardIcon);
|
||||
}
|
||||
|
||||
|
||||
DeviceListView::DeviceListView(const char* name)
|
||||
:
|
||||
BView(name, B_WILL_DRAW)
|
||||
|
@ -19,24 +19,65 @@
|
||||
#include <ScrollView.h>
|
||||
#include <View.h>
|
||||
|
||||
|
||||
#include "InputIcons.h"
|
||||
#include "InputTouchpadPref.h"
|
||||
#include "MouseSettings.h"
|
||||
|
||||
|
||||
#define ITEM_SELECTED 'I1s'
|
||||
|
||||
#define kITEM_MARGIN 1
|
||||
#define GREATER_THAN -1
|
||||
#define LESS_THAN 1
|
||||
|
||||
|
||||
class InputIcons;
|
||||
class TouchpadPref;
|
||||
class MouseSettings;
|
||||
|
||||
enum input_type {
|
||||
MOUSE_TYPE,
|
||||
TOUCHPAD_TYPE,
|
||||
KEYBOARD_TYPE
|
||||
};
|
||||
|
||||
class DeviceListItemView : public BListItem {
|
||||
public:
|
||||
DeviceListItemView(BString title, input_type type);
|
||||
|
||||
void Update(BView* owner, const BFont* font);
|
||||
void DrawItem(BView* owner, BRect frame,
|
||||
bool complete = false);
|
||||
|
||||
const char* Label() { return fTitle.String();}
|
||||
|
||||
|
||||
static InputIcons* Icons() {return sIcons;}
|
||||
static void SetIcons(InputIcons* icons) {sIcons = icons;}
|
||||
|
||||
protected:
|
||||
struct Renderer;
|
||||
|
||||
void SetRenderParameters(Renderer& renderer);
|
||||
|
||||
private:
|
||||
|
||||
static InputIcons* sIcons;
|
||||
BString fTitle;
|
||||
input_type fInputType;
|
||||
};
|
||||
|
||||
|
||||
class DeviceListView: public BView {
|
||||
public:
|
||||
DeviceListView(const char *name);
|
||||
virtual ~DeviceListView();
|
||||
virtual void AttachedToWindow();
|
||||
BListView* fDeviceList;
|
||||
DeviceListView(const char *name);
|
||||
virtual ~DeviceListView();
|
||||
virtual void AttachedToWindow();
|
||||
BListView* fDeviceList;
|
||||
|
||||
private:
|
||||
BScrollView* fScrollView;
|
||||
BScrollView* fScrollView;
|
||||
};
|
||||
|
||||
#endif // _INPUT_DEVICE_VIEW_H */
|
||||
|
75
src/preferences/input/InputIcons.cpp
Normal file
75
src/preferences/input/InputIcons.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2020, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include "InputIcons.h"
|
||||
|
||||
#include <Application.h>
|
||||
#include <File.h>
|
||||
#include <IconUtils.h>
|
||||
#include <Resources.h>
|
||||
#include <Roster.h>
|
||||
|
||||
#include "IconHandles.h"
|
||||
|
||||
|
||||
#define ICON_SIZE 15
|
||||
|
||||
const BRect InputIcons::sBounds(0, 0, ICON_SIZE, ICON_SIZE);
|
||||
|
||||
|
||||
InputIcons::InputIcons()
|
||||
:
|
||||
mouseIcon(sBounds, B_CMAP8),
|
||||
touchpadIcon(sBounds, B_CMAP8),
|
||||
keyboardIcon(sBounds, B_CMAP8)
|
||||
{
|
||||
app_info info;
|
||||
be_app->GetAppInfo(&info);
|
||||
BFile executableFile(&info.ref, B_READ_ONLY);
|
||||
BResources resources(&executableFile);
|
||||
resources.PreloadResourceType(B_VECTOR_ICON_TYPE);
|
||||
|
||||
_LoadBitmap(&resources);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
InputIcons::_LoadBitmap(BResources* resources)
|
||||
{
|
||||
const uint8* mouse;
|
||||
const uint8* touchpad;
|
||||
const uint8* keyboard;
|
||||
|
||||
size_t size;
|
||||
|
||||
mouse = (const uint8*)resources->LoadResource(
|
||||
B_VECTOR_ICON_TYPE, "mouse_icon", &size);
|
||||
if (mouse) {
|
||||
mouseIcon = new BBitmap(sBounds, 0, B_RGBA32);
|
||||
BIconUtils::GetVectorIcon(mouse, size, &mouseIcon);
|
||||
}
|
||||
|
||||
touchpad = (const uint8*)resources->LoadResource(
|
||||
B_VECTOR_ICON_TYPE, "touchpad_icon", &size);
|
||||
if (touchpad) {
|
||||
touchpadIcon = new BBitmap(sBounds, 0, B_RGBA32);
|
||||
BIconUtils::GetVectorIcon(touchpad, size, &touchpadIcon);
|
||||
}
|
||||
|
||||
keyboard = (const uint8*)resources->LoadResource(
|
||||
B_VECTOR_ICON_TYPE, "keyboard_icon", &size);
|
||||
if (keyboard) {
|
||||
keyboardIcon = new BBitmap(sBounds, 0, B_RGBA32);
|
||||
BIconUtils::GetVectorIcon(keyboard, size, &keyboardIcon);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
BRect
|
||||
InputIcons::IconRectAt(const BPoint& topLeft)
|
||||
{
|
||||
return BRect(sBounds).OffsetToSelf(topLeft);
|
||||
}
|
32
src/preferences/input/InputIcons.h
Normal file
32
src/preferences/input/InputIcons.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2020, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef __INPUT_ICONS_H
|
||||
#define __INPUT_ICONS_H
|
||||
|
||||
|
||||
#include <Bitmap.h>
|
||||
|
||||
|
||||
class BResources;
|
||||
|
||||
|
||||
struct InputIcons {
|
||||
InputIcons();
|
||||
|
||||
BBitmap mouseIcon;
|
||||
BBitmap touchpadIcon;
|
||||
BBitmap keyboardIcon;
|
||||
|
||||
static BRect IconRectAt(const BPoint& topLeft);
|
||||
|
||||
static const BRect sBounds;
|
||||
|
||||
private:
|
||||
|
||||
void _LoadBitmap(BResources* resources);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -183,15 +183,21 @@ InputWindow::AddDevice(BInputDevice* dev)
|
||||
|
||||
TouchpadPrefView* view = new TouchpadPrefView(dev);
|
||||
fCardView->AddChild(view);
|
||||
fDeviceListView->fDeviceList->AddItem(new BStringItem(name));
|
||||
DeviceListItemView* touchpad = new DeviceListItemView(
|
||||
name, TOUCHPAD_TYPE);
|
||||
fDeviceListView->fDeviceList->AddItem(touchpad);
|
||||
} else if (dev->Type() == B_POINTING_DEVICE) {
|
||||
InputMouse* view = new InputMouse(dev);
|
||||
fCardView->AddChild(view);
|
||||
fDeviceListView->fDeviceList->AddItem(new BStringItem(name));
|
||||
DeviceListItemView* mouse = new DeviceListItemView(
|
||||
name, MOUSE_TYPE);
|
||||
fDeviceListView->fDeviceList->AddItem(mouse);
|
||||
} else if (dev->Type() == B_KEYBOARD_DEVICE) {
|
||||
InputKeyboard* view = new InputKeyboard(dev);
|
||||
fCardView->AddChild(view);
|
||||
fDeviceListView->fDeviceList->AddItem(new BStringItem(name));
|
||||
DeviceListItemView* keyboard = new DeviceListItemView(
|
||||
name, KEYBOARD_TYPE);
|
||||
fDeviceListView->fDeviceList->AddItem(keyboard);
|
||||
} else {
|
||||
delete dev;
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ public:
|
||||
void AddDevice(BInputDevice* device);
|
||||
private:
|
||||
|
||||
DeviceListView* fDeviceListView;
|
||||
BCardView* fCardView;
|
||||
DeviceListView* fDeviceListView;
|
||||
BCardView* fCardView;
|
||||
};
|
||||
|
||||
#endif /* INPUT_WINDOW_H */
|
||||
|
@ -5,6 +5,7 @@ UsePrivateHeaders input ;
|
||||
Preference Input :
|
||||
Input.cpp
|
||||
InputDeviceView.cpp
|
||||
InputIcons.cpp
|
||||
InputKeyboard.cpp
|
||||
InputMouse.cpp
|
||||
InputTouchpadPref.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user